Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] deferral for unit test when modifying upstream and doing a partial build #10017

Closed
Tracked by #8283
graciegoheen opened this issue Apr 23, 2024 · 0 comments · Fixed by #9199
Closed
Tracked by #8283

[bug] deferral for unit test when modifying upstream and doing a partial build #10017

graciegoheen opened this issue Apr 23, 2024 · 0 comments · Fixed by #9199
Assignees
Labels
bug Something isn't working pre-release Bug not yet in a stable release unit tests Issues related to built-in dbt unit testing functionality

Comments

@graciegoheen
Copy link
Contributor

          One failing test `TestUnitTestDeferState::test_unit_test_defer_state` which will be resolved by https://github.com/dbt-labs/dbt-adapters/pull/94.

At the same time, I got myself into quite a tricky loop trying to debug an edge case with dbt unit tests, until I realized that this PR should actually fix that edge case:

  • Say I have model_a -> model_b and a unit test defined on model_b
  • If I rename a column in model_a, model_b, and the unit test definition, and I build model_a but not model_b in my dev schema, then the unit test will pass without --defer and yet fail with --defer.
  • Why? Because status quo deferral behavior completely rewrites the node in the manifest, meaning that the unit test definition would be using the production version of model_b.raw_code rather than the updated development version.
  • The present PR fixes this by simply adding model_b.defer_relation, rather than overwriting the model_b node entry.

Originally posted by @jtcohen6 in #9199 (comment)

@graciegoheen graciegoheen added bug Something isn't working unit tests Issues related to built-in dbt unit testing functionality labels Apr 23, 2024
@graciegoheen graciegoheen added the pre-release Bug not yet in a stable release label Apr 23, 2024
jtcohen6 added a commit that referenced this issue May 2, 2024
jtcohen6 added a commit that referenced this issue May 2, 2024
jtcohen6 added a commit that referenced this issue May 2, 2024
…olver` (#9199)

* Move deferral from task to manifest loading + RefResolver

* dbt clone must specify --defer

* Fix deferral for unit test type deteection

* Add changelog

* Move merge_from_artifact from end of parsing back to task before_run to reduce scope of refactor

* PR review. DeferRelation conforms to RelationConfig protocol

* Add test case for #10017

* Update manifest v12 in test_previous_version_state

---------

Co-authored-by: Michelle Ark <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pre-release Bug not yet in a stable release unit tests Issues related to built-in dbt unit testing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants