Merge lp:~joetalbott/utah/dashboard_integration into lp:utah

Proposed by Joe Talbott
Status: Merged
Merged at revision: 733
Proposed branch: lp:~joetalbott/utah/dashboard_integration
Merge into: lp:utah
Diff against target: 188 lines (+33/-60)
5 files modified
utah/client/common.py (+14/-0)
utah/client/result.py (+7/-0)
utah/client/runner.py (+8/-16)
utah/client/tests/test_jsonschema.py (+0/-42)
utah/client/tests/test_result.py (+4/-2)
To merge this branch: bzr merge lp:~joetalbott/utah/dashboard_integration
Reviewer Review Type Date Requested Status
Max Brustkern (community) Approve
Review via email: mp+133314@code.launchpad.net

Description of the change

These are some fairly minor changes to work towards QA Dashboard integration.

To post a comment you must log in.
Revision history for this message
Max Brustkern (nuclearbob) wrote :

Looks reasonable to me.

review: Approve
735. By Joe Talbott

client.common - Show times in a parsable format.

736. By Joe Talbott

publish - Add tools for processing client results to the dashboard.

TODO:
  * need to get the token from a secure config file.
  * need to hook into run_utah_tests.py.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'utah/client/common.py'
--- utah/client/common.py 2012-10-26 11:01:06 +0000
+++ utah/client/common.py 2012-11-07 18:10:29 +0000
@@ -365,6 +365,20 @@
365 return arch365 return arch
366366
367367
368def get_arch():
369 """
370 The host's architecture.
371
372 Returns the human readable architecture or 'unknown'.
373 """
374 arches = {
375 'x86_64': 'amd64',
376 'x86': 'i386',
377 'i686': 'i386',
378 }
379
380 return arches.get(platform.machine(), 'unknown')
381
368def get_release():382def get_release():
369 """383 """
370 The host's release name (i.e. precise, quantal, etc.)384 The host's release name (i.e. precise, quantal, etc.)
371385
=== modified file 'utah/client/result.py'
--- utah/client/result.py 2012-10-25 11:08:31 +0000
+++ utah/client/result.py 2012-11-07 18:10:29 +0000
@@ -5,6 +5,8 @@
5from .common import (5from .common import (
6 get_host_info,6 get_host_info,
7 get_build_number,7 get_build_number,
8 get_release,
9 get_arch,
8 )10 )
911
1012
@@ -180,6 +182,11 @@
180 'uname': list(host_info['uname']),182 'uname': list(host_info['uname']),
181 'media-info': host_info['media-info'],183 'media-info': host_info['media-info'],
182 'install_type': self.install_type,184 'install_type': self.install_type,
185 'build_number': get_build_number(),
186 'release': get_release(),
187 'ran_at': self.results[0]['start_time'],
188 'arch': get_arch(),
189 'name': self.name,
183 }190 }
184191
185 if self.publish is not None:192 if self.publish is not None:
186193
=== modified file 'utah/client/runner.py'
--- utah/client/runner.py 2012-10-25 20:46:36 +0000
+++ utah/client/runner.py 2012-11-07 18:10:29 +0000
@@ -102,22 +102,8 @@
102 'type': 'string',102 'type': 'string',
103 'enum': ['smoke', 'kernel-sru', 'bootspeed', 'upgrade'],103 'enum': ['smoke', 'kernel-sru', 'bootspeed', 'upgrade'],
104 },104 },
105 "publish": {105 "name": {
106 'type': 'object',106 'type': 'string',
107 'properties': {
108 "url": {
109 "type": "string",
110 "required": True,
111 },
112 "token": {
113 "type": "string",
114 "required": True,
115 },
116 "name": {
117 "type": "string",
118 "required": True,
119 },
120 },
121 },107 },
122 "testsuites": {108 "testsuites": {
123 # must be a list to accept a schema rather than a simple type109 # must be a list to accept a schema rather than a simple type
@@ -189,6 +175,7 @@
189 self.process_master_runlist(resume=resume)175 self.process_master_runlist(resume=resume)
190 self.result.runlist = self.master_runlist176 self.result.runlist = self.master_runlist
191 self.result.install_type = self.install_type177 self.result.install_type = self.install_type
178 self.result.name = self.name
192179
193 def backup_rc_local(self):180 def backup_rc_local(self):
194 """181 """
@@ -379,6 +366,11 @@
379 if 'timeout' in data:366 if 'timeout' in data:
380 self.timeout = int(data['timeout'])367 self.timeout = int(data['timeout'])
381368
369 if 'name' in data:
370 self.name = data['name']
371 else:
372 self.name = 'unnamed'
373
382 # Add publish metatdata to the result object374 # Add publish metatdata to the result object
383 if 'publish' in data:375 if 'publish' in data:
384 self.result.publish = data['publish']376 self.result.publish = data['publish']
385377
=== modified file 'utah/client/tests/test_jsonschema.py'
--- utah/client/tests/test_jsonschema.py 2012-10-10 14:44:00 +0000
+++ utah/client/tests/test_jsonschema.py 2012-11-07 18:10:29 +0000
@@ -6,26 +6,6 @@
66
7from utah.client.runner import Runner7from utah.client.runner import Runner
88
9yaml_content_publish = """---
10timeout: 80
11publish:
12 url: http://dashboard.local/api/add_result
13 token: testtoken
14 name: precise-server-amd64
15testsuites:
16 - name: testsuite1
17 fetch_method: bzr
18 fetch_location: lp:utah
19 - name: testsuite2
20 fetch_method: bzr
21 fetch_location: lp:utah
22"""
23
24yaml_content_publish_bad = [
25 re.sub('\n\s+url: .*', '', yaml_content_publish),
26 re.sub('\n\s+token: .*', '', yaml_content_publish),
27 re.sub('\n\s+name: .*', '', yaml_content_publish),
28 ]
299
30yaml_content = """---10yaml_content = """---
31- name: testsuite111- name: testsuite1
@@ -116,15 +96,6 @@
116 jsonschema.validate(data, Runner.MASTER_RUNLIST_SCHEMA)96 jsonschema.validate(data, Runner.MASTER_RUNLIST_SCHEMA)
117 fp.close()97 fp.close()
11898
119 def test_publish_schema(self):
120 """
121 Test that the publish piece of the schema works correctly.
122 """
123
124 data = yaml.load(yaml_content_publish)
125 print("data: {}".format(data))
126 jsonschema.validate(data, Runner.MASTER_RUNLIST_SCHEMA)
127
128 def test_include_schema(self):99 def test_include_schema(self):
129 """100 """
130 Test that include works correctly.101 Test that include works correctly.
@@ -134,19 +105,6 @@
134 print("data: {}".format(data))105 print("data: {}".format(data))
135 jsonschema.validate(data, Runner.MASTER_RUNLIST_SCHEMA)106 jsonschema.validate(data, Runner.MASTER_RUNLIST_SCHEMA)
136107
137 def test_publish_bad_schema(self):
138 """
139 Test that the publish piece of the schema fails if any of
140 the required field are missing.
141 """
142
143 for content in yaml_content_publish_bad:
144 data = yaml.load(content)
145 print("data: {}".format(data))
146 self.assertRaises(jsonschema.ValidationError,
147 jsonschema.validate,
148 data, Runner.MASTER_RUNLIST_SCHEMA)
149
150 def test_bad_schemas(self):108 def test_bad_schemas(self):
151 """109 """
152 Test that required fields are enforced by the schema.110 Test that required fields are enforced by the schema.
153111
=== modified file 'utah/client/tests/test_result.py'
--- utah/client/tests/test_result.py 2012-08-08 12:58:52 +0000
+++ utah/client/tests/test_result.py 2012-11-07 18:10:29 +0000
@@ -16,14 +16,16 @@
16 'command': 'echo hi',16 'command': 'echo hi',
17 'returncode': 0,17 'returncode': 0,
18 'stdout': 'hi',18 'stdout': 'hi',
19 'stderr': ''19 'stderr': '',
20 'start_time': '20121107 12:00:00',
20 }21 }
2122
22 self.result_fail = {23 self.result_fail = {
23 'command': 'echo failure',24 'command': 'echo failure',
24 'returncode': 2,25 'returncode': 2,
25 'stdout': 'hi',26 'stdout': 'hi',
26 'stderr': ''27 'stderr': '',
28 'start_time': '20121107 12:00:00',
27 }29 }
2830
29 def test_add_result(self):31 def test_add_result(self):

Subscribers

People subscribed via source and target branches