Skip to content

Commit

Permalink
Remove test for changing team as we have stats for each team per inte…
Browse files Browse the repository at this point in the history
…gration now
  • Loading branch information
mwheeler-ep committed Jan 5, 2025
1 parent 01ffcd5 commit 03c29f8
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions engine/apps/metrics_exporter/tests/test_update_metrics_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,15 @@ def test_update_metrics_cache_on_update_integration(
stack_slug=METRICS_TEST_INSTANCE_SLUG,
stack_id=METRICS_TEST_INSTANCE_ID,
)
team = make_team(organization)
# team = make_team(organization)

metric_alert_groups_total_key = get_metric_alert_groups_total_key(organization.id)
metric_alert_groups_response_time_key = get_metric_alert_groups_response_time_key(organization.id)

expected_result_updated_team = {
"team_name": team.name,
"team_id": team.id,
}
# expected_result_updated_team = {
# "team_name": team.name,
# "team_id": team.id,
# }

expected_result_updated_name = {"integration_name": "Renamed test integration"}

Expand All @@ -337,7 +337,6 @@ def get_called_arg_index_and_compare_results():
alert_receive_channel = make_alert_receive_channel_with_post_save_signal(
organization, verbal_name=METRICS_TEST_INTEGRATION_NAME
)
print(alert_receive_channel)

expected_result_metric_alert_groups_total = {
(alert_receive_channel.id,"no_team"): {
Expand All @@ -356,10 +355,10 @@ def get_called_arg_index_and_compare_results():
},
},
},
(alert_receive_channel.id,team.team_id): {
(alert_receive_channel.id,"no_team"): {
"integration_name": METRICS_TEST_INTEGRATION_NAME,
"team_name": team.name,
"team_id": team.team_id,
"team_name": "No team",
"team_id": "no_team",
"org_id": organization.org_id,
"slug": organization.stack_slug,
"id": organization.stack_id,
Expand All @@ -383,10 +382,10 @@ def get_called_arg_index_and_compare_results():
"id": organization.stack_id,
"services": {NO_SERVICE_VALUE: []},
},
(alert_receive_channel.id,team.team_id): {
(alert_receive_channel.id,"no_team"): {
"integration_name": METRICS_TEST_INTEGRATION_NAME,
"team_name": team.name,
"team_id": team.team_id,
"team_name": "No team",
"team_id": "no_team",
"org_id": organization.org_id,
"slug": organization.stack_slug,
"id": organization.stack_id,
Expand All @@ -401,20 +400,24 @@ def get_called_arg_index_and_compare_results():
monkeypatch.setattr(cache, "get", metrics_cache)

# check cache update on update integration's team
alert_receive_channel.team = team
# alert_receive_channel.team = team
# clear cached_property
# del alert_receive_channel.team_name
# del alert_receive_channel.team_id_or_no_team

alert_receive_channel.save()
# alert_receive_channel.save()

# these tests don't make sense any more because we have multiple integrations per team now

# for expected_result in [
# expected_result_metric_alert_groups_total,
# expected_result_metric_alert_groups_response_time,
# ]:
# expected_result[(alert_receive_channel.id,"no_team")].update(expected_result_updated_team)
# expected_result[(alert_receive_channel.id,team.team_id)].update(expected_result_updated_team)
# arg_idx = get_called_arg_index_and_compare_results()

# check cache update on update integration's name

alert_receive_channel.refresh_from_db()
alert_receive_channel.verbal_name = expected_result_updated_name["integration_name"]
# clear cached_property
Expand Down Expand Up @@ -450,7 +453,7 @@ def get_called_arg_index_and_compare_results():
expected_result_metric_alert_groups_total,
expected_result_metric_alert_groups_response_time,
]:
expected_result.pop(alert_receive_channel.id)
expected_result.pop((alert_receive_channel.id,"no_team"))
get_called_arg_index_and_compare_results()


Expand Down

0 comments on commit 03c29f8

Please sign in to comment.