Skip to content

Commit

Permalink
Strengthen test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterallenwebb committed Oct 10, 2023
1 parent 181d984 commit 32e7044
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/functional/adapter/test_get_last_relation_modified.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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

0 comments on commit 32e7044

Please sign in to comment.