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

Fam Zheng famz at redhat.com
Thu Jul 26 01:47:21 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 | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mods/testing.py b/mods/testing.py
index 3403e8b..46b3d96 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("GitResultUpdate", self.on_git_update)
 
     def on_set_property(self, evt, obj, name, value, old_value):
         if ((isinstance(obj, Message) and obj.is_series_head) \
@@ -121,6 +122,14 @@ class TestingModule(PatchewModule):
             and old_value != value:
             self.recalc_pending_tests(obj)
 
+    def on_git_update(self, evt, obj, old_status, result):
+        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