diff mbox

[Branch,~linaro-validation/lava-dashboard/trunk] Rev 247: * make the bundle used in the BundleDeserializerSuccessTests tests more

Message ID 20110720231621.16889.82559.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson July 20, 2011, 11:16 p.m. UTC
Merge authors:
  Michael Hudson-Doyle (mwhudson)
------------------------------------------------------------
revno: 247 [merge]
committer: Michael-Doyle Hudson <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Thu 2011-07-21 11:12:57 +1200
message:
  * make the bundle used in the BundleDeserializerSuccessTests tests more
    pathological, as seen in bug 813567
  * fix the bug on postgres by uniqifying test case ids from the bundle being
    imported at the python level
modified:
  dashboard_app/helpers.py
  dashboard_app/tests/other/deserialization.py


--
lp:lava-dashboard
https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk

You are subscribed to branch lp:lava-dashboard.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'dashboard_app/helpers.py'
--- dashboard_app/helpers.py	2011-07-04 06:04:22 +0000
+++ dashboard_app/helpers.py	2011-07-20 23:08:27 +0000
@@ -427,13 +427,13 @@ 
         """
         Import TestCase
         """
-        id_units = []
+        id_units = {}
         for c_test_result in c_test_results:
             if "test_case_id" not in c_test_result:
                 continue
-            id_units.append(
-                (c_test_result["test_case_id"],
-                 c_test_result.get("units", "")))
+            id_units.setdefault(
+                c_test_result["test_case_id"], c_test_result.get("units", ""))
+        id_units = id_units.items()
 
         cursor = connection.cursor()
         for i in range(0, len(id_units), 1000):

=== modified file 'dashboard_app/tests/other/deserialization.py'
--- dashboard_app/tests/other/deserialization.py	2011-06-17 01:33:55 +0000
+++ dashboard_app/tests/other/deserialization.py	2011-07-20 23:06:30 +0000
@@ -259,7 +259,7 @@ 
 
 class BundleDeserializerSuccessTests(TestCaseWithScenarios):
 
-    json_text = """
+    json_text = '''
     {
         "format": "Dashboard Bundle Format 1.0",
         "test_runs": [
@@ -268,7 +268,8 @@ 
                 "analyzer_assigned_uuid": "1ab86b36-c23d-11df-a81b-002163936223",
                 "analyzer_assigned_date": "2010-12-31T23:59:59Z",
                 "time_check_performed": true,
-                "test_results": [{
+                "test_results": [
+                {
                     "test_case_id": "some_test_case_id",
                     "result": "unknown",
                     "measurement": 1000.3,
@@ -282,10 +283,16 @@ 
                         "attr1": "value1",
                         "attr2": "value2"
                     }
-                }],
+                },
+                {
+                    "test_case_id": "some_test_case_id",
+                    "result": "unknown"
+                }
+                ],
                 "sw_context": {
                     "packages": [
                         {"name": "pkg1", "version": "1.0"},
+                        {"name": "pkg1", "version": "1.0"},
                         {"name": "pkg2", "version": "0.5"}
                     ],
                     "sw_image": {
@@ -321,7 +328,7 @@ 
             }
         ]
     }
-    """
+    '''
 
     scenarios = [
         ('with_evolution', {