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 docs on best practice to only run unit tests in dev and CI and exclude them from prod #5439

Closed
1 task
graciegoheen opened this issue May 2, 2024 · 0 comments · Fixed by #5473
Closed
1 task
Assignees
Labels
content Improvements or additions to content dbt-core v1.8 improvement Use this when an area of the docs needs improvement as it's currently unclear unit testing docs for 1.8 unit testing

Comments

@graciegoheen
Copy link
Collaborator

Contributions

  • I have read the contribution docs, and understand what's expected of me.

Link to the page on docs.getdbt.com requiring updates

when should I actually be executing these unit tests?

Best practice to only run unit tests in dev and CI, exclude them in prod (mock data is static, won’t change - waste to run in prod)

  • our best practice is to only run your unit tests when you're in development, so that you can have this test-driven development approach, and also in CI to make sure that your changes don't break pre-existing unit tests.

Since my unit tests are only defined on these static inputs, there's actually no reason for me to run these unit tests in production.

DBT_EXCLUDE_RESOURCE_TYPES

  • DBT_EXCLUDE_RESOURCE_TYPES a special type of variable that will automatically feed into the right place, so this is all I have to do to exclude unit tests whenever I run dbt build in production, so I don't waste compute running these when I don't need to since my static inputs won't be changing.

What part(s) of the page would you like to see updated?

one of the unit test pages

Additional information

No response

@graciegoheen graciegoheen added content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear dbt-core v1.8 unit testing docs for 1.8 unit testing labels May 2, 2024
@matthewshaver matthewshaver self-assigned this May 7, 2024
matthewshaver added a commit that referenced this issue May 9, 2024
## What are you changing in this pull request and why?

Closes #5439

## Checklist
<!--
Uncomment when publishing docs for a prerelease version of dbt:
- [ ] Add versioning components, as described in [Versioning
Docs](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-entire-pages)
- [ ] Add a note to the prerelease version [Migration
Guide](https://github.com/dbt-labs/docs.getdbt.com/tree/current/website/docs/docs/dbt-versions/core-upgrade)
-->
- [x] Review the [Content style
guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md)
so my content adheres to these guidelines.
- [x] For [docs
versioning](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#about-versioning),
review how to [version a whole
page](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version)
and [version a block of
content](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-blocks-of-content).
- [x] Add a checklist item for anything that needs to happen before this
PR is merged, such as "needs technical review" or "change base branch."

Adding or removing pages (delete if not applicable):
- [x] Add/remove page in `website/sidebars.js`
- [x] Provide a unique filename for new pages
- [x] Add an entry for deleted pages in `website/vercel.json`
- [x] Run link testing locally with `npm run build` to update the links
that point to deleted pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content dbt-core v1.8 improvement Use this when an area of the docs needs improvement as it's currently unclear unit testing docs for 1.8 unit testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants