[Patchew-devel] [PATCH v2 06/11] testing: Reset testing upon git result update

Fam Zheng famz at redhat.com
Fri Jul 27 03:59:29 UTC 2018


Similar has been done in SetProperty handler but recently the git
properties we listen to were converted into a Result record. So we have
to watch that.

Signed-off-by: Fam Zheng <famz at redhat.com>
---
 mods/testing.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/mods/testing.py b/mods/testing.py
index 3403e8b..82b8c80 100644
--- a/mods/testing.py
+++ b/mods/testing.py
@@ -106,6 +106,7 @@ class TestingModule(PatchewModule):
                       html_log_url="URL to test log (HTML)",
                       is_timeout="whether the test has timeout")
         register_handler("SetProperty", self.on_set_property)
+        register_handler("ResultUpdate", self.on_result_update)
 
     def on_set_property(self, evt, obj, name, value, old_value):
         if ((isinstance(obj, Message) and obj.is_series_head) \
@@ -121,6 +122,16 @@ class TestingModule(PatchewModule):
             and old_value != value:
             self.recalc_pending_tests(obj)
 
+    def on_result_update(self, evt, obj, old_status, result):
+        if result.name != "git":
+            return
+        if isinstance(obj, Message) \
+            and obj.is_series_head \
+            and old_status != Result.SUCCESS \
+            and result.status == result.SUCCESS \
+            and result.data.get("tag") and result.data.get("repo"):
+                self.clear_and_start_testing(obj)
+
     def get_testing_results(self, obj, *args, **kwargs):
         return obj.results.filter(name__startswith='testing.', *args, **kwargs)
 
-- 
2.17.1




More information about the Patchew-devel mailing list