-
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
8295 unit testing artifacts #8477
Changes from all commits
67baf75
30c44fc
91a8494
87ce1d9
69e0e70
242ba29
b6a3f01
bb5e1fa
0eb5b5a
3940cab
53fa22d
a7ab834
1f0db54
e11d8ae
55cffef
a42110b
9e13179
7b7b9ce
6b6b609
d94c89e
e11a47c
ad070d7
03f65a0
0f679a1
d89fce6
1ef2be1
1f413b6
0625003
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Features | ||
body: Unit test manifest artifacts and selection | ||
time: 2023-08-28T10:18:25.958929-04:00 | ||
custom: | ||
Author: gshank | ||
Issue: "8295" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,8 @@ def can_select_indirectly(node): | |
""" | ||
if node.resource_type == NodeType.Test: | ||
return True | ||
elif node.resource_type == NodeType.Unit: | ||
return True | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding is that this is to power selection for the unit test task, but does not actually include unit tests in other task execution because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case the objects with NodeType.Unit are actually the UnitTestCases in manifest.unit_tests, which are in the manifest. They're not included in other tasks because each task has a Selector which filters out other resource types. So unit test cases aren't included in the "run" task job_queue because it only executes NodeType.Model. |
||
else: | ||
return False | ||
|
||
|
@@ -170,6 +172,8 @@ def _is_graph_member(self, unique_id: UniqueId) -> bool: | |
return metric.config.enabled | ||
elif unique_id in self.manifest.semantic_models: | ||
return True | ||
elif unique_id in self.manifest.unit_tests: | ||
return True | ||
node = self.manifest.nodes[unique_id] | ||
|
||
if self.include_empty_nodes: | ||
|
@@ -195,6 +199,8 @@ def _is_match(self, unique_id: UniqueId) -> bool: | |
node = self.manifest.metrics[unique_id] | ||
elif unique_id in self.manifest.semantic_models: | ||
node = self.manifest.semantic_models[unique_id] | ||
elif unique_id in self.manifest.unit_tests: | ||
node = self.manifest.unit_tests[unique_id] | ||
else: | ||
raise DbtInternalError(f"Node {unique_id} not found in the manifest!") | ||
return self.node_is_match(node) | ||
|
@@ -240,8 +246,11 @@ def expand_selection( | |
) | ||
|
||
for unique_id in self.graph.select_successors(selected): | ||
if unique_id in self.manifest.nodes: | ||
node = self.manifest.nodes[unique_id] | ||
if unique_id in self.manifest.nodes or unique_id in self.manifest.unit_tests: | ||
if unique_id in self.manifest.nodes: | ||
node = self.manifest.nodes[unique_id] | ||
elif unique_id in self.manifest.unit_tests: | ||
node = self.manifest.unit_tests[unique_id] # type: ignore | ||
if can_select_indirectly(node): | ||
# should we add it in directly? | ||
if indirect_selection == IndirectSelection.Eager or set( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the reasoning for loading the unit test manifest (much prefer this naming to "collection"!) to the task as opposed to as a requires decorator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A requires decorator runs before the task starts. The unit test manifest can't be created until after selection is handled, which happens during task.run.