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
1=== modified file 'utah/client/common.py'
2--- utah/client/common.py 2012-10-26 11:01:06 +0000
3+++ utah/client/common.py 2012-11-07 18:10:29 +0000
4@@ -365,6 +365,20 @@
5 return arch
6
7
8+def get_arch():
9+ """
10+ The host's architecture.
11+
12+ Returns the human readable architecture or 'unknown'.
13+ """
14+ arches = {
15+ 'x86_64': 'amd64',
16+ 'x86': 'i386',
17+ 'i686': 'i386',
18+ }
19+
20+ return arches.get(platform.machine(), 'unknown')
21+
22 def get_release():
23 """
24 The host's release name (i.e. precise, quantal, etc.)
25
26=== modified file 'utah/client/result.py'
27--- utah/client/result.py 2012-10-25 11:08:31 +0000
28+++ utah/client/result.py 2012-11-07 18:10:29 +0000
29@@ -5,6 +5,8 @@
30 from .common import (
31 get_host_info,
32 get_build_number,
33+ get_release,
34+ get_arch,
35 )
36
37
38@@ -180,6 +182,11 @@
39 'uname': list(host_info['uname']),
40 'media-info': host_info['media-info'],
41 'install_type': self.install_type,
42+ 'build_number': get_build_number(),
43+ 'release': get_release(),
44+ 'ran_at': self.results[0]['start_time'],
45+ 'arch': get_arch(),
46+ 'name': self.name,
47 }
48
49 if self.publish is not None:
50
51=== modified file 'utah/client/runner.py'
52--- utah/client/runner.py 2012-10-25 20:46:36 +0000
53+++ utah/client/runner.py 2012-11-07 18:10:29 +0000
54@@ -102,22 +102,8 @@
55 'type': 'string',
56 'enum': ['smoke', 'kernel-sru', 'bootspeed', 'upgrade'],
57 },
58- "publish": {
59- 'type': 'object',
60- 'properties': {
61- "url": {
62- "type": "string",
63- "required": True,
64- },
65- "token": {
66- "type": "string",
67- "required": True,
68- },
69- "name": {
70- "type": "string",
71- "required": True,
72- },
73- },
74+ "name": {
75+ 'type': 'string',
76 },
77 "testsuites": {
78 # must be a list to accept a schema rather than a simple type
79@@ -189,6 +175,7 @@
80 self.process_master_runlist(resume=resume)
81 self.result.runlist = self.master_runlist
82 self.result.install_type = self.install_type
83+ self.result.name = self.name
84
85 def backup_rc_local(self):
86 """
87@@ -379,6 +366,11 @@
88 if 'timeout' in data:
89 self.timeout = int(data['timeout'])
90
91+ if 'name' in data:
92+ self.name = data['name']
93+ else:
94+ self.name = 'unnamed'
95+
96 # Add publish metatdata to the result object
97 if 'publish' in data:
98 self.result.publish = data['publish']
99
100=== modified file 'utah/client/tests/test_jsonschema.py'
101--- utah/client/tests/test_jsonschema.py 2012-10-10 14:44:00 +0000
102+++ utah/client/tests/test_jsonschema.py 2012-11-07 18:10:29 +0000
103@@ -6,26 +6,6 @@
104
105 from utah.client.runner import Runner
106
107-yaml_content_publish = """---
108-timeout: 80
109-publish:
110- url: http://dashboard.local/api/add_result
111- token: testtoken
112- name: precise-server-amd64
113-testsuites:
114- - name: testsuite1
115- fetch_method: bzr
116- fetch_location: lp:utah
117- - name: testsuite2
118- fetch_method: bzr
119- fetch_location: lp:utah
120-"""
121-
122-yaml_content_publish_bad = [
123- re.sub('\n\s+url: .*', '', yaml_content_publish),
124- re.sub('\n\s+token: .*', '', yaml_content_publish),
125- re.sub('\n\s+name: .*', '', yaml_content_publish),
126- ]
127
128 yaml_content = """---
129 - name: testsuite1
130@@ -116,15 +96,6 @@
131 jsonschema.validate(data, Runner.MASTER_RUNLIST_SCHEMA)
132 fp.close()
133
134- def test_publish_schema(self):
135- """
136- Test that the publish piece of the schema works correctly.
137- """
138-
139- data = yaml.load(yaml_content_publish)
140- print("data: {}".format(data))
141- jsonschema.validate(data, Runner.MASTER_RUNLIST_SCHEMA)
142-
143 def test_include_schema(self):
144 """
145 Test that include works correctly.
146@@ -134,19 +105,6 @@
147 print("data: {}".format(data))
148 jsonschema.validate(data, Runner.MASTER_RUNLIST_SCHEMA)
149
150- def test_publish_bad_schema(self):
151- """
152- Test that the publish piece of the schema fails if any of
153- the required field are missing.
154- """
155-
156- for content in yaml_content_publish_bad:
157- data = yaml.load(content)
158- print("data: {}".format(data))
159- self.assertRaises(jsonschema.ValidationError,
160- jsonschema.validate,
161- data, Runner.MASTER_RUNLIST_SCHEMA)
162-
163 def test_bad_schemas(self):
164 """
165 Test that required fields are enforced by the schema.
166
167=== modified file 'utah/client/tests/test_result.py'
168--- utah/client/tests/test_result.py 2012-08-08 12:58:52 +0000
169+++ utah/client/tests/test_result.py 2012-11-07 18:10:29 +0000
170@@ -16,14 +16,16 @@
171 'command': 'echo hi',
172 'returncode': 0,
173 'stdout': 'hi',
174- 'stderr': ''
175+ 'stderr': '',
176+ 'start_time': '20121107 12:00:00',
177 }
178
179 self.result_fail = {
180 'command': 'echo failure',
181 'returncode': 2,
182 'stdout': 'hi',
183- 'stderr': ''
184+ 'stderr': '',
185+ 'start_time': '20121107 12:00:00',
186 }
187
188 def test_add_result(self):

Subscribers

People subscribed via source and target branches