Skip to content

Fix LXC test temp directory collisions - #1296

Merged
Gudge (MGudgin) merged 1 commit into
mainfrom
user/gudge/lxc-tempdir-collision
Sep 28, 2026
Merged

Gudge (MGudgin) merged 1 commit into
mainfrom
user/gudge/lxc-tempdir-collision

Conversation

@MGudgin

@MGudgin Gudge (MGudgin) commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Use collision-resistant tempfile::TempDir fixtures for LXC mount configuration
tests. Each test now retains ownership of its temporary directory for the full
test lifetime, and the directory is removed automatically when the fixture is
dropped.

Resolves #1292

Tests

  • cargo test -p lxc_common --lib lxc_bindings::tests::a_reused_container_does_not_inherit_an_earlier_runs_mounts
  • 20 runs of cargo test -q -p lxc_common --lib lxc_bindings::tests:: -- --test-threads=32 (760 tests total)
  • cargo clippy -p lxc_common --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • git diff --check
Microsoft Reviewers: Open in CodeFlow

Use tempfile-managed directories for LXC config test fixtures so parallel
runs cannot overwrite each other's files and cleanup occurs automatically.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7b0285d2-142d-4d79-912e-7e8d22287db2
Copilot AI balanced review requested due to automatic review settings September 27, 2026 03:02
@MGudgin
Gudge (MGudgin) requested a review from a team as a code owner September 27, 2026 03:02
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The RAII fixture directly resolves parallel-test collisions while preserving directory lifetime and cleanup.

Review effort: Balanced
Findings: None

What changed in this PR

Replaces collision-prone LXC test directories with uniquely owned, automatically cleaned temporary fixtures.

Changes:

  • Uses tempfile::TempDir for LXC configuration tests.
  • Retains each fixture for the full test lifetime.
  • Adds tempfile as a development dependency.
File Description
src/​Cargo.lock Records the LXC crate’s tempfile dependency.
src/​backends/​lxc/​common/​src/​lxc_bindings.rs Migrates test fixtures to collision-resistant temporary directories.
src/​backends/​lxc/​common/​Cargo.toml Adds the workspace tempfile development dependency.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@MGudgin
Gudge (MGudgin) merged commit 1fabede into main Sep 28, 2026
31 checks passed
@MGudgin
Gudge (MGudgin) deleted the user/gudge/lxc-tempdir-collision branch September 28, 2026 21:07
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.

[LXC] Parallel mount tests can collide on timestamp-based temp directories

3 participants