Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…uild
  • Loading branch information...
commit dd5112dfbae4f9f5177caf0dd345f26b0e255309 1 parent 9fcbaf4
Eric Smalling ericsmalling authored
1  .gitignore
... ... @@ -0,0 +1 @@
  1 +.idea
25 jenkins_radiator/radiator/models.py
@@ -48,6 +48,7 @@ def __init__(self, buildjson = None, projectName = None):
48 48 self.dateTimeStamp = datetime.datetime.fromtimestamp(self.timeStamp)
49 49 self.smokeTests = {}
50 50 self.regressionTests = {}
  51 + self.perfTests = {}
51 52 self.parent = None
52 53 self.projectName = projectName
53 54 self.builtOn= buildjson['builtOn']
@@ -124,6 +125,19 @@ def isSmokeStatusSame(self):
124 125 return result
125 126
126 127 @property
  128 + def perfPages(self):
  129 + try:
  130 + artifactsJson = json.loads(urllib2.urlopen(self.url + "api/json").read())["artifacts"]
  131 + pagePerformanceRecords = []
  132 + for pageJson in artifactsJson:
  133 + fileName = re.search("^\d+-(.*)\.json", pageJson["fileName"]).group(1)
  134 + urlToPageData = self.url + "artifact/" + pageJson["relativePath"]
  135 + pagePerformanceRecords.append(PagePerformance(fileName, json.loads(urllib2.urlopen(urlToPageData).read())))
  136 + return pagePerformanceRecords
  137 + except urllib2.HTTPError:
  138 + return None
  139 +
  140 + @property
127 141 def isRegressionStatusSame(self):
128 142 firstTest = self.regressionTests.values()[0]
129 143 result = all( (item.status == firstTest.status) for item in self.regressionTests.values())
@@ -224,6 +238,11 @@ def get_test_projects(data, build_type):
224 238 testList = [job['name'] for job in jobs if job['name'].upper().startswith(build_type.upper() + '_TEST_')]
225 239 return testList
226 240
  241 +def get_performance_projects(data, build_type):
  242 + jobs = data['jobs']
  243 + perfList = [job['name'] for job in jobs if job['name'].upper().startswith(build_type.upper() + '_PERFORMANCE_')]
  244 + return perfList
  245 +
227 246 def flatten(x):
228 247 cases = []
229 248 cases.extend(x)
@@ -252,3 +271,9 @@ def getTestData(jsonData,runNumber):
252 271 tests.extend([TestData(case,runNumber)])
253 272
254 273 return tests
  274 +
  275 +
  276 +class PagePerformance(object):
  277 + def __init__(self, pageName, pageJsonData):
  278 + self.pageName = pageName
  279 + self.pageScore = pageJsonData["o"]
20 jenkins_radiator/radiator/views.py
@@ -39,6 +39,8 @@ def lookupTests(build_type, count, builds):
39 39 project.smokeTests = [proj for proj in testProjects if settings.HUDSON_SMOKE_NAME_REGEX.findall(proj) ]
40 40 project.otherTests = [proj for proj in testProjects if not settings.HUDSON_SMOKE_NAME_REGEX.findall(proj) ]
41 41
  42 + project.perfTests = models.get_performance_projects(models.get_data(settings.HUDSON_URL + '/api/json?tree=jobs[name]'), build_type)
  43 +
42 44 buildDict = dict((build.number,build) for build in builds)
43 45
44 46 smokeBuilds = []
@@ -49,6 +51,10 @@ def lookupTests(build_type, count, builds):
49 51 for testName in project.otherTests:
50 52 regressionBuilds.extend(models.get_recent_builds( testName, count ))
51 53
  54 + perfBuilds = []
  55 + for testName in project.perfTests:
  56 + perfBuilds.extend(models.get_recent_builds( testName, count ))
  57 +
52 58 for test in smokeBuilds:
53 59 parent = buildDict.get(test.parent)
54 60 if parent is not None:
@@ -60,16 +66,26 @@ def lookupTests(build_type, count, builds):
60 66 if parent is not None:
61 67 if test.project not in parent.regressionTests or int(test.number) > int(parent.regressionTests[test.project].number):
62 68 parent.regressionTests[test.project] = test
  69 +
  70 + for test in perfBuilds:
  71 + parent = buildDict.get(test.parent)
  72 + if parent is not None:
  73 + if test.project not in parent.perfTests or int(test.number) > int(parent.perfTests[test.project].number):
  74 + parent.perfTests[test.project] = test
63 75
64 76 for build in builds:
65 77 for smoke in project.smokeTests:
66 78 if smoke not in build.smokeTests:
67 79 build.smokeTests[smoke]= models.Build(projectName=smoke)
68   -
  80 +
  81 + for perf in project.perfTests:
  82 + if perf not in build.perfTests:
  83 + build.perfTests[perf]= models.Build(projectName=perf)
  84 +
69 85 for other in project.otherTests:
70 86 if other not in build.regressionTests:
71 87 build.regressionTests[other]= models.Build(projectName=other)
72   -
  88 +
73 89 return buildDict
74 90
75 91 def get_project_report(request, build_type):
26 jenkins_radiator/templates/radiator/build_row.html
@@ -38,7 +38,7 @@
38 38 &nbsp;<a href="{{test.url}}">R</a>&nbsp;{% endspaceless %}
39 39 </div>
40 40 {% endfor %}
41   - {% if build.failedSmokeTests %}
  41 + {% if build.failedSmokeTests %}
42 42 <div class="gap"/>
43 43 <table class="tests">
44 44 <tr>
@@ -53,7 +53,7 @@
53 53 </tr>
54 54 </table>
55 55 {% endif %}
56   - {% if build.failedRegressionTests %}
  56 + {% if build.failedRegressionTests %}
57 57 <div class="gap"/>
58 58 <table class="tests">
59 59 <tr>
@@ -68,6 +68,22 @@
68 68 </tr>
69 69 </table>
70 70 {% endif %}
  71 + {% for test in build.perfTests.values|sortedByName %}
  72 + {% if test.status == "SUCCESS" %}
  73 + {% for page in test.perfPages %}
  74 + <div class="shadow box {{test.status}} tertiary"
  75 + title="{{page.pageName}}">{% spaceless %}
  76 + {% include "radiator/test_spinner.html" %}
  77 + &nbsp;<a href="{{test.url}}">{{ page.pageName }} {{ page.pageScore }}</a>&nbsp;{% endspaceless %}
  78 + </div>
  79 + {% endfor %}
  80 + {% else %}
  81 + <div class="shadow box {{test.status}} tertiary" title="{{test.name}}: {{test.status|transformTestStatus}}">{% spaceless %}
  82 + {% include "radiator/test_spinner.html" %}
  83 + &nbsp;<a href="{{test.url}}">P</a>&nbsp;{% endspaceless %}
  84 + </div>
  85 + {% endif %}
  86 + {% endfor %}
71 87 {% else %}
72 88 {% if build.status == "UNSTABLE" %}
73 89 <div class="broken {{build.status}} secondary">JUNIT TESTS BREAKING!</div>
@@ -76,9 +92,9 @@
76 92 <div class="broken {{build.status}} secondary">BUILD {{build.status}}!</div>
77 93 {% endif %}
78 94 {% endif %}
79   - <div class="gap"/>
80   - <div class="clear-both"></div>
81   - </div>
  95 + <div class="gap"/>
  96 + <div class="clear-both"></div>
  97 + </div>
82 98 </div>
83 99 <div class="gap"/>
84 100 <script>

0 comments on commit dd5112d

Please sign in to comment.
Something went wrong with that request. Please try again.