Skip to content

Use tmp dir for SERVER_DIR_PATH in tests - #4121

Merged
r4victor merged 5 commits into
masterfrom
issue_4095_server_dir_paths
Aug 10, 2026
Merged

Use tmp dir for SERVER_DIR_PATH in tests #4121
r4victor merged 5 commits into
masterfrom
issue_4095_server_dir_paths

Conversation

@r4victor

Copy link
Copy Markdown
Collaborator

Fixes #4095

The tests used dstack's default ~/.dstack/server dir for SERVER_DIR_PATH and relied on per-tests ad-hoc monkey patching in case tests write to SERVER_DIR_PATH. In some places the patching was missing which could lead to non-deterministic test failures.

Now every test session uses a tmp dir for SERVER_DIR_PATH. Subpaths of SERVER_DIR_PATH are derived at runtime to support overriding via pytest fixtures.

Paths under SERVER_DIR_PATH were bound at import time, so tests could not
redirect them and every pytest-xdist worker shared the real ~/.dstack/server.
Workers raced mkdir against rmtree on the same instance connection dir, which
flaked tests under -n auto. Importing the server no longer creates the data dir
or a DB engine either.

Fixes #4095
@r4victor
r4victor merged commit 26247fd into master Aug 10, 2026
2 checks passed
@r4victor
r4victor deleted the issue_4095_server_dir_paths branch August 10, 2026 11:09
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.

[Bug]: SSHTunnelPool races mkdir against rmtree on a shared connection dir, flaking tests under -n auto

1 participant