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

Support deferred tests #2701

Closed
jtcohen6 opened this issue Aug 13, 2020 · 1 comment · Fixed by #2954
Closed

Support deferred tests #2701

jtcohen6 opened this issue Aug 13, 2020 · 1 comment · Fixed by #2954
Labels
enhancement New feature or request state Stateful selection (state:modified, defer)

Comments

@jtcohen6
Copy link
Contributor

jtcohen6 commented Aug 13, 2020

Describe the feature

In general: It may be desirable to test changes to a test without needing to first run the models it selects from:

dbt test -m my_new_test --defer --state path/to/artifacts

The resources that my_new_test depend on are not selected, and as such, references to those resources will be deferred to the supplied manifest's namespace.

For "Slim CI": In order to execute new tests that reference old unchanged models, we'll need to be able to:

dbt test -m state:modified+ --defer --state path/to/artifacts

If a model has been modified, this should run tests against the new model. If a test is new/modified, but the model it selects from is not, this should run tests against the deferred model.

This is intuitively tricky for relationships tests or data tests which depend on multiple models. If one model is included in the node selection criteria, and another model is not included, the test should defer only the latter's reference.

The only open question for me is: What should full test do?

dbt test --defer --state path/to/artifacts

Are all model nodes selected here?

  • If so, this is identical to dbt test. The question is, how would you write "run all my tests and defer all their references"? Excluding models in this syntax would also exclude their dependent tests.

  • If not, all references should be deferred. This feels like the right approach, but it's different from the dbt run analogue. dbt run --defer --state path/to/artifacts has identical behavior to dbt run (no deferral). dbt run selects all models and so defers nothing, whereas dbt test selects all tests but no models and so defers everything.

Describe alternatives you've considered

  • This adds complexity to deferral. The alternative is to not do it for a while.
@jtcohen6 jtcohen6 added the enhancement New feature or request label Aug 13, 2020
@beckjake beckjake mentioned this issue Aug 14, 2020
4 tasks
@jtcohen6 jtcohen6 added this to the 0.19.0 milestone Aug 17, 2020
@jtcohen6
Copy link
Contributor Author

jtcohen6 commented Sep 15, 2020

The gap we planned to fill with dbt test --defer is better addressed with selectors. In particular, see discussion in #2704. Closing this issue and its corresponding PR (#2706) in the meantime.

@jtcohen6 jtcohen6 removed this from the Kiyoshi Kuromiya milestone Sep 21, 2020
@jtcohen6 jtcohen6 added the wontfix Not a bug or out of scope for dbt-core label Sep 21, 2020
@jtcohen6 jtcohen6 removed more_information_needed wontfix Not a bug or out of scope for dbt-core labels Dec 15, 2020
@jtcohen6 jtcohen6 added this to the Kiyoshi Kuromiya milestone Dec 15, 2020
@jtcohen6 jtcohen6 reopened this Dec 15, 2020
@jtcohen6 jtcohen6 added the state Stateful selection (state:modified, defer) label Dec 15, 2020
@jtcohen6 jtcohen6 mentioned this issue Dec 15, 2020
4 tasks
@kwigley kwigley assigned kwigley and unassigned kwigley Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request state Stateful selection (state:modified, defer)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants