Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore(tests): split alerts test suite as per domain boundaries (#12983)

praneeth-signoz3b6becff7a3a
diff --git a/.github/workflows/integrationci.yaml b/.github/workflows/integrationci.yaml
index 913db2f7d9..d9e35e821d 100644
--- a/.github/workflows/integrationci.yaml
+++ b/.github/workflows/integrationci.yaml
@@ -38,7 +38,6 @@ jobs:
fail-fast: false
matrix:
suite:
- - alerts
- alertmanager
- alertmanagerrotation
- basepath
@@ -64,6 +63,7 @@ jobs:
- querierauthz
- role
- rootuser
+ - ruler
- savedview
- semconvfamilies
- serviceaccount
diff --git a/tests/fixtures/alerts.py b/tests/fixtures/alerts.py
index b0833b7e8b..8b921becce 100644
--- a/tests/fixtures/alerts.py
+++ b/tests/fixtures/alerts.py
@@ -108,14 +108,23 @@ def delete_all_rules(signoz: types.SigNoz, token: str) -> None:
def seed_alert_rules(
signoz: types.SigNoz,
get_token: Callable[[str, str], str],
+ notification_channel: types.TestContainerDocker,
create_notification_channel: Callable[[dict], str],
create_alert_rule: Callable[[dict], str],
-) -> Callable[[dict, list[dict]], None]:
+) -> Callable[[str, list[dict]], None]:
admin_token = get_token(USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD)
- def _seed_alert_rules(channel_config: dict, rules: list[dict]) -> None:
+ # create_notification_channel rather than create_webhook_notification_channel:
+ # only the former deletes on teardown, and callers reuse one channel name
+ # across tests, so a leaked channel fails the next create as a duplicate.
+ def _seed_alert_rules(channel_name: str, rules: list[dict]) -> None:
delete_all_rules(signoz, admin_token)
- create_notification_channel(channel_config)
+ create_notification_channel(
+ {
+ "name": channel_name,
+ "webhook_configs": [{"url": notification_channel.container_configs["8080"].get(f"/alert/{channel_name}"), "send_resolved": False}],
+ }
+ )
for rule in rules:
create_alert_rule(rule)
diff --git a/tests/integration/testdata/alerts/test_scenarios/disabled_rule/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/disabled_rule/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/disabled_rule/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/disabled_rule/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/disabled_rule/rule.json b/tests/integration/testdata/ruler/test_scenarios/disabled_rule/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/disabled_rule/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/disabled_rule/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/multi_threshold_rule_test/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/multi_threshold_rule_test/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/multi_threshold_rule_test/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/multi_threshold_rule_test/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/multi_threshold_rule_test/rule.json b/tests/integration/testdata/ruler/test_scenarios/multi_threshold_rule_test/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/multi_threshold_rule_test/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/multi_threshold_rule_test/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/no_data_rule_test/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/no_data_rule_test/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/no_data_rule_test/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/no_data_rule_test/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/no_data_rule_test/rule.json b/tests/integration/testdata/ruler/test_scenarios/no_data_rule_test/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/no_data_rule_test/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/no_data_rule_test/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/promql_subquery_no_step/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/promql_subquery_no_step/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/promql_subquery_no_step/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/promql_subquery_no_step/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/promql_subquery_no_step/rule.json b/tests/integration/testdata/ruler/test_scenarios/promql_subquery_no_step/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/promql_subquery_no_step/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/promql_subquery_no_step/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/rule_state_history_ai_traces/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/rule_state_history_ai_traces/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/rule_state_history_ai_traces/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/rule_state_history_ai_traces/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/rule_state_history_ai_traces/rule.json b/tests/integration/testdata/ruler/test_scenarios/rule_state_history_ai_traces/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/rule_state_history_ai_traces/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/rule_state_history_ai_traces/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/rule_state_history_logs/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/rule_state_history_logs/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/rule_state_history_logs/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/rule_state_history_logs/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/rule_state_history_logs/rule.json b/tests/integration/testdata/ruler/test_scenarios/rule_state_history_logs/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/rule_state_history_logs/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/rule_state_history_logs/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/rule_state_history_traces/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/rule_state_history_traces/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/rule_state_history_traces/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/rule_state_history_traces/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/rule_state_history_traces/rule.json b/tests/integration/testdata/ruler/test_scenarios/rule_state_history_traces/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/rule_state_history_traces/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/rule_state_history_traces/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_above_all_the_time/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_above_all_the_time/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_above_all_the_time/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_above_all_the_time/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_above_all_the_time/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_above_all_the_time/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_above_all_the_time/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_above_all_the_time/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_above_at_least_once/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_above_at_least_once/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_above_at_least_once/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_above_at_least_once/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_above_at_least_once/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_above_at_least_once/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_above_at_least_once/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_above_at_least_once/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_above_average/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_above_average/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_above_average/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_above_average/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_above_average/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_above_average/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_above_average/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_above_average/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_above_in_total/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_above_in_total/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_above_in_total/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_above_in_total/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_above_in_total/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_above_in_total/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_above_in_total/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_above_in_total/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_above_last/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_above_last/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_above_last/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_above_last/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_above_last/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_above_last/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_above_last/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_above_last/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_below_all_the_time/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_below_all_the_time/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_below_all_the_time/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_below_all_the_time/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_below_all_the_time/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_below_all_the_time/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_below_all_the_time/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_below_all_the_time/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_below_at_least_once/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_below_at_least_once/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_below_at_least_once/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_below_at_least_once/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_below_at_least_once/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_below_at_least_once/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_below_at_least_once/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_below_at_least_once/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_below_average/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_below_average/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_below_average/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_below_average/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_below_average/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_below_average/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_below_average/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_below_average/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_below_in_total/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_below_in_total/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_below_in_total/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_below_in_total/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_below_in_total/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_below_in_total/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_below_in_total/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_below_in_total/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_below_last/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_below_last/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_below_last/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_below_last/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_below_last/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_below_last/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_below_last/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_below_last/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_all_the_time/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_all_the_time/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_all_the_time/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_all_the_time/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_all_the_time/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_all_the_time/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_all_the_time/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_all_the_time/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_at_least_once/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_at_least_once/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_at_least_once/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_at_least_once/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_at_least_once/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_at_least_once/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_at_least_once/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_at_least_once/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_average/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_average/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_average/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_average/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_average/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_average/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_average/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_average/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_in_total/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_in_total/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_in_total/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_in_total/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_in_total/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_in_total/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_in_total/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_in_total/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_last/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_last/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_last/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_last/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_last/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_last/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_equal_to_last/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_equal_to_last/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_all_the_time/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_all_the_time/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_all_the_time/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_all_the_time/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_all_the_time/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_all_the_time/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_all_the_time/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_all_the_time/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_at_least_once/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_at_least_once/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_at_least_once/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_at_least_once/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_at_least_once/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_at_least_once/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_at_least_once/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_at_least_once/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_average/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_average/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_average/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_average/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_average/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_average/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_average/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_average/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_in_total/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_in_total/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_in_total/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_in_total/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_in_total/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_in_total/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_in_total/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_in_total/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_last/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_last/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_last/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_last/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_last/rule.json b/tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_last/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/threshold_not_equal_to_last/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/threshold_not_equal_to_last/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/unit_conversion_bytes_to_mb/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/unit_conversion_bytes_to_mb/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/unit_conversion_bytes_to_mb/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/unit_conversion_bytes_to_mb/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/unit_conversion_bytes_to_mb/rule.json b/tests/integration/testdata/ruler/test_scenarios/unit_conversion_bytes_to_mb/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/unit_conversion_bytes_to_mb/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/unit_conversion_bytes_to_mb/rule.json
diff --git a/tests/integration/testdata/alerts/test_scenarios/unit_conversion_ms_to_second/alert_data.jsonl b/tests/integration/testdata/ruler/test_scenarios/unit_conversion_ms_to_second/alert_data.jsonl
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/unit_conversion_ms_to_second/alert_data.jsonl
rename to tests/integration/testdata/ruler/test_scenarios/unit_conversion_ms_to_second/alert_data.jsonl
diff --git a/tests/integration/testdata/alerts/test_scenarios/unit_conversion_ms_to_second/rule.json b/tests/integration/testdata/ruler/test_scenarios/unit_conversion_ms_to_second/rule.json
similarity index 100%
rename from tests/integration/testdata/alerts/test_scenarios/unit_conversion_ms_to_second/rule.json
rename to tests/integration/testdata/ruler/test_scenarios/unit_conversion_ms_to_second/rule.json
diff --git a/tests/integration/tests/alertmanager/02_notifiers.py b/tests/integration/tests/alertmanager/02_notifiers.py
index 4b15029728..d1a608d791 100644
--- a/tests/integration/tests/alertmanager/02_notifiers.py
+++ b/tests/integration/tests/alertmanager/02_notifiers.py
@@ -31,11 +31,11 @@ logger = setup_logger(__name__)
NOTIFIERS_TEST = [
types.AlertManagerNotificationTestCase(
name="slack_notifier_default_templating",
- rule_path="alerts/test_scenarios/threshold_above_at_least_once/rule.json",
+ rule_path="ruler/test_scenarios/threshold_above_at_least_once/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_above_at_least_once/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_above_at_least_once/alert_data.jsonl",
),
],
channel_config=slack_default_config,
@@ -64,11 +64,11 @@ NOTIFIERS_TEST = [
),
types.AlertManagerNotificationTestCase(
name="msteams_notifier_default_templating",
- rule_path="alerts/test_scenarios/threshold_above_at_least_once/rule.json",
+ rule_path="ruler/test_scenarios/threshold_above_at_least_once/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_above_at_least_once/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_above_at_least_once/alert_data.jsonl",
),
],
channel_config=msteams_default_config,
@@ -149,11 +149,11 @@ NOTIFIERS_TEST = [
),
types.AlertManagerNotificationTestCase(
name="pagerduty_notifier_default_templating",
- rule_path="alerts/test_scenarios/threshold_above_at_least_once/rule.json",
+ rule_path="ruler/test_scenarios/threshold_above_at_least_once/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_above_at_least_once/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_above_at_least_once/alert_data.jsonl",
),
],
channel_config=pagerduty_default_config,
@@ -194,11 +194,11 @@ NOTIFIERS_TEST = [
),
types.AlertManagerNotificationTestCase(
name="opsgenie_notifier_default_templating",
- rule_path="alerts/test_scenarios/threshold_above_at_least_once/rule.json",
+ rule_path="ruler/test_scenarios/threshold_above_at_least_once/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_above_at_least_once/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_above_at_least_once/alert_data.jsonl",
),
],
channel_config=opsgenie_default_config,
@@ -226,11 +226,11 @@ NOTIFIERS_TEST = [
),
types.AlertManagerNotificationTestCase(
name="webhook_notifier_default_templating",
- rule_path="alerts/test_scenarios/threshold_above_at_least_once/rule.json",
+ rule_path="ruler/test_scenarios/threshold_above_at_least_once/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_above_at_least_once/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_above_at_least_once/alert_data.jsonl",
),
],
channel_config=webhook_default_config,
@@ -275,11 +275,11 @@ NOTIFIERS_TEST = [
),
types.AlertManagerNotificationTestCase(
name="email_notifier_default_templating",
- rule_path="alerts/test_scenarios/threshold_above_at_least_once/rule.json",
+ rule_path="ruler/test_scenarios/threshold_above_at_least_once/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_above_at_least_once/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_above_at_least_once/alert_data.jsonl",
),
],
channel_config=email_default_config,
diff --git a/tests/integration/tests/alerts/01_notification_channel.py b/tests/integration/tests/alertmanager/06_test_channel.py
similarity index 90%
rename from tests/integration/tests/alerts/01_notification_channel.py
rename to tests/integration/tests/alertmanager/06_test_channel.py
index 29b89e3de5..3be2a54c68 100644
--- a/tests/integration/tests/alerts/01_notification_channel.py
+++ b/tests/integration/tests/alertmanager/06_test_channel.py
@@ -15,10 +15,10 @@ logger = setup_logger(__name__)
def test_webhook_notification_channel(
signoz: types.SigNoz,
+ create_user_admin: None, # pylint: disable=unused-argument
get_token: Callable[[str, str], str],
notification_channel: types.TestContainerDocker,
make_http_mocks: Callable[[types.TestContainerDocker, list[Mapping]], None],
- create_webhook_notification_channel: Callable[[str, str, dict, bool], str],
) -> None:
logger.info("Setting up notification channel")
@@ -45,14 +45,6 @@ def test_webhook_notification_channel(
],
)
- # Create an alert channel using the given route
- create_webhook_notification_channel(
- channel_name=notification_channel_name,
- webhook_url=webhook_endpoint,
- http_config={},
- send_resolved=True,
- )
-
# TODO: @abhishekhugetech # pylint: disable=W0511
# Time required for newly created Org to be registered in the alertmanager is 5 seconds in signoz.py
# this will be fixed after [https://github.com/SigNoz/engineering-pod/issues/3800]
diff --git a/tests/integration/tests/alerts/02_basic_alert_conditions.py b/tests/integration/tests/ruler/01_basic_alert_conditions.py
similarity index 81%
rename from tests/integration/tests/alerts/02_basic_alert_conditions.py
rename to tests/integration/tests/ruler/01_basic_alert_conditions.py
index dfb9bc87af..ad77724ffb 100644
--- a/tests/integration/tests/alerts/02_basic_alert_conditions.py
+++ b/tests/integration/tests/ruler/01_basic_alert_conditions.py
@@ -21,12 +21,12 @@ from fixtures.logger import setup_logger
TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
types.AlertTestCase(
name="test_threshold_above_at_least_once",
- rule_path="alerts/test_scenarios/threshold_above_at_least_once/rule.json",
+ rule_path="ruler/test_scenarios/threshold_above_at_least_once/rule.json",
alert_data=[
types.AlertData(
type="metrics",
# active requests dummy data
- data_path="alerts/test_scenarios/threshold_above_at_least_once/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_above_at_least_once/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -44,11 +44,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_above_all_the_time",
- rule_path="alerts/test_scenarios/threshold_above_all_the_time/rule.json",
+ rule_path="ruler/test_scenarios/threshold_above_all_the_time/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_above_all_the_time/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_above_all_the_time/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -66,11 +66,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_above_in_total",
- rule_path="alerts/test_scenarios/threshold_above_in_total/rule.json",
+ rule_path="ruler/test_scenarios/threshold_above_in_total/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_above_in_total/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_above_in_total/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -96,11 +96,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_above_average",
- rule_path="alerts/test_scenarios/threshold_above_average/rule.json",
+ rule_path="ruler/test_scenarios/threshold_above_average/rule.json",
alert_data=[
types.AlertData(
type="traces",
- data_path="alerts/test_scenarios/threshold_above_average/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_above_average/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -118,11 +118,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_above_last",
- rule_path="alerts/test_scenarios/threshold_above_last/rule.json",
+ rule_path="ruler/test_scenarios/threshold_above_last/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_above_last/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_above_last/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -140,11 +140,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_below_at_least_once",
- rule_path="alerts/test_scenarios/threshold_below_at_least_once/rule.json",
+ rule_path="ruler/test_scenarios/threshold_below_at_least_once/rule.json",
alert_data=[
types.AlertData(
type="logs",
- data_path="alerts/test_scenarios/threshold_below_at_least_once/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_below_at_least_once/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -162,11 +162,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_below_all_the_time",
- rule_path="alerts/test_scenarios/threshold_below_all_the_time/rule.json",
+ rule_path="ruler/test_scenarios/threshold_below_all_the_time/rule.json",
alert_data=[
types.AlertData(
type="logs",
- data_path="alerts/test_scenarios/threshold_below_all_the_time/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_below_all_the_time/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -184,12 +184,12 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_below_in_total",
- rule_path="alerts/test_scenarios/threshold_below_in_total/rule.json",
+ rule_path="ruler/test_scenarios/threshold_below_in_total/rule.json",
alert_data=[
types.AlertData(
type="metrics",
# one rate ~5 + rest 0.01 so it remains in total below 10
- data_path="alerts/test_scenarios/threshold_below_in_total/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_below_in_total/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -207,11 +207,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_below_average",
- rule_path="alerts/test_scenarios/threshold_below_average/rule.json",
+ rule_path="ruler/test_scenarios/threshold_below_average/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_below_average/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_below_average/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -229,11 +229,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_below_last",
- rule_path="alerts/test_scenarios/threshold_below_last/rule.json",
+ rule_path="ruler/test_scenarios/threshold_below_last/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_below_last/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_below_last/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -251,11 +251,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_equal_to_at_least_once",
- rule_path="alerts/test_scenarios/threshold_equal_to_at_least_once/rule.json",
+ rule_path="ruler/test_scenarios/threshold_equal_to_at_least_once/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_equal_to_at_least_once/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_equal_to_at_least_once/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -273,11 +273,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_equal_to_all_the_time",
- rule_path="alerts/test_scenarios/threshold_equal_to_all_the_time/rule.json",
+ rule_path="ruler/test_scenarios/threshold_equal_to_all_the_time/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_equal_to_all_the_time/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_equal_to_all_the_time/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -295,11 +295,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_equal_to_in_total",
- rule_path="alerts/test_scenarios/threshold_equal_to_in_total/rule.json",
+ rule_path="ruler/test_scenarios/threshold_equal_to_in_total/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_equal_to_in_total/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_equal_to_in_total/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -317,11 +317,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_equal_to_average",
- rule_path="alerts/test_scenarios/threshold_equal_to_average/rule.json",
+ rule_path="ruler/test_scenarios/threshold_equal_to_average/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_equal_to_average/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_equal_to_average/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -339,11 +339,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_equal_to_last",
- rule_path="alerts/test_scenarios/threshold_equal_to_last/rule.json",
+ rule_path="ruler/test_scenarios/threshold_equal_to_last/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_equal_to_last/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_equal_to_last/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -361,11 +361,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_not_equal_to_at_least_once",
- rule_path="alerts/test_scenarios/threshold_not_equal_to_at_least_once/rule.json",
+ rule_path="ruler/test_scenarios/threshold_not_equal_to_at_least_once/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_not_equal_to_at_least_once/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_not_equal_to_at_least_once/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -383,11 +383,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_not_equal_to_all_the_time",
- rule_path="alerts/test_scenarios/threshold_not_equal_to_all_the_time/rule.json",
+ rule_path="ruler/test_scenarios/threshold_not_equal_to_all_the_time/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_not_equal_to_all_the_time/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_not_equal_to_all_the_time/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -405,11 +405,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_not_equal_to_in_total",
- rule_path="alerts/test_scenarios/threshold_not_equal_to_in_total/rule.json",
+ rule_path="ruler/test_scenarios/threshold_not_equal_to_in_total/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_not_equal_to_in_total/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_not_equal_to_in_total/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -427,11 +427,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_not_equal_to_average",
- rule_path="alerts/test_scenarios/threshold_not_equal_to_average/rule.json",
+ rule_path="ruler/test_scenarios/threshold_not_equal_to_average/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_not_equal_to_average/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_not_equal_to_average/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -449,11 +449,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
),
types.AlertTestCase(
name="test_threshold_not_equal_to_last",
- rule_path="alerts/test_scenarios/threshold_not_equal_to_last/rule.json",
+ rule_path="ruler/test_scenarios/threshold_not_equal_to_last/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/threshold_not_equal_to_last/alert_data.jsonl",
+ data_path="ruler/test_scenarios/threshold_not_equal_to_last/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -475,11 +475,11 @@ TEST_RULES_MATCH_TYPE_AND_COMPARE_OPERATORS = [
TEST_RULES_UNIT_CONVERSION = [
types.AlertTestCase(
name="test_unit_conversion_bytes_to_mb",
- rule_path="alerts/test_scenarios/unit_conversion_bytes_to_mb/rule.json",
+ rule_path="ruler/test_scenarios/unit_conversion_bytes_to_mb/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/unit_conversion_bytes_to_mb/alert_data.jsonl",
+ data_path="ruler/test_scenarios/unit_conversion_bytes_to_mb/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -497,11 +497,11 @@ TEST_RULES_UNIT_CONVERSION = [
),
types.AlertTestCase(
name="test_unit_conversion_ms_to_second",
- rule_path="alerts/test_scenarios/unit_conversion_ms_to_second/rule.json",
+ rule_path="ruler/test_scenarios/unit_conversion_ms_to_second/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/unit_conversion_ms_to_second/alert_data.jsonl",
+ data_path="ruler/test_scenarios/unit_conversion_ms_to_second/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -523,11 +523,11 @@ TEST_RULES_UNIT_CONVERSION = [
TEST_RULES_MISCELLANEOUS = [
types.AlertTestCase(
name="test_no_data_rule_test",
- rule_path="alerts/test_scenarios/no_data_rule_test/rule.json",
+ rule_path="ruler/test_scenarios/no_data_rule_test/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/no_data_rule_test/alert_data.jsonl",
+ data_path="ruler/test_scenarios/no_data_rule_test/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
@@ -547,11 +547,11 @@ TEST_RULES_MISCELLANEOUS = [
# after the [issue](https://github.com/SigNoz/engineering-pod/issues/3934) with alertManager is resolved
# types.AlertTestCase(
# name="test_multi_threshold_rule_test",
- # rule_path="alerts/test_scenarios/multi_threshold_rule_test/rule.json",
+ # rule_path="ruler/test_scenarios/multi_threshold_rule_test/rule.json",
# alert_data=[
# types.AlertData(
# type="metrics",
- # data_path="alerts/test_scenarios/multi_threshold_rule_test/alert_data.jsonl",
+ # data_path="ruler/test_scenarios/multi_threshold_rule_test/alert_data.jsonl",
# ),
# ],
# alert_expectation=types.AlertExpectation(
diff --git a/tests/integration/tests/alerts/03_rule_state_history.py b/tests/integration/tests/ruler/02_rule_state_history.py
similarity index 91%
rename from tests/integration/tests/alerts/03_rule_state_history.py
rename to tests/integration/tests/ruler/02_rule_state_history.py
index 6771981962..559c34522b 100644
--- a/tests/integration/tests/alerts/03_rule_state_history.py
+++ b/tests/integration/tests/ruler/02_rule_state_history.py
@@ -29,10 +29,10 @@ def test_logs_rule_history_related_links(
query_start_ms = int((datetime.now(tz=UTC) - timedelta(minutes=30)).timestamp() * 1000)
insert_alert_data(
- [types.AlertData(type="logs", data_path="alerts/test_scenarios/rule_state_history_logs/alert_data.jsonl")],
+ [types.AlertData(type="logs", data_path="ruler/test_scenarios/rule_state_history_logs/alert_data.jsonl")],
base_time=datetime.now(tz=UTC) - timedelta(minutes=5),
)
- rule_id = create_alert_rule_with_channel("alerts/test_scenarios/rule_state_history_logs/rule.json")
+ rule_id = create_alert_rule_with_channel("ruler/test_scenarios/rule_state_history_logs/rule.json")
(item, query_end_ms) = wait_for_firing_timeline_entry(signoz, token, rule_id, query_start_ms)
@@ -73,10 +73,10 @@ def test_traces_rule_history_related_links(
query_start_ms = int((datetime.now(tz=UTC) - timedelta(minutes=30)).timestamp() * 1000)
insert_alert_data(
- [types.AlertData(type="traces", data_path="alerts/test_scenarios/rule_state_history_traces/alert_data.jsonl")],
+ [types.AlertData(type="traces", data_path="ruler/test_scenarios/rule_state_history_traces/alert_data.jsonl")],
base_time=datetime.now(tz=UTC) - timedelta(minutes=5),
)
- rule_id = create_alert_rule_with_channel("alerts/test_scenarios/rule_state_history_traces/rule.json")
+ rule_id = create_alert_rule_with_channel("ruler/test_scenarios/rule_state_history_traces/rule.json")
(item, query_end_ms) = wait_for_firing_timeline_entry(signoz, token, rule_id, query_start_ms)
@@ -117,10 +117,10 @@ def test_ai_traces_rule_history_related_links(
query_start_ms = int((datetime.now(tz=UTC) - timedelta(minutes=30)).timestamp() * 1000)
insert_alert_data(
- [types.AlertData(type="traces", data_path="alerts/test_scenarios/rule_state_history_ai_traces/alert_data.jsonl")],
+ [types.AlertData(type="traces", data_path="ruler/test_scenarios/rule_state_history_ai_traces/alert_data.jsonl")],
base_time=datetime.now(tz=UTC) - timedelta(minutes=5),
)
- rule_id = create_alert_rule_with_channel("alerts/test_scenarios/rule_state_history_ai_traces/rule.json")
+ rule_id = create_alert_rule_with_channel("ruler/test_scenarios/rule_state_history_ai_traces/rule.json")
(item, query_end_ms) = wait_for_firing_timeline_entry(signoz, token, rule_id, query_start_ms)
diff --git a/tests/integration/tests/alerts/04_promql_subquery_no_step.py b/tests/integration/tests/ruler/03_promql_subquery_no_step.py
similarity index 94%
rename from tests/integration/tests/alerts/04_promql_subquery_no_step.py
rename to tests/integration/tests/ruler/03_promql_subquery_no_step.py
index 3ea2292432..d0a23b965f 100644
--- a/tests/integration/tests/alerts/04_promql_subquery_no_step.py
+++ b/tests/integration/tests/ruler/03_promql_subquery_no_step.py
@@ -14,11 +14,11 @@ from fixtures.fs import get_testdata_file_path
TEST_CASE = types.AlertTestCase(
name="promql_subquery_no_step",
- rule_path="alerts/test_scenarios/promql_subquery_no_step/rule.json",
+ rule_path="ruler/test_scenarios/promql_subquery_no_step/rule.json",
alert_data=[
types.AlertData(
type="metrics",
- data_path="alerts/test_scenarios/promql_subquery_no_step/alert_data.jsonl",
+ data_path="ruler/test_scenarios/promql_subquery_no_step/alert_data.jsonl",
),
],
alert_expectation=types.AlertExpectation(
diff --git a/tests/integration/tests/alerts/05_disabled_rule.py b/tests/integration/tests/ruler/04_disabled_rule.py
similarity index 93%
rename from tests/integration/tests/alerts/05_disabled_rule.py
rename to tests/integration/tests/ruler/04_disabled_rule.py
index 4a293730bd..dca3b38448 100644
--- a/tests/integration/tests/alerts/05_disabled_rule.py
+++ b/tests/integration/tests/ruler/04_disabled_rule.py
@@ -40,7 +40,7 @@ def test_disabled_rule_does_not_evaluate_or_notify(
A rule created with disabled: true must not be evaluated: its state must
stay "disabled" and it must not send any notification, even though the
inserted data would fire the rule if it were evaluated. The companion
- scenario threshold_above_at_least_once in 02_basic_alert_conditions.py
+ scenario threshold_above_at_least_once in 01_basic_alert_conditions.py
uses the same data shape and fires when the rule is enabled.
"""
token = get_token(USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD)
@@ -78,12 +78,12 @@ def test_disabled_rule_does_not_evaluate_or_notify(
# Insert alert data that would fire the rule if it were evaluated
insert_alert_data(
- [types.AlertData(type="metrics", data_path="alerts/test_scenarios/disabled_rule/alert_data.jsonl")],
+ [types.AlertData(type="metrics", data_path="ruler/test_scenarios/disabled_rule/alert_data.jsonl")],
base_time=datetime.now(tz=UTC) - timedelta(minutes=5),
)
# Create the disabled alert rule
- rule_path = get_testdata_file_path("alerts/test_scenarios/disabled_rule/rule.json")
+ rule_path = get_testdata_file_path("ruler/test_scenarios/disabled_rule/rule.json")
with open(rule_path, encoding="utf-8") as f:
rule_data = json.loads(f.read())
update_rule_channel_name(rule_data, notification_channel_name)
diff --git a/tests/integration/tests/alerts/06_list_rules_v3.py b/tests/integration/tests/ruler/05_list_rules_v3.py
similarity index 95%
rename from tests/integration/tests/alerts/06_list_rules_v3.py
rename to tests/integration/tests/ruler/05_list_rules_v3.py
index de663503ff..fe315e9e04 100644
--- a/tests/integration/tests/alerts/06_list_rules_v3.py
+++ b/tests/integration/tests/ruler/05_list_rules_v3.py
@@ -8,7 +8,7 @@ from fixtures.types import Operation, SigNoz
BASE_URL = "/api/v3/rules"
-SEED_CHANNEL = {"name": "list-rules-v3-channel", "email_configs": [{"to": "[email protected]"}]}
+SEED_CHANNEL_NAME = "list-rules-v3-channel"
EVALUATION = {"kind": "rolling", "spec": {"evalWindow": "5m0s", "frequency": "1m"}}
@@ -21,7 +21,7 @@ NOTIFICATION_SETTINGS = {
METRIC_CONDITION = {
"thresholds": {
"kind": "basic",
- "spec": [{"name": "critical", "target": 90, "matchType": "at_least_once", "op": "above", "channels": ["list-rules-v3-channel"]}],
+ "spec": [{"name": "critical", "target": 90, "matchType": "at_least_once", "op": "above", "channels": [SEED_CHANNEL_NAME]}],
},
"compositeQuery": {
"queryType": "builder",
@@ -43,7 +43,7 @@ METRIC_CONDITION = {
LOGS_CONDITION = {
"thresholds": {
"kind": "basic",
- "spec": [{"name": "critical", "target": 100, "matchType": "at_least_once", "op": "above", "channels": ["list-rules-v3-channel"]}],
+ "spec": [{"name": "critical", "target": 100, "matchType": "at_least_once", "op": "above", "channels": [SEED_CHANNEL_NAME]}],
},
"compositeQuery": {
"queryType": "builder",
@@ -66,7 +66,7 @@ LOGS_CONDITION = {
PROMQL_CONDITION = {
"thresholds": {
"kind": "basic",
- "spec": [{"name": "critical", "target": 1, "matchType": "at_least_once", "op": "below", "channels": ["list-rules-v3-channel"]}],
+ "spec": [{"name": "critical", "target": 1, "matchType": "at_least_once", "op": "below", "channels": [SEED_CHANNEL_NAME]}],
},
"compositeQuery": {
"queryType": "promql",
@@ -177,10 +177,10 @@ def test_envelope_and_slim_rows(
signoz: SigNoz,
create_user_admin: Operation, # pylint: disable=unused-argument
get_token: Callable[[str, str], str],
- seed_alert_rules: Callable[[dict, list[dict]], None],
+ seed_alert_rules: Callable[[str, list[dict]], None],
):
token = get_token(USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD)
- seed_alert_rules(SEED_CHANNEL, SEED_RULES)
+ seed_alert_rules(SEED_CHANNEL_NAME, SEED_RULES)
response = requests.get(
signoz.self.host_configs["8080"].get(BASE_URL),
@@ -232,10 +232,10 @@ def test_query_filters(
signoz: SigNoz,
create_user_admin: Operation, # pylint: disable=unused-argument
get_token: Callable[[str, str], str],
- seed_alert_rules: Callable[[dict, list[dict]], None],
+ seed_alert_rules: Callable[[str, list[dict]], None],
):
token = get_token(USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD)
- seed_alert_rules(SEED_CHANNEL, SEED_RULES)
+ seed_alert_rules(SEED_CHANNEL_NAME, SEED_RULES)
cases = [
("name = 'payment latency high'", {"payment latency high"}),
@@ -278,10 +278,10 @@ def test_bare_and_collision_keys(
signoz: SigNoz,
create_user_admin: Operation, # pylint: disable=unused-argument
get_token: Callable[[str, str], str],
- seed_alert_rules: Callable[[dict, list[dict]], None],
+ seed_alert_rules: Callable[[str, list[dict]], None],
):
token = get_token(USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD)
- seed_alert_rules(SEED_CHANNEL, SEED_RULES + [COLLIDER_RULE])
+ seed_alert_rules(SEED_CHANNEL_NAME, SEED_RULES + [COLLIDER_RULE])
cases = [
# a bare non-reserved key is a label lookup, no labels. prefix needed
@@ -318,10 +318,10 @@ def test_label_missing_semantics(
signoz: SigNoz,
create_user_admin: Operation, # pylint: disable=unused-argument
get_token: Callable[[str, str], str],
- seed_alert_rules: Callable[[dict, list[dict]], None],
+ seed_alert_rules: Callable[[str, list[dict]], None],
):
token = get_token(USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD)
- seed_alert_rules(SEED_CHANNEL, SEED_RULES)
+ seed_alert_rules(SEED_CHANNEL_NAME, SEED_RULES)
# A missing label uniformly evaluates as the empty string for value
# operators; presence is expressed with EXISTS / NOT EXISTS.
@@ -355,10 +355,10 @@ def test_states_param(
signoz: SigNoz,
create_user_admin: Operation, # pylint: disable=unused-argument
get_token: Callable[[str, str], str],
- seed_alert_rules: Callable[[dict, list[dict]], None],
+ seed_alert_rules: Callable[[str, list[dict]], None],
):
token = get_token(USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD)
- seed_alert_rules(SEED_CHANNEL, SEED_RULES)
+ seed_alert_rules(SEED_CHANNEL_NAME, SEED_RULES)
# No telemetry is seeded, so enabled rules sit at inactive and the one
# disabled rule reads disabled, deterministic without waiting on evals.
@@ -388,10 +388,10 @@ def test_sorting(
signoz: SigNoz,
create_user_admin: Operation, # pylint: disable=unused-argument
get_token: Callable[[str, str], str],
- seed_alert_rules: Callable[[dict, list[dict]], None],
+ seed_alert_rules: Callable[[str, list[dict]], None],
):
token = get_token(USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD)
- seed_alert_rules(SEED_CHANNEL, SEED_RULES)
+ seed_alert_rules(SEED_CHANNEL_NAME, SEED_RULES)
response = requests.get(
signoz.self.host_configs["8080"].get(BASE_URL),
@@ -474,10 +474,10 @@ def test_pagination(
signoz: SigNoz,
create_user_admin: Operation, # pylint: disable=unused-argument
get_token: Callable[[str, str], str],
- seed_alert_rules: Callable[[dict, list[dict]], None],
+ seed_alert_rules: Callable[[str, list[dict]], None],
):
token = get_token(USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD)
- seed_alert_rules(SEED_CHANNEL, SEED_RULES)
+ seed_alert_rules(SEED_CHANNEL_NAME, SEED_RULES)
pages = []
for offset in (0, 2, 4):
@@ -579,10 +579,10 @@ def test_v2_list_still_serves_bare_array(
signoz: SigNoz,
create_user_admin: Operation, # pylint: disable=unused-argument
get_token: Callable[[str, str], str],
- seed_alert_rules: Callable[[dict, list[dict]], None],
+ seed_alert_rules: Callable[[str, list[dict]], None],
):
token = get_token(USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD)
- seed_alert_rules(SEED_CHANNEL, SEED_RULES)
+ seed_alert_rules(SEED_CHANNEL_NAME, SEED_RULES)
response = requests.get(
signoz.self.host_configs["8080"].get("/api/v2/rules"),