-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Stop mis-identifying unit_test
config paths in dbt_project.yaml
as unused
#10312
Stop mis-identifying unit_test
config paths in dbt_project.yaml
as unused
#10312
Conversation
We're doing this in preperation to a for a unit test which will be testing these nodes (as well as others) and thus we want them in the manifest.
In the previous commit, 58990aa, we added the `saved_query` fixture to the `manifest` fixture. This broke the test `tests/unit/parser/test_manifest.py::TestPartialParse::test_partial_parse_by_version`. It broke because the `Manifest.deepcopy` manifest basically dictifies things. When we were dictifying the `QueryParams` of the `saved_query` before, the `where` key was getting dropped because it was `None`. We'd then run into a runtime error on instantiation of the `QueryParams` because although `where` is declared as _optional_, we don't set a default value for it. And thus, kaboom :( We should probably provide a default value for `where`. However that is out of scope for this branch of work.
In 58990aa we added a semantic model to the `manifest` fixture. This broke the test `tests/unit/graph/test_selector_methods.py::test_select_fqn` because in the test it selects nodes based on the string `*.*.*_model`. The newly added semantic model matches this, and thus needed to be added to the expected results.
Note: At this point the test when run with for a `unit_test` config taht should be considered used, fails. This is because it is not being properly identified as used.
Because `unit_tests` weren't being included in calls to `Manifest.get_resource.fqns`, it always appeared to `_warn_for_unused_resource_config_paths` that there were no unit tests in the manifest. Because of this `_warn_for_unused_resource_config_paths` thought that _any_ `unit_test` config in `dbt_project.yaml` was unused.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10312 +/- ##
==========================================
- Coverage 88.76% 88.69% -0.07%
==========================================
Files 180 180
Lines 22483 22483
==========================================
- Hits 19957 19942 -15
- Misses 2526 2541 +15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.8.latest 1.8.latest
# Navigate to the new working tree
cd .worktrees/backport-1.8.latest
# Create a new branch
git switch --create backport-10312-to-1.8.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 100352d6b43e6fd1ec6806ced0b474714f484ed8
# Push it to GitHub
git push --set-upstream origin backport-10312-to-1.8.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.8.latest Then, create a pull request where the |
2 similar comments
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.8.latest 1.8.latest
# Navigate to the new working tree
cd .worktrees/backport-1.8.latest
# Create a new branch
git switch --create backport-10312-to-1.8.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 100352d6b43e6fd1ec6806ced0b474714f484ed8
# Push it to GitHub
git push --set-upstream origin backport-10312-to-1.8.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.8.latest Then, create a pull request where the |
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.8.latest 1.8.latest
# Navigate to the new working tree
cd .worktrees/backport-1.8.latest
# Create a new branch
git switch --create backport-10312-to-1.8.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 100352d6b43e6fd1ec6806ced0b474714f484ed8
# Push it to GitHub
git push --set-upstream origin backport-10312-to-1.8.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.8.latest Then, create a pull request where the |
resolves #10311
Problem
unit_tests
weren't being included in calls toManifest.get_resource_fqns
, it always appeared to_warn_for_unused_resource_config_paths
that there were no unit tests in the manifest. Thus,_warn_for_unused_resource_config_paths
always thought that anyunit_test
config indbt_project.yaml
was unused.Solution
Include
unit_tests
inManifest.get_resource_fqns
Checklist