dbt-labs/dbt-core

Add a new selection method for `unit_test:`

dbeatty10 opened this issue · 1 comments

^we are aligned that the option to "add a new selection method for unit_test:" is the preferred solution!

Originally posted by @graciegoheen in #9895 (comment)

Housekeeping

  • 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 list still includes:
    unit_test:my_project.my_unit_test
    
  • Output of dbt ls --select unit_test:my_project.my_unit_test includes:
    unit_test:my_project.my_unit_test
    
  • dbt run --select unit_test:my_project.my_unit_test does nothing
  • dbt test --select unit_test:my_project.my_unit_test executes a single node -- the unit test
  • dbt build --select unit_test:my_project.my_unit_test executes 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.
  • Confirm that the user docs label 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

  1. dbt list --select {mode_name} --output json --quiet
  2. Parse the output as JSON-L
  3. Confirm there is just a single item and it has the expected unique_id value

Test 2

Do the following steps:

  1. dbt list --select {mode_name} --output json --quiet
  2. Parse the output as JSON-L
  3. 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

#9895

Opened a new issue in dbt-labs/docs.getdbt.com: dbt-labs/docs.getdbt.com#5468