Skip to content

Commit cae2a96

Browse files
Fix race condition: remove global cache clearing that caused parallel test hangs
The cache clearing after seed() was causing race conditions because all parallel test workers (gw0-gw7) share the same project_dir_copy directory. When one worker cleared target/schemas while another was using it, the other worker would hang. Changes: - Remove _clear_fusion_schema_cache_if_needed() from seed() - Re-add skip_for_dbt_fusion marker to test_schema_changes - Remove unused shutil import Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
1 parent afceceb commit cae2a96

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

integration_tests/tests/dbt_project.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import json
22
import os
3-
import shutil
43
from contextlib import contextmanager, nullcontext
54
from pathlib import Path
65
from tempfile import NamedTemporaryFile
@@ -262,20 +261,6 @@ def seed(self, data: List[dict], table_name: str):
262261
self.dbt_runner, self.project_dir_path, self.seeds_dir_path
263262
).seed(data, table_name):
264263
self._fix_seed_if_needed(table_name)
265-
self._clear_fusion_schema_cache_if_needed()
266-
267-
def _clear_fusion_schema_cache_if_needed(self):
268-
"""Clear dbt-fusion's schema cache after seeding.
269-
270-
dbt-fusion caches column information for relations. When a table is recreated
271-
with different columns (e.g., in test_schema_changes), the cache becomes stale.
272-
Clearing the cache after seeding ensures the next get_columns_in_relation call
273-
queries the warehouse for fresh column information.
274-
"""
275-
if self.runner_method == RunnerMethod.FUSION:
276-
schema_cache_path = self.project_dir_path / "target" / "schemas"
277-
if schema_cache_path.exists():
278-
shutil.rmtree(schema_cache_path, ignore_errors=True)
279264

280265
def _fix_seed_if_needed(self, table_name: str):
281266
# Hack for BigQuery - seems like we get empty strings instead of nulls in seeds, so we

integration_tests/tests/test_schema_changes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def assert_test_results(test_results: List[dict]):
4242

4343

4444
# Schema changes currently not supported on targets
45+
# dbt-fusion caches column information and doesn't refresh when tables are recreated
4546
@pytest.mark.skip_targets(["databricks", "spark", "athena", "trino", "clickhouse"])
47+
@pytest.mark.skip_for_dbt_fusion
4648
def test_schema_changes(test_id: str, dbt_project: DbtProject):
4749
dbt_test_name = "elementary.schema_changes"
4850
test_result = dbt_project.test(test_id, dbt_test_name, data=DATASET1)

0 commit comments

Comments
 (0)