Merge lp:~joetalbott/adt-to-utah/add_commands into lp:adt-to-utah

Proposed by Joe Talbott
Status: Merged
Approved by: Para Siva
Approved revision: 9
Merged at revision: 9
Proposed branch: lp:~joetalbott/adt-to-utah/add_commands
Merge into: lp:adt-to-utah
Diff against target: 74 lines (+24/-3)
2 files modified
adt_to_utah/__init__.py (+21/-1)
adt_to_utah/tests/test_adt_to_utah.py (+3/-2)
To merge this branch: bzr merge lp:~joetalbott/adt-to-utah/add_commands
Reviewer Review Type Date Requested Status
Francis Ginther Approve
Para Siva (community) Approve
Review via email: mp+256052@code.launchpad.net

Commit message

Parse testcases and include "commands" in utah results.

Description of the change

Parse testcases and include "commands" in utah results.

To post a comment you must log in.
Revision history for this message
Para Siva (psivaa) wrote :

LGTM, and tested on a summary file.

review: Approve
Revision history for this message
Francis Ginther (fginther) wrote :

Approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'adt_to_utah/__init__.py'
2--- adt_to_utah/__init__.py 2015-04-09 19:49:59 +0000
3+++ adt_to_utah/__init__.py 2015-04-13 22:38:25 +0000
4@@ -64,11 +64,31 @@
5 }
6
7
8+def create_command_entry(result, success=True):
9+ return {
10+ 'cmd_type': 'testcase_test',
11+ 'command': result,
12+ 'extra_info': {},
13+ 'probes': {},
14+ 'returncode': 0 if success else 1,
15+ 'start_time': '1970-01-01 00:00:00',
16+ 'time_delta': 0,
17+ 'user': None,
18+ }
19+
20+
21 def create_utah_data(result_data):
22 # get rid of microseconds since the utah parser doesn't support
23 # them.
24 now = datetime.datetime.utcnow().replace(microsecond=0)
25 ran_at = result_data.get('ran_at', now.isoformat(' '))
26+
27+ commands = []
28+ for result in result_data["passes"]:
29+ commands.append(create_command_entry(result))
30+ for result in result_data["failures"]:
31+ commands.append(create_command_entry(result, success=False))
32+
33 return {
34 "passes": len(result_data["passes"]),
35 "failures": len(result_data["failures"]),
36@@ -77,7 +97,7 @@
37 "ran_at": ran_at,
38
39 # defaults
40- "commands": [],
41+ "commands": commands,
42 "errors": 0,
43 "fetch_errors": 0,
44 "runlist": "",
45
46=== modified file 'adt_to_utah/tests/test_adt_to_utah.py'
47--- adt_to_utah/tests/test_adt_to_utah.py 2015-04-09 19:49:59 +0000
48+++ adt_to_utah/tests/test_adt_to_utah.py 2015-04-13 22:38:25 +0000
49@@ -70,10 +70,11 @@
50
51 self.assertNotIn('.', utah_data['ran_at'])
52
53+ self.assertEqual(2, len(utah_data['commands']))
54+
55 # defaults
56 self.assertEqual(0, utah_data['errors'])
57 self.assertEqual(0, utah_data['fetch_errors'])
58- self.assertEqual([], utah_data['commands'])
59 self.assertEqual('', utah_data['runlist'])
60 self.assertEqual('', utah_data['uname'])
61 self.assertEqual('', utah_data['install_type'])
62@@ -99,11 +100,11 @@
63 self.assertEqual("vivid", utah_data['release'])
64 self.assertNotEqual('', utah_data['ran_at'])
65 self.assertNotIn('.', utah_data['ran_at'])
66+ self.assertEqual(2, len(utah_data['commands']))
67
68 # defaults
69 self.assertEqual(0, utah_data['errors'])
70 self.assertEqual(0, utah_data['fetch_errors'])
71- self.assertEqual([], utah_data['commands'])
72 self.assertEqual('', utah_data['runlist'])
73 self.assertEqual('', utah_data['uname'])
74 self.assertEqual('', utah_data['install_type'])

Subscribers

People subscribed via source and target branches

to all changes: