From d976332f6476a025ada1b12ddcabed2688e8561c Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Jan 15 2021 17:42:23 +0000 Subject: Ensure we get all results from local cache, not just the first This code was clearly wrong; it will only ever return the first result for the given test case from the local cache. If there are multiple results for the same test case but different scenarios, all but one would be omitted. This fixes it in the obvious way. Signed-off-by: Adam Williamson --- diff --git a/greenwave/resources.py b/greenwave/resources.py index 66847b7..89d4fad 100644 --- a/greenwave/resources.py +++ b/greenwave/resources.py @@ -65,10 +65,7 @@ class ResultsRetriever(BaseRetriever): # retrieved for given Subject. cache_key = (subject.type, subject.identifier, scenarios) if testcase and cache_key in self.cache: - for result in self.cache[cache_key]: - if result['testcase']['name'] == testcase: - return [result] - return [] + return [res for res in self.cache[cache_key] if res['testcase']['name'] == testcase] # Try to get passing test case result from external cache. external_cache_key = None