[Bug] Unit test fails with versioned inputs #10880
Labels
bug
Something isn't working
model_versions
unit tests
Issues related to built-in dbt unit testing functionality
Is this a new bug in dbt-core?
Current Behavior
Unit tests fail if an input reference is a versioned model even though it is explicitly defined in both the model & the unit test input. The following is the error when the test fails:
Compilation Error in unit_test unit_test_mart__model_b (models/mart/unit_test.yml) Unit_Test 'unit_test.repo.mart__model_b.unit_test_mart__model_b’ (models/mart/unit_test.yml) depends on a node named ‘input_versioned_model’ which was not found
Expected Behavior
Unit test should run with specified versioned model.
Steps To Reproduce
_v#
, e.g. input_versioned_model_v1latest_version: 1
Code for reference:
Code for reference:
dbt build -s +mart__model_b
Code for reference:
Note: I tried the following versioned inputs:
input: ref('input_versioned_model', v='1')
-input: ref('input_versioned_model', v=1)
7. Run
dbt test --select "mart__model_b,test_type:unit"
will give you the following error:Compilation Error in unit_test unit_test_mart__model_b (models/mart/unit_test.yml) Unit_Test 'unit_test.repo.mart__model_b.unit_test_mart__model_b’ (models/mart/unit_test.yml) depends on a node named ‘input_versioned_model’ which was not found
Relevant log output
Environment
Which database adapter are you using with dbt?
redshift: 1.8.1
Additional Context
Found following github issues that are related: 10528 and 10623 and tried the solutions provided.
The text was updated successfully, but these errors were encountered: