Skip to content
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

Conversation

evanpurkhiser
Copy link
Member

@evanpurkhiser evanpurkhiser commented Nov 14, 2024

This is extracted from mark_failed.

Waiting on #80792

Part of GH-79328

@evanpurkhiser evanpurkhiser requested a review from a team as a code owner November 14, 2024 21:02
@evanpurkhiser evanpurkhiser enabled auto-merge (squash) November 14, 2024 21:07
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/ref-crons-add-test-to-incident-occurrence-module branch from ea62e7a to 5ff6380 Compare November 14, 2024 21:34
Comment on lines +64 to +70
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,
)
Copy link
Member Author

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

Comment on lines -307 to -311
# Human readible failure reason
assert (
occurrence["evidence_display"][0]["value"]
== "3 timeout, 3 missed and 2 error check-ins detected"
)
Copy link
Member Author

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

Comment on lines -300 to -305
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
Copy link
Member Author

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

Comment on lines -331 to -336
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
Copy link
Member Author

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

Comment on lines -435 to -443
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"
Copy link
Member Author

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

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

All 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           

This is extracted from mark_failed
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/ref-crons-add-test-to-incident-occurrence-module branch from b39a77c to b97f29c Compare November 15, 2024 17:44
@evanpurkhiser evanpurkhiser merged commit 8dbe565 into master Nov 15, 2024
46 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/ref-crons-add-test-to-incident-occurrence-module branch November 15, 2024 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants