Merge lp:~zyga/linaro-python-dashboard-bundle/test-duration into lp:linaro-python-dashboard-bundle/linaro-11.11

Proposed by Zygmunt Krynicki
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: 71
Merged at revision: 69
Proposed branch: lp:~zyga/linaro-python-dashboard-bundle/test-duration
Merge into: lp:linaro-python-dashboard-bundle/linaro-11.11
Diff against target: 654 lines (+513/-10)
13 files modified
doc/changes.rst (+6/-1)
doc/index.rst (+1/-1)
doc/schema.rst (+1/-0)
doc/schema/changes.rst (+12/-0)
doc/schema/raw.rst (+9/-5)
linaro_dashboard_bundle/__init__.py (+1/-1)
linaro_dashboard_bundle/evolution.py (+12/-0)
linaro_dashboard_bundle/io.py (+5/-0)
linaro_dashboard_bundle/schemas/dashboard_bundle_format_1.4.json (+268/-0)
linaro_dashboard_bundle/test_documents/everything_in_one_bundle_1.4.json (+85/-0)
linaro_dashboard_bundle/test_documents/evolution_1.4.json (+70/-0)
linaro_dashboard_bundle/test_documents/example_1.4_test_duration.json (+8/-0)
linaro_dashboard_bundle/tests.py (+35/-2)
To merge this branch: bzr merge lp:~zyga/linaro-python-dashboard-bundle/test-duration
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle (community) Approve
Review via email: mp+109084@code.launchpad.net

Description of the change

This branch adds the 1.4 document format that can encode the test duration (duration of an entire test run)

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Seems fine. I wonder if there's a neat way of seeing the difference between dashboard_bundle_format_1.3.json and dashboard_bundle_format_1.4.json? The text diff seems clear enough in this case though.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/changes.rst'
2--- doc/changes.rst 2012-04-02 16:39:49 +0000
3+++ doc/changes.rst 2012-06-07 08:20:28 +0000
4@@ -1,6 +1,12 @@
5 Version History
6 ***************
7
8+Version 1.8 (Unreleased)
9+========================
10+
11+* Open for development
12+* Add 1.4 document format :ref:`format_1_4_schema` see :ref:`difference_between_1_3_and_1_4`
13+
14 Version 1.7.2
15 =============
16
17@@ -11,7 +17,6 @@
18 * Add a glossary section
19 * Add versiontools to install requires so that rtfd.org builds this right
20
21-
22 Version 1.7
23 ===========
24
25
26=== modified file 'doc/index.rst'
27--- doc/index.rst 2011-10-21 17:31:23 +0000
28+++ doc/index.rst 2012-06-07 08:20:28 +0000
29@@ -1,7 +1,7 @@
30 Linaro Dashboard Bundle Documentation
31 *************************************
32
33-.. seealso:: To see 1.3 format documentation see :ref:`format_1_3_schema`
34+.. seealso:: To see 1.4 format documentation see :ref:`format_1_4_schema`
35
36 .. toctree::
37 :maxdepth: 2
38
39=== modified file 'doc/schema.rst'
40--- doc/schema.rst 2011-10-21 01:52:42 +0000
41+++ doc/schema.rst 2012-06-07 08:20:28 +0000
42@@ -20,5 +20,6 @@
43 :maxdepth: 2
44
45 schema/docs.rst
46+ schema/changes.rst
47 schema/raw.rst
48 schema/examples.rst
49
50=== added file 'doc/schema/changes.rst'
51--- doc/schema/changes.rst 1970-01-01 00:00:00 +0000
52+++ doc/schema/changes.rst 2012-06-07 08:20:28 +0000
53@@ -0,0 +1,12 @@
54+.. _difference_between_1_3_and_1_4:
55+
56+Differences between 1.3 and 1.4
57+===============================
58+
59+Only one property was added. A test run object can now encode the precise
60+duration of the whole test. For example:
61+
62+.. literalinclude:: ../../linaro_dashboard_bundle/test_documents/example_1.4_test_duration.json
63+ :language: javascript
64+ :linenos:
65+
66
67=== modified file 'doc/schema/raw.rst'
68--- doc/schema/raw.rst 2011-10-21 01:52:42 +0000
69+++ doc/schema/raw.rst 2012-06-07 08:20:28 +0000
70@@ -1,13 +1,17 @@
71+.. _format_1_4_schema:
72+
73+Raw Schema (1.4)
74+****************
75+
76+.. literalinclude:: ../../linaro_dashboard_bundle/schemas/dashboard_bundle_format_1.4.json
77+ :language: javascript
78+ :linenos:
79+
80 .. _format_1_3_schema:
81
82 Raw Schema (1.3)
83 ****************
84
85-For those versed in JSON-Schema we'd like to
86-recommend reading the full schema directly. Note
87-that this is the latest format schema, the full
88-catalogue is included in the source distribution.
89-
90 .. literalinclude:: ../../linaro_dashboard_bundle/schemas/dashboard_bundle_format_1.3.json
91 :language: javascript
92 :linenos:
93
94=== modified file 'linaro_dashboard_bundle/__init__.py'
95--- linaro_dashboard_bundle/__init__.py 2012-04-02 16:39:49 +0000
96+++ linaro_dashboard_bundle/__init__.py 2012-06-07 08:20:28 +0000
97@@ -25,4 +25,4 @@
98 """
99
100
101-__version__ = (1, 7, 2, "final", 0)
102+__version__ = (1, 8, 0, "dev", 0)
103
104=== modified file 'linaro_dashboard_bundle/evolution.py'
105--- linaro_dashboard_bundle/evolution.py 2011-09-19 18:12:59 +0000
106+++ linaro_dashboard_bundle/evolution.py 2012-06-07 08:20:28 +0000
107@@ -150,6 +150,15 @@
108 """
109 assert doc.get("format") == "Dashboard Bundle Format 1.2"
110 doc["format"] = "Dashboard Bundle Format 1.3"
111+
112+ def _evolution_from_1_3_to_1_4(doc):
113+ """
114+ Evolution method for 1.3 -> 1.4:
115+
116+ * No changes required
117+ """
118+ assert doc.get("format") == "Dashboard Bundle Format 1.3"
119+ doc["format"] = "Dashboard Bundle Format 1.4"
120
121 EVOLUTION_PATH = [
122 ("Dashboard Bundle Format 1.0",
123@@ -164,4 +173,7 @@
124 ("Dashboard Bundle Format 1.2",
125 "Dashboard Bundle Format 1.3",
126 _evolution_from_1_2_to_1_3),
127+ ("Dashboard Bundle Format 1.3",
128+ "Dashboard Bundle Format 1.4",
129+ _evolution_from_1_3_to_1_4),
130 ]
131
132=== modified file 'linaro_dashboard_bundle/io.py'
133--- linaro_dashboard_bundle/io.py 2012-04-02 16:39:49 +0000
134+++ linaro_dashboard_bundle/io.py 2012-06-07 08:20:28 +0000
135@@ -61,6 +61,11 @@
136 resource_string(
137 __name__,
138 'schemas/dashboard_bundle_format_1.3.json'))),
139+ 'Dashboard Bundle Format 1.4': Schema(
140+ json.loads(
141+ resource_string(
142+ __name__,
143+ 'schemas/dashboard_bundle_format_1.4.json'))),
144 }
145
146 @classmethod
147
148=== added file 'linaro_dashboard_bundle/schemas/dashboard_bundle_format_1.4.json'
149--- linaro_dashboard_bundle/schemas/dashboard_bundle_format_1.4.json 1970-01-01 00:00:00 +0000
150+++ linaro_dashboard_bundle/schemas/dashboard_bundle_format_1.4.json 2012-06-07 08:20:28 +0000
151@@ -0,0 +1,268 @@
152+{
153+ "description": "DashboadBundle object",
154+ "type": "object",
155+ "additionalProperties": false,
156+ "properties": {
157+ "format": {
158+ "description": "Document format identifier.",
159+ "type": "string",
160+ "enum": [
161+ "Dashboard Bundle Format 1.4"
162+ ]
163+ },
164+ "test_runs": {
165+ "description": "Array of TestRun objects",
166+ "type": "array",
167+ "optional": true,
168+ "items": {
169+ "description": "TestRun object",
170+ "type": "object",
171+ "additionalProperties": false,
172+ "properties": {
173+ "analyzer_assigned_uuid": {
174+ "description": "UUID that was assigned by the log analyzer during processing",
175+ "type": "string"
176+ },
177+ "analyzer_assigned_date": {
178+ "description": "Time stamp in ISO 8601 format that was assigned by the log analyzer during processing. The exact format is YYYY-MM-DDThh:mm:ssZ",
179+ "type": "string",
180+ "format": "date-time"
181+ },
182+ "time_check_performed": {
183+ "description": "Indicator on whether the log analyzer had accurate time information",
184+ "type": "boolean"
185+ },
186+ "test_duration": {
187+ "description": "Duration of the test run. Duration is stored in the following format '[DAYS]d [SECONDS]s [MICROSECONDS]us'",
188+ "type": "string",
189+ "optional": true
190+ },
191+ "attributes": {
192+ "description": "Container for additional attributes defined by the test and their values during this particular run",
193+ "type": "object",
194+ "optional": true,
195+ "additionalProperties": {
196+ "description": "Arbitrary properties that are defined by the test",
197+ "type": "string"
198+ }
199+ },
200+ "tags": {
201+ "description": "An optional array of tags that are associated with this test run. Note that those are not version-control tags but arbitrary classifiers for test results",
202+ "type": "array",
203+ "optional": true,
204+ "items": {
205+ "description": "Tag name",
206+ "type": "string"
207+ }
208+ },
209+ "test_id": {
210+ "description": "Test identifier. Must be a well-defined (in scope of the dashboard) name of the test",
211+ "type": "string"
212+ },
213+ "test_results": {
214+ "description": "Array of TestResult objects",
215+ "type": "array",
216+ "items": {
217+ "description": "TestResult object",
218+ "type": "object",
219+ "additionalProperties": false,
220+ "properties": {
221+ "test_case_id": {
222+ "description": "Identifier of the TestCase this test result came from",
223+ "type": "string",
224+ "optional": true
225+ },
226+ "result": {
227+ "description": "Status code of this test result",
228+ "type": "string",
229+ "enum": ["pass", "fail", "skip", "unknown"]
230+ },
231+ "message": {
232+ "description": "Message scrubbed from the log file",
233+ "type": "string",
234+ "optional": true
235+ },
236+ "measurement": {
237+ "description": "Numerical measurement associated with the test result",
238+ "type": "number",
239+ "optional": true,
240+ "requires": "test_case_id"
241+ },
242+ "units": {
243+ "description": "Units for measurement",
244+ "type": "string",
245+ "optional": true,
246+ "requires": "measurement"
247+ },
248+ "timestamp": {
249+ "description": "Date and time when the test was performed",
250+ "type": "string",
251+ "optional": true,
252+ "format": "date-time"
253+ },
254+ "duration": {
255+ "description": "Duration of the test case. Duration is stored in the following format '[DAYS]d [SECONDS]s [MICROSECONDS]us'",
256+ "type": "string",
257+ "optional": true
258+ },
259+ "log_filename": {
260+ "description": "Filename of the log file which this test result was scrubbed from",
261+ "type": "string",
262+ "optional": true
263+ },
264+ "log_lineno": {
265+ "description": "Precise location in the log file (line number)",
266+ "type": "integer",
267+ "optional": true,
268+ "requires": "log_filename"
269+ },
270+ "attributes": {
271+ "description": "Container for additional attributes defined by test result",
272+ "type": "object",
273+ "optional": true,
274+ "additionalProperties": {
275+ "description": "Arbitrary properties that are defined by the particular test result",
276+ "type": "string"
277+ }
278+ }
279+ }
280+ }
281+ },
282+ "attachments": {
283+ "description": "Array of attachments",
284+ "optional": true,
285+ "type": "array",
286+ "items": {
287+ "type": "object",
288+ "additionalProperties": false,
289+ "properties": {
290+ "pathname": {
291+ "description": "Attachment pathname",
292+ "type": "string"
293+ },
294+ "mime_type": {
295+ "description": "Attachment MIME type",
296+ "type": "string"
297+ },
298+ "content": {
299+ "description": "Attachment content encoded as base64 string with standard encoding",
300+ "type": "string",
301+ "optional": true
302+ },
303+ "public_url": {
304+ "description": "Public URL of this attachment",
305+ "type": "string",
306+ "optional": true
307+ }
308+ }
309+ }
310+ },
311+ "hardware_context": {
312+ "description": "Description of the hardware context in which this test was running",
313+ "type": "object",
314+ "optional": true,
315+ "additionalProperties": false,
316+ "properties": {
317+ "devices": {
318+ "description": "Array of HardwareDevice objects",
319+ "type": "array",
320+ "items": {
321+ "description": "HardwareDevice object",
322+ "type": "object",
323+ "properties": {
324+ "device_type": {
325+ "type": "string",
326+ "description": "Device type"
327+ },
328+ "description": {
329+ "type": "string",
330+ "description": "Human readable description of the device"
331+ },
332+ "attributes": {
333+ "description": "Container for additional attributes defined by the device",
334+ "type": "object",
335+ "optional": true,
336+ "additionalProperties": {
337+ "description": "Arbitrary properties that are defined by the particular hardware device",
338+ "type": ["number", "string"]
339+ }
340+ }
341+ },
342+ "additionalProperties": false
343+ }
344+ }
345+ }
346+ },
347+ "software_context": {
348+ "description": "Description of the software context in which this test was running",
349+ "type": "object",
350+ "additionalProperties": false,
351+ "optional": true,
352+ "properties": {
353+ "image": {
354+ "description": "SoftwareImage object",
355+ "type": "object",
356+ "optional": true,
357+ "additionalProperties": false,
358+ "properties": {
359+ "name": {
360+ "description": "Name of the operating system image",
361+ "type": "string"
362+ }
363+ }
364+ },
365+ "sources": {
366+ "type": "array",
367+ "optional": true,
368+ "items": {
369+ "type": "object",
370+ "additionalProperties": false,
371+ "properties": {
372+ "project_name": {
373+ "type": "string"
374+ },
375+ "branch_vcs": {
376+ "type": "string",
377+ "enum": ["bzr", "git", "svn"]
378+ },
379+ "branch_url": {
380+ "type": "string"
381+ },
382+ "branch_revision": {
383+ "type": ["string", "integer"]
384+ },
385+ "commit_timestamp": {
386+ "type": "string",
387+ "format": "date-time",
388+ "optional": true
389+ }
390+ }
391+ }
392+ },
393+ "packages": {
394+ "description": "Array of SoftwarePackage objects",
395+ "type": "array",
396+ "optional": true,
397+ "items": {
398+ "description": "SoftwarePackage object",
399+ "type": "object",
400+ "additionalProperties": false,
401+ "properties": {
402+ "name": {
403+ "description": "Package name",
404+ "type": "string"
405+ },
406+ "version": {
407+ "description": "Package version",
408+ "type": "string"
409+ }
410+ }
411+ }
412+ }
413+ }
414+ }
415+ }
416+ }
417+ }
418+ }
419+}
420
421=== added file 'linaro_dashboard_bundle/test_documents/everything_in_one_bundle_1.4.json'
422--- linaro_dashboard_bundle/test_documents/everything_in_one_bundle_1.4.json 1970-01-01 00:00:00 +0000
423+++ linaro_dashboard_bundle/test_documents/everything_in_one_bundle_1.4.json 2012-06-07 08:20:28 +0000
424@@ -0,0 +1,85 @@
425+{
426+ "format": "Dashboard Bundle Format 1.4",
427+ "test_runs": [
428+ {
429+ "analyzer_assigned_date": "2010-11-14T13:42:31Z",
430+ "analyzer_assigned_uuid": "01234567-0123-0123-0123-01234567890A",
431+ "test_id": "example test id",
432+ "time_check_performed": false,
433+ "test_duration": "0d 1s 134us",
434+ "attributes": {
435+ "attr1": "value1",
436+ "attr2": "value2"
437+ },
438+ "tags": [
439+ "example-content",
440+ "example-content-format-1.3"
441+ ],
442+ "attachments": [
443+ {
444+ "pathname": "attachment1.txt",
445+ "mime_type": "text/plain",
446+ "content": "bGluZTEKbGluZTIKbGluZTMK"
447+ },
448+ {
449+ "pathname": "attachment2.txt",
450+ "mime_type": "text/plain",
451+ "content": "b3RoZXIgbGluZTEK",
452+ "public_url": "http://www.example.org/attachment2.txt"
453+ }
454+ ],
455+ "test_results": [
456+ {
457+ "test_case_id": "example test case id",
458+ "result": "pass",
459+ "message": "example message",
460+ "measurement": 3.5,
461+ "units": "s",
462+ "timestamp": "2010-11-14T13:49:56Z",
463+ "duration": "0d 1s 134us",
464+ "log_filename": "attachment1.txt",
465+ "log_lineno": 2,
466+ "attributes": {
467+ "test result attribute": "value"
468+ }
469+ }
470+ ],
471+ "hardware_context": {
472+ "devices": [
473+ {
474+ "device_type": "example device type",
475+ "description": "example device",
476+ "attributes": {
477+ "hw attr1": "value1",
478+ "hw attr2": "value2"
479+ }
480+ }
481+ ]
482+ },
483+ "software_context": {
484+ "packages": [
485+ {
486+ "name": "pkg1",
487+ "version": "version1"
488+ },
489+ {
490+ "name": "pkg2",
491+ "version": "version2"
492+ }
493+ ],
494+ "image": {
495+ "name": "example os image"
496+ },
497+ "sources": [
498+ {
499+ "branch_revision": 93556,
500+ "branch_url": "lp:gcc-linaro/4.4",
501+ "branch_vcs": "bzr",
502+ "commit_timestamp": "2010-09-07T14:49:43Z",
503+ "project_name": "linaro-gcc"
504+ }
505+ ]
506+ }
507+ }
508+ ]
509+}
510
511=== added file 'linaro_dashboard_bundle/test_documents/evolution_1.4.json'
512--- linaro_dashboard_bundle/test_documents/evolution_1.4.json 1970-01-01 00:00:00 +0000
513+++ linaro_dashboard_bundle/test_documents/evolution_1.4.json 2012-06-07 08:20:28 +0000
514@@ -0,0 +1,70 @@
515+{
516+ "format": "Dashboard Bundle Format 1.4",
517+ "test_runs": [
518+ {
519+ "analyzer_assigned_date": "2010-11-14T13:42:31Z",
520+ "analyzer_assigned_uuid": "01234567-0123-0123-0123-01234567890A",
521+ "test_id": "example test id",
522+ "time_check_performed": false,
523+ "attributes": {
524+ "attr1": "value1",
525+ "attr2": "value2"
526+ },
527+ "attachments": [
528+ {
529+ "pathname": "attachment1.txt",
530+ "mime_type": "text/plain",
531+ "content": "bGluZTEKbGluZTIKbGluZTMK"
532+ },
533+ {
534+ "pathname": "attachment2.txt",
535+ "mime_type": "text/plain",
536+ "content": "b3RoZXIgbGluZTEK"
537+ }
538+ ],
539+ "test_results": [
540+ {
541+ "test_case_id": "example test case id",
542+ "result": "pass",
543+ "message": "example message",
544+ "measurement": 3.5,
545+ "units": "s",
546+ "timestamp": "2010-11-14T13:49:56Z",
547+ "duration": "0d 1s 134us",
548+ "log_filename": "attachment1.txt",
549+ "log_lineno": 2,
550+ "attributes": {
551+ "test result attribute": "value"
552+ }
553+ }
554+ ],
555+ "hardware_context": {
556+ "devices": [
557+ {
558+ "device_type": "example device type",
559+ "description": "example device",
560+ "attributes": {
561+ "hw attr1": "value1",
562+ "hw attr2": "value2"
563+ }
564+ }
565+ ]
566+ },
567+ "software_context": {
568+ "packages": [
569+ {
570+ "name": "pkg1",
571+ "version": "version1"
572+ },
573+ {
574+ "name": "pkg2",
575+ "version": "version2"
576+ }
577+ ],
578+ "image": {
579+ "name": "example os image"
580+ }
581+ }
582+ }
583+ ]
584+}
585
586=== added file 'linaro_dashboard_bundle/test_documents/example_1.4_test_duration.json'
587--- linaro_dashboard_bundle/test_documents/example_1.4_test_duration.json 1970-01-01 00:00:00 +0000
588+++ linaro_dashboard_bundle/test_documents/example_1.4_test_duration.json 2012-06-07 08:20:28 +0000
589@@ -0,0 +1,8 @@
590+{
591+ "format": "Dashboard Bundle Format 1.4",
592+ "test_runs": [
593+ {
594+ "test_duration": "0d 1s 134us",
595+ }
596+ ]
597+}
598
599=== modified file 'linaro_dashboard_bundle/tests.py'
600--- linaro_dashboard_bundle/tests.py 2012-04-02 16:39:49 +0000
601+++ linaro_dashboard_bundle/tests.py 2012-06-07 08:20:28 +0000
602@@ -386,17 +386,50 @@
603 def test_evolved_document_is_latest_format(self):
604 self.assertFalse(DocumentEvolution.is_latest(self.doc))
605 DocumentEvolution.evolve_document(self.doc, one_step=True)
606+ self.assertFalse(DocumentEvolution.is_latest(self.doc))
607+
608+ def test_evolved_document_is_valid(self):
609+ DocumentEvolution.evolve_document(self.doc, one_step=True)
610+ self.assertEqual(DocumentIO.check(self.doc),
611+ "Dashboard Bundle Format 1.3")
612+
613+ def test_evoloved_document_is_what_we_expect(self):
614+ DocumentEvolution.evolve_document(self.doc, one_step=True)
615+ fmt, evolved_doc = DocumentIO.load(
616+ resource_stream('linaro_dashboard_bundle',
617+ 'test_documents/evolution_1.3.json'),
618+ retain_order=False)
619+ self.assertEqual(self.doc, evolved_doc)
620+
621+
622+class DocumentEvolutionTests_1_3_to_1_4(TestCase):
623+
624+ def setUp(self):
625+ super(DocumentEvolutionTests_1_3_to_1_4, self).setUp()
626+ self.fmt, self.doc = DocumentIO.load(
627+ resource_stream('linaro_dashboard_bundle',
628+ 'test_documents/evolution_1.3.json'),
629+ retain_order=False)
630+
631+ def test_format_is_changed(self):
632+ self.assertEqual(self.doc["format"], "Dashboard Bundle Format 1.3")
633+ DocumentEvolution.evolve_document(self.doc, one_step=True)
634+ self.assertEqual(self.doc["format"], "Dashboard Bundle Format 1.4")
635+
636+ def test_evolved_document_is_latest_format(self):
637+ self.assertFalse(DocumentEvolution.is_latest(self.doc))
638+ DocumentEvolution.evolve_document(self.doc, one_step=True)
639 self.assertTrue(DocumentEvolution.is_latest(self.doc))
640
641 def test_evolved_document_is_valid(self):
642 DocumentEvolution.evolve_document(self.doc, one_step=True)
643 self.assertEqual(DocumentIO.check(self.doc),
644- "Dashboard Bundle Format 1.3")
645+ "Dashboard Bundle Format 1.4")
646
647 def test_evoloved_document_is_what_we_expect(self):
648 DocumentEvolution.evolve_document(self.doc, one_step=True)
649 fmt, evolved_doc = DocumentIO.load(
650 resource_stream('linaro_dashboard_bundle',
651- 'test_documents/evolution_1.3.json'),
652+ 'test_documents/evolution_1.4.json'),
653 retain_order=False)
654 self.assertEqual(self.doc, evolved_doc)

Subscribers

People subscribed via source and target branches