Skip to content

Commit

Permalink
Ignore runs if not in self.workflow_ids and add corresponding test
Browse files Browse the repository at this point in the history
  • Loading branch information
alarthast committed Feb 18, 2025
1 parent a188673 commit d2ca9cd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions tests/workspace/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@ def test_all_workflows_found(mock_airlock_reporter, cache_path):
assert "created" not in Mocket.last_request().querystring


def test_some_workflows_ignored(mock_airlock_reporter, cache_path):
# Have the first run in runs.json be for an ignored workflow
mock_airlock_reporter.workflows.pop(113602598)
mock_airlock_reporter.workflow_ids = set(mock_airlock_reporter.workflows.keys())
with patch("workspace.workflows.jobs.CACHE_PATH", cache_path):
conclusions = mock_airlock_reporter.get_latest_conclusions()
assert len(conclusions) == len(WORKFLOWS_MAIN) - 1
assert 113602598 not in conclusions


def test_some_workflows_not_found(mock_airlock_reporter, cache_path):
mock_airlock_reporter.workflows[1234] = "Workflow that only exists in the cache"
mock_airlock_reporter.cache = {
Expand Down
5 changes: 3 additions & 2 deletions workspace/workflows/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,9 @@ def find_latest_for_each_workflow(self, all_runs) -> list:
for run in all_runs:
if run["workflow_id"] in found_ids:
continue
latest_runs.append(run)
found_ids.add(run["workflow_id"])
if run["workflow_id"] in self.workflow_ids:
latest_runs.append(run)
found_ids.add(run["workflow_id"])
if found_ids == self.workflow_ids:
return latest_runs, set()
missing_ids = self.workflow_ids - found_ids
Expand Down

0 comments on commit d2ca9cd

Please sign in to comment.