From 32e70443b34d8c18afbfc6c8cc988bad24979ed9 Mon Sep 17 00:00:00 2001 From: Peter Allen Webb Date: Tue, 10 Oct 2023 12:41:05 -0400 Subject: [PATCH] Strengthen test case. --- .../adapter/test_get_last_relation_modified.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/functional/adapter/test_get_last_relation_modified.py b/tests/functional/adapter/test_get_last_relation_modified.py index 61270b38f..bfcf785fd 100644 --- a/tests/functional/adapter/test_get_last_relation_modified.py +++ b/tests/functional/adapter/test_get_last_relation_modified.py @@ -1,7 +1,8 @@ import os import pytest -from dbt.tests.util import run_dbt +from dbt.cli.main import dbtRunner + freshness_via_metadata_schema_yml = """version: 2 sources: @@ -30,4 +31,16 @@ def test_get_last_relation_modified(self, project, set_env_vars): project.run_sql( f"create table {project.test_schema}.test_table (id integer autoincrement, name varchar(100) not null);" ) - run_dbt(["source", "freshness"]) + + warning_or_error = False + + def probe(e): + nonlocal warning_or_error + if e.info.level in ["warning", "error"]: + warning_or_error = True + + runner = dbtRunner(callbacks=[probe]) + runner.invoke(["source", "freshness"]) + + # The 'source freshness' command should succeed without warnings or errors. + assert not warning_or_error