fix(alerts): wrong alert trigger with custom query (#35871)

This commit is contained in:
Gabriel Torres Ruiz
2026-01-07 13:06:18 -04:00
committed by GitHub
parent 861e5cd013
commit 5edaed2e5b
4 changed files with 570 additions and 18 deletions

View File

@@ -131,7 +131,9 @@ def test_execute_query_mutate_query_enabled(
database=mock_database,
validator_config_json='{"op": "==", "threshold": 1}',
)
AlertCommand(report_schedule=report_schedule, execution_id=uuid.uuid4()).run()
triggered, message = AlertCommand(
report_schedule=report_schedule, execution_id=uuid.uuid4()
).run()
mock_mutate_call.assert_called_once_with(mock_limited_sql.return_value)
mock_get_df.assert_called_once_with(sql=mock_mutate_call.return_value)
@@ -166,7 +168,9 @@ def test_execute_query_mutate_query_disabled(
database=mock_database,
validator_config_json='{"op": "==", "threshold": 1}',
)
AlertCommand(report_schedule=report_schedule, execution_id=uuid.uuid4()).run()
triggered, message = AlertCommand(
report_schedule=report_schedule, execution_id=uuid.uuid4()
).run()
mock_database.mutate_sql_based_on_config.assert_not_called()
mock_database.get_df.assert_called_once_with(