Repository navigation
test(partitions): stop the removal test panicking when run as root - #4754
Open
coding-by-sea wants to merge 1 commit into
Open
coding-by-sea wants to merge 1 commit into
coding-by-sea wants to merge 1 commit into
Conversation
Root ignores the 0o500 mode the test uses to cut the removal short, so remove_partition_dir deleted the whole partition directory. The test then restored the mode on the deleted offsets directory, and that unwrap panicked before the early return for root could run. The panic also stopped cargo test before the crate's integration tests. Return before the removal when the probe shows the mode is ignored, which is what the test's comment already intends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the PR. It is labeled If AI was used to create this PR, you must run the Slash commands (own line, regular comment) move it around the queue:
See CONTRIBUTING.md for details. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4754 +/- ##
=============================================
- Coverage 91.03% 82.66% -8.37%
+ Complexity 3878 3875 -3
=============================================
Files 1561 1553 -8
Lines 403726 303949 -99777
Branches 337601 237827 -99774
=============================================
- Hits 367515 251259 -116256
- Misses 28851 45576 +16725
+ Partials 7360 7114 -246
🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Which issue does this PR address?
Closes #4753
Rationale
a_removal_cut_short_leaves_the_marker_in_placepanics when thepartitionstests run as root, for example in a Docker container. The panic also stopscargo test -p partitionsbefore the crate's integration tests run.What changed?
Root ignores the
0o500mode the test uses to cut the removal short, soremove_partition_dirdeleted the whole partition directory. The test then restored the mode on the deletedoffsetsdirectory, and thatunwrap()panicked before the early return for root.The test now returns before the removal when the probe shows the mode is ignored. Runs as a regular user take the same path as before.
Local Execution
rust-toolchain.toml, on masterd0fc19a.rust:1.99.1-slim-trixieas root:cargo test -p partitions --features poll-diagnosticspasses, 753 tests. On master the test panics withNotFound.cargo clippy --all-features --all-targets -- -D warningson the whole workspace (Linux) andcargo fmt --all --checkare clean.prek run --from-ref origin/master --to-ref HEAD, all applicable hooks pass.AI Usage
team-reviewskill ran on this head (2674c4ca) after the PR opened: all four reviewers approved with no findings. One optional simplification was raised, dropping the mode restore in the root branch, and I kept it so every path restores the mode like the sibling tests.