[Bug] Intermittent errors when unit testing versioned models
- Dominant language
- Rust
- Stars
- 13.8k
- Forks
- 2.6k
- Avg merge
- 21h 31m
- Merged PRs (30d)
- 56
Description
### Is this a new bug in dbt-core?
- [X] I believe this is a new bug in dbt-core
- [X] I have searched the existing issues, and I could not find an existing issue for this bug
### Current Behavior
Encountering an intermittent error during unit testing of versioned models. The error resolved after removing the associated unit tests.
> ❯ poetry run dbt compile
> 05:50:12 Running with dbt=1.9.0
> 05:50:14 Registered adapter: bigquery=1.9.0
> 05:50:14 Unable to do partial parsing because saved manifest not found. Starting full parse.
> 05:50:17 Encountered an error:
> Parsing Error
> Unit test 'test_model' references a model that does not exist: model.my_project.model
### Expected Behavior
When it worked, it looks like the following:
> ❯ poetry run dbt compile
> 05:53:33 Running with dbt=1.9.0
> 05:53:34 Registered adapter: bigquery=1.9.0
> 05:53:35 Unable to do partial parsing because saved manifest not found. Starting full parse.
> 05:53:39 Found 109 models, 2 operations, 34 data tests, 25 sources, 4 exposures, 1462 macros, 36 unit tests
> 05:53:39
> 05:53:39 Concurrency: 20 threads (target='default')
### Steps To Reproduce
model.sql:
```
select * from {{ ref("table_a") }}
```
model_v2.sql:
```
select * from {{ ref("table_a") }}
```
schema.yml:
```
version: 2
models:
- name: model
latest_version: 1
versions:
- v: 2
defined_in: model_v2
- v: 1
defined_in: model
config:
alias: model
```
test_model.yml:
```
unit_tests:
- name: test_model
model: model
versions:
include:
- 2
given:
- input: ref('table_a')
format: csv
fixture: fixture_table_a
expect:
rows:
- ...
```
### Relevant log output
_No response_
### Environment
```markdown
- OS: macOS 14.7
- Python: 3.11.6
- dbt: 1.9.0
```
### Which database adapter are you using with dbt?
bigquery
### Additional Context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.