File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626)
2727from elementary .monitor .api .totals_schema import TotalsSchema
2828from elementary .monitor .data_monitoring .schema import SelectorFilterSchema
29+ from elementary .monitor .fetchers .invocations .schema import DbtInvocationSchema
2930from elementary .monitor .fetchers .tests .schema import (
3031 NormalizedTestSchema ,
3132 TestDBRowSchema ,
@@ -69,8 +70,15 @@ def _get_test_results_db_rows(
6970 def get_test_results_summary (
7071 self ,
7172 filter : SelectorFilterSchema = SelectorFilterSchema (),
73+ dbt_invocation : Optional [DbtInvocationSchema ] = None ,
7274 ) -> List [TestResultSummarySchema ]:
7375 filtered_test_results_db_rows = self .test_results_db_rows
76+ if dbt_invocation and dbt_invocation .invocation_id :
77+ filtered_test_results_db_rows = [
78+ test_result
79+ for test_result in filtered_test_results_db_rows
80+ if test_result .invocation_id == dbt_invocation .invocation_id
81+ ]
7482 if filter .tag :
7583 filtered_test_results_db_rows = [
7684 test_result
Original file line number Diff line number Diff line change 1010from elementary .clients .s3 .client import S3Client
1111from elementary .clients .slack .client import SlackClient
1212from elementary .config .config import Config
13+ from elementary .monitor .api .invocations .invocations import InvocationsAPI
1314from elementary .monitor .api .report .report import ReportAPI
1415from elementary .monitor .api .report .schema import ReportDataSchema
1516from elementary .monitor .api .tests .tests import TestsAPI
@@ -285,8 +286,15 @@ def send_test_results_summary(
285286 invocations_per_test = test_runs_amount ,
286287 disable_passed_test_metrics = disable_passed_test_metrics ,
287288 )
289+ invocations_api = InvocationsAPI (
290+ dbt_runner = self .internal_dbt_runner ,
291+ )
292+ invocation = invocations_api .get_test_invocation_from_filter (
293+ self .selector_filter .to_selector_filter_schema ()
294+ )
288295 summary_test_results = tests_api .get_test_results_summary (
289296 filter = self .selector_filter .to_selector_filter_schema (),
297+ dbt_invocation = invocation ,
290298 )
291299 if self .slack_client :
292300 send_succeeded = self .slack_client .send_message (
You can’t perform that action at this time.
0 commit comments