Skip to content

fix(tests): isolate test schemas across concurrent engine variants in integration tests - #6044

Closed
BenjaminVijayaraj5102004 wants to merge 1 commit into
SQLMesh:mainfrom
BenjaminVijayaraj5102004:test-fix
Closed

fix(tests): isolate test schemas across concurrent engine variants in integration tests#6044
BenjaminVijayaraj5102004 wants to merge 1 commit into
SQLMesh:mainfrom
BenjaminVijayaraj5102004:test-fix

Conversation

@BenjaminVijayaraj5102004

Copy link
Copy Markdown

Description & Context

Fixes schema and database collision between concurrent integration test runs (specifically test_init_project[athena_hive] and test_init_project[athena_iceberg]).

Root Cause

TestContext.__init__ previously generated self.test_id using random_id(short=True). Because self.mark was not included in the ID and random was subject to worker seed duplication in parallel xdist runs (gw0 and gw1), both Hive and Iceberg test variants generated the exact same database names (test_schema_<test_id> and sqlmesh__test_schema_<test_id>). This caused one worker to drop/modify schemas while the other was still validating tables.

Changes

  1. Isolated Test IDs: Updated self.test_id in tests/core/engine_adapter/integration/__init__.py to include self.mark and a unique UUID fragment: f"{self.mark}_{uuid.uuid4().hex[:8]}".
    • self.mark ensures different table format variants (athena_hive vs athena_iceberg) never share a database name.
    • uuid.uuid4().hex[:8] guarantees worker entropy while keeping overall identifier lengths safely within the 64-character limit for engines with strict length limits (e.g. StarRocks, PostgreSQL).
  2. Cross-Platform Test Fixes:
    • Converted tmp_path to .as_posix() in tests/core/engine_adapter/integration/__init__.py and conftest.py to prevent YAML scanner escape errors on Windows paths.
    • Skipped attempting to unlink :memory: catalog paths on Windows in conftest.py.

Testing

  • Ran linter: uv run ruff check (passed with all checks clean).
  • Ran local integration test verification: uv run pytest tests/core/engine_adapter/integration/test_integration.py -k "duckdb and test_init_project" -v (passed).

@BenjaminVijayaraj5102004

Copy link
Copy Markdown
Author

HI maintainer can you check this PR

@cmgoffena13

Copy link
Copy Markdown
Collaborator

Closing: this PR was machine-generated — templated description, automated ping, no understanding shown. Read CONTRIBUTING.md if you'd like to contribute meaningfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants