Browse files

Mark/Jamie - PODIV-25 - Displaying page performance score for every b…

…uild
  • Loading branch information...
1 parent 9fcbaf4 commit dd5112dfbae4f9f5177caf0dd345f26b0e255309 @ericsmalling ericsmalling committed May 6, 2011
View
1 .gitignore
@@ -0,0 +1 @@
+.idea
View
25 jenkins_radiator/radiator/models.py
@@ -48,6 +48,7 @@ def __init__(self, buildjson = None, projectName = None):
self.dateTimeStamp = datetime.datetime.fromtimestamp(self.timeStamp)
self.smokeTests = {}
self.regressionTests = {}
+ self.perfTests = {}
self.parent = None
self.projectName = projectName
self.builtOn= buildjson['builtOn']
@@ -124,6 +125,19 @@ def isSmokeStatusSame(self):
return result
@property
+ def perfPages(self):
+ try:
+ artifactsJson = json.loads(urllib2.urlopen(self.url + "api/json").read())["artifacts"]
+ pagePerformanceRecords = []
+ for pageJson in artifactsJson:
+ fileName = re.search("^\d+-(.*)\.json", pageJson["fileName"]).group(1)
+ urlToPageData = self.url + "artifact/" + pageJson["relativePath"]
+ pagePerformanceRecords.append(PagePerformance(fileName, json.loads(urllib2.urlopen(urlToPageData).read())))
+ return pagePerformanceRecords
+ except urllib2.HTTPError:
+ return None
+
+ @property
def isRegressionStatusSame(self):
firstTest = self.regressionTests.values()[0]
result = all( (item.status == firstTest.status) for item in self.regressionTests.values())
@@ -224,6 +238,11 @@ def get_test_projects(data, build_type):
testList = [job['name'] for job in jobs if job['name'].upper().startswith(build_type.upper() + '_TEST_')]
return testList
+def get_performance_projects(data, build_type):
+ jobs = data['jobs']
+ perfList = [job['name'] for job in jobs if job['name'].upper().startswith(build_type.upper() + '_PERFORMANCE_')]
+ return perfList
+
def flatten(x):
cases = []
cases.extend(x)
@@ -252,3 +271,9 @@ def getTestData(jsonData,runNumber):
tests.extend([TestData(case,runNumber)])
return tests
+
+
+class PagePerformance(object):
+ def __init__(self, pageName, pageJsonData):
+ self.pageName = pageName
+ self.pageScore = pageJsonData["o"]
View
20 jenkins_radiator/radiator/views.py
@@ -39,6 +39,8 @@ def lookupTests(build_type, count, builds):
project.smokeTests = [proj for proj in testProjects if settings.HUDSON_SMOKE_NAME_REGEX.findall(proj) ]
project.otherTests = [proj for proj in testProjects if not settings.HUDSON_SMOKE_NAME_REGEX.findall(proj) ]
+ project.perfTests = models.get_performance_projects(models.get_data(settings.HUDSON_URL + '/api/json?tree=jobs[name]'), build_type)
+
buildDict = dict((build.number,build) for build in builds)
smokeBuilds = []
@@ -49,6 +51,10 @@ def lookupTests(build_type, count, builds):
for testName in project.otherTests:
regressionBuilds.extend(models.get_recent_builds( testName, count ))
+ perfBuilds = []
+ for testName in project.perfTests:
+ perfBuilds.extend(models.get_recent_builds( testName, count ))
+
for test in smokeBuilds:
parent = buildDict.get(test.parent)
if parent is not None:
@@ -60,16 +66,26 @@ def lookupTests(build_type, count, builds):
if parent is not None:
if test.project not in parent.regressionTests or int(test.number) > int(parent.regressionTests[test.project].number):
parent.regressionTests[test.project] = test
+
+ for test in perfBuilds:
+ parent = buildDict.get(test.parent)
+ if parent is not None:
+ if test.project not in parent.perfTests or int(test.number) > int(parent.perfTests[test.project].number):
+ parent.perfTests[test.project] = test
for build in builds:
for smoke in project.smokeTests:
if smoke not in build.smokeTests:
build.smokeTests[smoke]= models.Build(projectName=smoke)
-
+
+ for perf in project.perfTests:
+ if perf not in build.perfTests:
+ build.perfTests[perf]= models.Build(projectName=perf)
+
for other in project.otherTests:
if other not in build.regressionTests:
build.regressionTests[other]= models.Build(projectName=other)
-
+
return buildDict
def get_project_report(request, build_type):
View
26 jenkins_radiator/templates/radiator/build_row.html
@@ -38,7 +38,7 @@
&nbsp;<a href="{{test.url}}">R</a>&nbsp;{% endspaceless %}
</div>
{% endfor %}
- {% if build.failedSmokeTests %}
+ {% if build.failedSmokeTests %}
<div class="gap"/>
<table class="tests">
<tr>
@@ -53,7 +53,7 @@
</tr>
</table>
{% endif %}
- {% if build.failedRegressionTests %}
+ {% if build.failedRegressionTests %}
<div class="gap"/>
<table class="tests">
<tr>
@@ -68,6 +68,22 @@
</tr>
</table>
{% endif %}
+ {% for test in build.perfTests.values|sortedByName %}
+ {% if test.status == "SUCCESS" %}
+ {% for page in test.perfPages %}
+ <div class="shadow box {{test.status}} tertiary"
+ title="{{page.pageName}}">{% spaceless %}
+ {% include "radiator/test_spinner.html" %}
+ &nbsp;<a href="{{test.url}}">{{ page.pageName }} {{ page.pageScore }}</a>&nbsp;{% endspaceless %}
+ </div>
+ {% endfor %}
+ {% else %}
+ <div class="shadow box {{test.status}} tertiary" title="{{test.name}}: {{test.status|transformTestStatus}}">{% spaceless %}
+ {% include "radiator/test_spinner.html" %}
+ &nbsp;<a href="{{test.url}}">P</a>&nbsp;{% endspaceless %}
+ </div>
+ {% endif %}
+ {% endfor %}
{% else %}
{% if build.status == "UNSTABLE" %}
<div class="broken {{build.status}} secondary">JUNIT TESTS BREAKING!</div>
@@ -76,9 +92,9 @@
<div class="broken {{build.status}} secondary">BUILD {{build.status}}!</div>
{% endif %}
{% endif %}
- <div class="gap"/>
- <div class="clear-both"></div>
- </div>
+ <div class="gap"/>
+ <div class="clear-both"></div>
+ </div>
</div>
<div class="gap"/>
<script>

0 comments on commit dd5112d

Please sign in to comment.