Repository navigation
Fix LXC test temp directory collisions - #1296
Merged
Merged
Conversation
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
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
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::TempDirfor LXC configuration tests. - Retains each fixture for the full test lifetime.
- Adds
tempfileas 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use collision-resistant
tempfile::TempDirfixtures for LXC mount configurationtests. 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_mountscargo test -q -p lxc_common --lib lxc_bindings::tests:: -- --test-threads=32(760 tests total)cargo clippy -p lxc_common --all-targets -- -D warningscargo fmt --all -- --checkgit diff --checkMicrosoft Reviewers: Open in CodeFlow