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

Add a new selection method for unit_test: #10053

Closed
1 task done
Tracked by #8283
dbeatty10 opened this issue Apr 26, 2024 · 1 comment · Fixed by #10102
Closed
1 task done
Tracked by #8283

Add a new selection method for unit_test: #10053

dbeatty10 opened this issue Apr 26, 2024 · 1 comment · Fixed by #10102
Labels
backport 1.8.latest list related to the dbt list command node selection Functionality and syntax for selecting DAG nodes unit tests Issues related to built-in dbt unit testing functionality user docs [docs.getdbt.com] Needs better documentation

Comments

@dbeatty10
Copy link
Contributor

dbeatty10 commented Apr 26, 2024

^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

@dbeatty10 dbeatty10 added unit tests Issues related to built-in dbt unit testing functionality user docs [docs.getdbt.com] Needs better documentation node selection Functionality and syntax for selecting DAG nodes list related to the dbt list command labels Apr 26, 2024
@FishtownBuildBot
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.8.latest list related to the dbt list command node selection Functionality and syntax for selecting DAG nodes unit tests Issues related to built-in dbt unit testing functionality user docs [docs.getdbt.com] Needs better documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants