-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ref(crons): Add test to incident_occurrence module #80779
ref(crons): Add test to incident_occurrence module #80779
Conversation
ea62e7a
to
5ff6380
Compare
assert mock_create_incident_occurrence.call_count == 1 | ||
assert mock_create_incident_occurrence.call_args == mock.call( | ||
checkin, | ||
[checkin], | ||
monitor_incidents[0], | ||
checkin.date_added, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just validate that we're calling create_incident_occurrence
# Human readible failure reason | ||
assert ( | ||
occurrence["evidence_display"][0]["value"] | ||
== "3 timeout, 3 missed and 2 error check-ins detected" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested in the incident_occurrences
module now
assert len(mock_produce_occurrence_to_kafka.mock_calls) == failure_issue_threshold | ||
# assert that the correct uuid fingerprint was sent | ||
kwargs = mock_produce_occurrence_to_kafka.call_args.kwargs | ||
occurrence = kwargs["occurrence"] | ||
occurrence = occurrence.to_dict() | ||
assert occurrence["fingerprint"][0] == monitor_incident.grouphash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested in the incident_occurrences
module now
assert len(mock_produce_occurrence_to_kafka.mock_calls) == failure_issue_threshold + 1 | ||
# assert that the correct uuid fingerprint was sent | ||
kwargs = mock_produce_occurrence_to_kafka.call_args.kwargs | ||
occurrence = kwargs["occurrence"] | ||
occurrence = occurrence.to_dict() | ||
assert occurrence["fingerprint"][0] == monitor_incident.grouphash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested in the incident_occurrences
module now
assert len(mock_produce_occurrence_to_kafka.mock_calls) == failure_issue_threshold | ||
# assert that the correct uuid fingerprint was sent | ||
kwargs = mock_produce_occurrence_to_kafka.call_args.kwargs | ||
occurrence = kwargs["occurrence"] | ||
occurrence = occurrence.to_dict() | ||
assert occurrence["fingerprint"][0] == monitor_incident.grouphash | ||
|
||
# Human readible failure reason | ||
assert occurrence["evidence_display"][0]["value"] == "8 timeout check-ins detected" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested in the incident_occurrences
module now
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #80779 +/- ##
=======================================
Coverage 78.41% 78.41%
=======================================
Files 7206 7206
Lines 319492 319492
Branches 44000 44000
=======================================
+ Hits 250515 250518 +3
+ Misses 62590 62587 -3
Partials 6387 6387 |
5ff6380
to
b39a77c
Compare
This is extracted from mark_failed
b39a77c
to
b97f29c
Compare
This is extracted from mark_failed.
Waiting on #80792
Part of GH-79328