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

[Tidy-First] Fix node_status for hooks #10845

Merged
merged 5 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/dbt/task/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,8 @@
status = RunStatus.Skipped
message = f"{hook_name} skipped"

hook.update_event_status(node_status=status)

Check warning on line 688 in core/dbt/task/run.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/run.py#L688

Added line #L688 was not covered by tests

self.node_results.append(
RunResult(
status=status,
Expand Down
6 changes: 6 additions & 0 deletions tests/functional/adapter/hooks/test_on_run_hooks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest

from dbt.artifacts.schemas.results import RunStatus
from dbt.contracts.graph.nodes import HookNode
from dbt.tests.util import get_artifact, run_dbt_and_capture


Expand Down Expand Up @@ -49,6 +50,11 @@ def test_results(self, project, log_counts, my_model_run_status):
]

assert [(result.node.unique_id, result.status) for result in results] == expected_results
assert [
(result.node.unique_id, result.node.node_info["node_status"])
for result in results
if isinstance(result.node, HookNode)
] == [(id, str(status)) for id, status in expected_results if id.startswith("operation")]
assert log_counts in log_output
assert "4 project hooks, 1 view model" in log_output

Expand Down
Loading