dbt-core
dbt-core copied to clipboard
Add a new selection method for `unit_test:`
^we are aligned that the option to "add a new selection method for
unit_test:" is the preferred solution!
Originally posted by @graciegoheen in https://github.com/dbt-labs/dbt-core/issues/9895#issuecomment-2077293380
Housekeeping
- [X] I am a maintainer of dbt-core
Short description
There should be a selection method for unit tests (unit_test:), and the output of dbt ls should be usable with dbt test --select {unit test selection method}.
Acceptance criteria
- Output of
dbt liststill includes:unit_test:my_project.my_unit_test - Output of
dbt ls --select unit_test:my_project.my_unit_testincludes:unit_test:my_project.my_unit_test dbt run --select unit_test:my_project.my_unit_testdoes nothingdbt test --select unit_test:my_project.my_unit_testexecutes a single node -- the unit testdbt build --select unit_test:my_project.my_unit_testexecutes a single node -- the unit test- PR resolves and closes both #9895 and #10053
- e.g., if the PR description includes
resolves #9895 resolves #10053, it will accomplish that goal.
- e.g., if the PR description includes
- Confirm that the
user docslabel opens an issue in the docs.getdbt.com repo- Update the docs issue with enough information for this feature to be documented (syntax example(s) and link to the docs page to be updated).
Suggested Tests
Although the following two proposed tests cover independent expected behaviors, they can be combined into a single test if desired.
Test 1
dbt list --select {mode_name} --output json --quiet- Parse the output as JSON-L
- Confirm there is just a single item and it has the expected
unique_idvalue
Test 2
Do the following steps:
dbt list --select {mode_name} --output json --quiet- Parse the output as JSON-L
- For each item in the result, confirm the following has the expected result:
dbt test --select {unique_id}
Impact to Other Teams
Unknown.
Will backports be required?
No.
Context
https://github.com/dbt-labs/dbt-core/issues/9895