Skip to content

Commit

Permalink
Update tests to new changes introduced to 62cb3d2
Browse files Browse the repository at this point in the history
qem-bot's data is normalized, so either passed or failed.
  • Loading branch information
foursixnine authored and Martchus committed Mar 5, 2024
1 parent 44ad49f commit d5b05e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
6 changes: 3 additions & 3 deletions tests/test_aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ def __init__(self, repo, embargoed, mocked_incident=42):
self._has_failures = False

def has_failures(self, token):
does_it_have_failures = self.id == 666 or self._has_failures
has_failures = self.id == 666 or self._has_failures
logger.debug(
"incident %s, has_failures = %s",
self,
does_it_have_failures,
has_failures,
)
return does_it_have_failures
return has_failures

def __repr__(self):
return f"<MockIncident id: {self.id} with repos {self.channels}>"
Expand Down
13 changes: 5 additions & 8 deletions tests/test_incident.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,7 @@ def mock_get(url, extra_data=None, headers=None):
json_data=[
{"status": "passed", "job_id": 1},
{"status": "failed", "job_id": 1777}, # Accept the turk
{
"status": "softfailed",
"job_id": 2020,
}, # 2020 is the genesys of dark fate
{"status": "failed", "job_id": 2020}, # 2020 is the genesys of dark fate
{"status": "failed", "job_id": 2042}, # This one has a dark fate
{"status": "passed", "job_id": 3},
],
Expand All @@ -198,18 +195,18 @@ def test_inc_has_failures(caplog, mock_good, monkeypatch):
# Assert that the method returns True since there is a failed job
assert has_failures

assert caplog.records[0].message == "Found 1 failed jobs for incident 24618:"
assert caplog.records[0].message == "Found 2 failed jobs for incident 24618:"
assert (
caplog.records[1].message
== "Job 2042 is not marked as acceptable for incident 24618"
== "Job 2020 is not marked as acceptable for incident 24618"
)
assert len(caplog.records) == 2
assert len(caplog.records) == 3

caplog.set_level(logging.INFO)
caplog.clear()

inc.has_failures("token")

# Check that the log only has one message, and that it matches our incident
assert caplog.records[0].message == "Found 1 failed jobs for incident 24618:"
assert caplog.records[0].message == "Found 2 failed jobs for incident 24618:"
assert len(caplog.records) == 1

0 comments on commit d5b05e2

Please sign in to comment.