Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2026-05-11
### Fixed
- Update stat group alarms to use exact Sierra count now that code 0 exists

## 2026-05-06
### Fixed
- Update holds alarms to always take in a specific date to test
Expand Down
7 changes: 2 additions & 5 deletions alarms/models/sierra_codes/sierra_stat_group_codes_alarms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from venv import create
from alarms.alarm import Alarm
from helpers.query_helper import (
build_redshift_code_counts_query,
Expand Down Expand Up @@ -33,10 +32,8 @@ def run_checks(self):
build_redshift_code_counts_query("stat_group_code", stat_group_table)
)[0]

# Subtract one from Redshift counts because stat group code 0 is
# manually maintained and not present in Sierra for technical reasons
total_redshift_count = int(redshift_counts[0]) - 1
distinct_redshift_count = int(redshift_counts[1]) - 1
total_redshift_count = int(redshift_counts[0])
distinct_redshift_count = int(redshift_counts[1])
if self.run_added_tests:
null_stat_group_codes = self.redshift_client.execute_query(
build_redshift_stat_group_null_query(stat_group_table, self.yesterday)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_run_checks_no_alarms(self, test_instance, mocker, caplog):
)

test_instance.sierra_client.execute_query.return_value = [(10,)]
test_instance.redshift_client.execute_query.side_effect = [([11, 11],), (), ()]
test_instance.redshift_client.execute_query.side_effect = [([10, 10],), (), ()]

with caplog.at_level(logging.ERROR):
test_instance.run_checks()
Expand Down Expand Up @@ -92,7 +92,7 @@ def test_run_checks_unequal_counts_alarm(self, test_instance, mocker, caplog):
"alarms.models.sierra_codes.sierra_stat_group_codes_alarms.build_redshift_stat_group_location_query"
)
test_instance.sierra_client.execute_query.return_value = [(10,)]
test_instance.redshift_client.execute_query.side_effect = [([21, 21],), (), ()]
test_instance.redshift_client.execute_query.side_effect = [([20, 20],), (), ()]

with caplog.at_level(logging.ERROR):
test_instance.run_checks()
Expand All @@ -116,7 +116,7 @@ def test_run_checks_duplicate_codes_alarm(self, test_instance, mocker, caplog):
"alarms.models.sierra_codes.sierra_stat_group_codes_alarms.build_redshift_stat_group_location_query"
)
test_instance.sierra_client.execute_query.return_value = [(10,)]
test_instance.redshift_client.execute_query.side_effect = [([11, 10],), (), ()]
test_instance.redshift_client.execute_query.side_effect = [([10, 9],), (), ()]

with caplog.at_level(logging.ERROR):
test_instance.run_checks()
Expand All @@ -141,7 +141,7 @@ def test_run_checks_null_fields_alarm(self, test_instance, mocker, caplog):
)
test_instance.sierra_client.execute_query.return_value = [(10,)]
test_instance.redshift_client.execute_query.side_effect = [
([11, 11],),
([10, 10],),
([1], [2]),
(),
]
Expand All @@ -168,7 +168,7 @@ def test_run_checks_unknown_locations_alarm(self, test_instance, mocker, caplog)
)
test_instance.sierra_client.execute_query.return_value = [(10,)]
test_instance.redshift_client.execute_query.side_effect = [
([11, 11],),
([10, 10],),
(),
([3], [4]),
]
Expand Down
Loading