Don't duplicated build numbers when merging flakiness dashboard JSON
authorojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Oct 2012 19:16:59 +0000 (19:16 +0000)
committerojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Oct 2012 19:16:59 +0000 (19:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=98812

Reviewed by Dirk Pranke.

In general, build numbers are not unique, but we should basically never
get the same build number uploaded twice in a row. This is a workaround
for https://bugs.webkit.org/show_bug.cgi?id=97643, which frequently hits this
because we update results_small.json and timeout updating results.json and then
we retry the whole request.

* TestResultServer/model/jsonresults.py:
(JsonResults.merge):
* TestResultServer/model/jsonresults_unittest.py:
(JsonResultsTest.test_merge_duplicate_build_number):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@130790 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/TestResultServer/model/jsonresults.py
Tools/TestResultServer/model/jsonresults_unittest.py

index 1e2e01c..0ddcc8e 100644 (file)
@@ -1,3 +1,21 @@
+2012-10-09  Ojan Vafai  <ojan@chromium.org>
+
+        Don't duplicated build numbers when merging flakiness dashboard JSON
+        https://bugs.webkit.org/show_bug.cgi?id=98812
+
+        Reviewed by Dirk Pranke.
+
+        In general, build numbers are not unique, but we should basically never
+        get the same build number uploaded twice in a row. This is a workaround
+        for https://bugs.webkit.org/show_bug.cgi?id=97643, which frequently hits this
+        because we update results_small.json and timeout updating results.json and then
+        we retry the whole request.
+
+        * TestResultServer/model/jsonresults.py:
+        (JsonResults.merge):
+        * TestResultServer/model/jsonresults_unittest.py:
+        (JsonResultsTest.test_merge_duplicate_build_number):
+
 2012-10-09  Alexis Menard  <alexis@webkit.org>
 
         [GTK] Shadow builds are not working anymore.
index 673daaa..202ccb8 100755 (executable)
@@ -292,6 +292,10 @@ class JsonResults(object):
         if not cls._check_json(builder, aggregated_json):
             return incremental
 
+        if aggregated_json[builder][JSON_RESULTS_BUILD_NUMBERS][0] == incremental_json[builder][JSON_RESULTS_BUILD_NUMBERS][0]:
+            logging.error("Incremental JSON's build number is the latest build number in the aggregated JSON: %d." % aggregated_json[builder][JSON_RESULTS_BUILD_NUMBERS][0])
+            return aggregated
+
         logging.info("Merging json results...")
         try:
             cls._merge_json(aggregated_json[builder], incremental_json[builder], num_runs)
index b56008b..a5836fc 100755 (executable)
@@ -184,6 +184,24 @@ class JsonResultsTest(unittest.TestCase):
                            "results": [[200,"F"]],
                            "times": [[200,0]]}}})
 
+    def test_merge_duplicate_build_number(self):
+        self._test_merge(
+            # Aggregated results
+            {"builds": ["2", "1"],
+             "tests": {"001.html": {
+                           "results": [[100, "F"]],
+                           "times": [[100, 0]]}}},
+            # Incremental results
+            {"builds": ["2"],
+             "tests": {"001.html": {
+                           "results": [[1, "F"]],
+                           "times": [[1, 0]]}}},
+            # Expected results
+            {"builds": ["2", "1"],
+             "tests": {"001.html": {
+                           "results": [[100, "F"]],
+                           "times": [[100, 0]]}}})
+
     def test_merge_incremental_single_test_single_run_same_result(self):
         # Incremental results has the latest build and same test results for
         # that run.