Skip to content

Commit

Permalink
Return code or error ignores WarnErrorOptions (astronomer#692)
Browse files Browse the repository at this point in the history
Ignore `WarnErrorOptions` string in stdout from dbt-core, do not treat it
as a failure

Closes: astronomer#642
  • Loading branch information
adammarples authored and arojasb3 committed Jul 14, 2024
1 parent 060cb2f commit 08bede1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cosmos/dbt/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def run_command(command: list[str], tmp_dir: Path, env_vars: dict[str, str]) ->
"Unable to run dbt ls command due to missing dbt_packages. Set RenderConfig.dbt_deps=True."
)

if returncode or "Error" in stdout:
if returncode or "Error" in stdout.replace("WarnErrorOptions", ""):
details = stderr or stdout
raise CosmosLoadDbtException(f"Unable to run {command} due to the error:\n{details}")

Expand Down
1 change: 1 addition & 0 deletions tests/dbt/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ def test_load_dbt_ls_and_manifest_with_model_version(load_method):
"stdout,returncode",
[
("all good", None),
("WarnErrorOptions", None),
pytest.param("fail", 599, marks=pytest.mark.xfail(raises=CosmosLoadDbtException)),
pytest.param("Error", None, marks=pytest.mark.xfail(raises=CosmosLoadDbtException)),
],
Expand Down

0 comments on commit 08bede1

Please sign in to comment.