From b2436f7ad5d6c4e919732deedb6cb9390267b03f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 25 Mar 2024 18:14:19 +0100 Subject: [PATCH] Only remove tests from pending for non-ignored results This avoids endlessly requeuing the test if the test produces an older result. This will make tests "disappear" if the infrastructure returns old results for newer triggers but avoids the problem right now where we end up queuing the same tests every run. --- britney2/policies/autopkgtest.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/britney2/policies/autopkgtest.py b/britney2/policies/autopkgtest.py index 89455d4..ac001c3 100644 --- a/britney2/policies/autopkgtest.py +++ b/britney2/policies/autopkgtest.py @@ -1071,13 +1071,10 @@ class AutopkgtestPolicy(BasePolicy): 'Fetched test result for %s/%s/%s %s (triggers: %s): %s', src, ver, arch, run_id, result_triggers, result.name.lower()) - # remove matching test requests + # add this result and remove pending test requests if valid for trigger in result_triggers: - self.remove_from_pending(trigger, src, arch) - - # add this result - for trigger in result_triggers: - self.add_trigger_to_results(trigger, src, ver, arch, run_id, seen, result) + if self.add_trigger_to_results(trigger, src, ver, arch, run_id, seen, result): + self.remove_from_pending(trigger, src, arch) def remove_from_pending(self, trigger, src, arch): try: @@ -1097,10 +1094,10 @@ class AutopkgtestPolicy(BasePolicy): (trigsrc, trigver) = trigger.split('/', 1) except ValueError: self.logger.info('Ignoring invalid test trigger %s', trigger) - return + return False if trigsrc == src and apt_pkg.version_compare(ver, trigver) < 0: self.logger.debug('test trigger %s, but run for older version %s, ignoring', trigger, ver) - return + return False result = self.test_results.setdefault(trigger, {}).setdefault( src, {}).setdefault(arch, [Result.FAIL, None, '', 0]) @@ -1114,6 +1111,8 @@ class AutopkgtestPolicy(BasePolicy): result[2] = run_id result[3] = seen + return True + def send_test_request(self, src, arch, triggers, huge=False): '''Send out AMQP request for testing src/arch for triggers