[Patchew-devel] [PATCH 1/3] testing: Fix assert failure about git result
Fam Zheng
famz at redhat.com
Wed Oct 31 01:24:27 UTC 2018
We hit this when a series is partially tested but git result status is
updated to "failure" (for example a new "Based-on:" tag arrvied:
File "/home/fzheng/work/patchew/venv/lib64/python3.6/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/home/fzheng/work/patchew/api/views.py", line 46, in post
r = self.handle(request, **params)
File "/home/fzheng/work/patchew/mods/testing.py", line 476, in handle
candidate = self._find_series_test(request, po, tester, capabilities)
File "/home/fzheng/work/patchew/mods/testing.py", line 466, in _find_series_test
td = self._generate_series_test_data(request, s, r, test)
File "/home/fzheng/work/patchew/mods/testing.py", line 406, in _generate_series_test_data
assert gr.is_success()
This may be considered a DB consistency issue because git reset should
ideally clear testing status, but crashing is harmful anyway, so add a
check in the query.
Signed-off-by: Fam Zheng <famz at redhat.com>
---
mods/testing.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mods/testing.py b/mods/testing.py
index f3e8cb5..2d0ed0f 100644
--- a/mods/testing.py
+++ b/mods/testing.py
@@ -446,6 +446,8 @@ class TestingGetView(APILoginRequiredView):
name__startswith='testing.').order_by('status', 'last_update')
tests = _instance.get_tests(po)
for r in q:
+ if isinstance(r, MessageResult) and not r.message.git_result.is_success():
+ continue
tn = _instance.get_test_name(r)
t = tests.get(tn, None)
# Shouldn't happen, but let's protect against it
--
2.17.2
More information about the Patchew-devel
mailing list