Skip to content

Commit

Permalink
Fix concurrency test (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare authored Dec 13, 2024
1 parent bf40baf commit e3964d7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from collections import Counter

import pytest

from dbt.artifacts.schemas.results import RunStatus
from dbt.tests.util import (
check_relations_equal,
check_table_does_not_exist,
rm_file,
run_dbt,
run_dbt_and_capture,
write_file,
)

Expand Down Expand Up @@ -317,16 +319,22 @@ def test_concurrency(self, project):
rm_file(project.project_root, "seeds", "seed.csv")
write_file(seeds__update_csv, project.project_root, "seeds", "seed.csv")

results, output = run_dbt_and_capture(["run"], expect_pass=False)
assert len(results) == 7
results = run_dbt(["run"], expect_pass=False)

check_relations_equal(project.adapter, ["seed", "view_model"])
check_relations_equal(project.adapter, ["seed", "dep"])
check_relations_equal(project.adapter, ["seed", "table_a"])
check_relations_equal(project.adapter, ["seed", "table_b"])
check_table_does_not_exist(project.adapter, "invalid")
check_table_does_not_exist(project.adapter, "skip")

assert "PASS=5 WARN=0 ERROR=1 SKIP=1 TOTAL=7" in output
result_statuses = Counter([result.status for result in results])
expected_statuses = {
RunStatus.Success: 5,
RunStatus.Error: 1,
RunStatus.Skipped: 1,
}
assert result_statuses == expected_statuses


class TestConcurenncy(BaseConcurrency):
Expand Down
10 changes: 10 additions & 0 deletions dbt-tests-adapter/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ include = ["dbt/tests", "dbt/__init__.py"]
[tool.hatch.build.targets.wheel]
include = ["dbt/tests", "dbt/__init__.py"]

[tool.hatch.envs.default]
python = "3.9"
dependencies = [
"dbt_common @ git+https://github.com/dbt-labs/dbt-common.git",
"dbt-adapters @ {root:uri}/..",
"dbt-core @ git+https://github.com/dbt-labs/dbt-core.git#subdirectory=core",
"pre-commit==3.7.0",
"pytest"
]

[tool.hatch.envs.build]
detached = true
dependencies = [
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ include = ["dbt/adapters", "dbt/include", "dbt/__init__.py"]
include = ["dbt/adapters", "dbt/include", "dbt/__init__.py"]

[tool.hatch.envs.default]
python = "3.9"
dependencies = [
"dbt_common @ git+https://github.com/dbt-labs/dbt-common.git",
'pre-commit==3.7.0;python_version>="3.9"',
Expand Down

0 comments on commit e3964d7

Please sign in to comment.