Skip to content

Commit

Permalink
Merge pull request #1413 from elementary-data/ele-2512-fix-alerts-sen…
Browse files Browse the repository at this point in the history
…t-validation

Fix alerts sent validation
  • Loading branch information
IDoneShaveIt authored Feb 14, 2024
2 parents b549e31 + e6e2863 commit 9a6563d
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% macro validate_alert_statuses_are_updated() %}
{% set alerts_with_no_updated_status_query %}
select alert_id
select alert_id, data
from {{ ref('elementary_cli', 'alerts_v2') }}
where status not in ('sent', 'skipped')
{% endset %}
Expand All @@ -10,9 +10,10 @@
{% set alerts_with_no_updated_status_without_singulars = [] %}
{% for alert in alerts_with_no_updated_status %}
{% set alert_data = fromjson(alert['data']) %}
{% if alert_data.get('test_sub_type', '') != 'singular' %}
-- By default we don't send skipped models. So we filter them out in this test.
{% if alert_data.get('test_sub_type', '') != 'singular' and alert_data.get('status', '') != 'skipped' %}
{% do alerts_with_no_updated_status_without_singulars.append(alert) %}
{% endif %}
{% endif %}
{% endfor %}
{% if alerts_with_no_updated_status_without_singulars %}
{% do exceptions.raise_compiler_error("Elementary couldn't update all of the alerts status") %}
Expand Down

0 comments on commit 9a6563d

Please sign in to comment.