Skip to content

fix test cleanup: ignore deletion errors and propagate panics properly#27

Merged
cathay4t merged 1 commit into
rust-netlink:mainfrom
cathay4t:main
May 24, 2026
Merged

fix test cleanup: ignore deletion errors and propagate panics properly#27
cathay4t merged 1 commit into
rust-netlink:mainfrom
cathay4t:main

Conversation

@cathay4t

Copy link
Copy Markdown
Member

Replace assert-based cleanup with straightforward deletion calls and
explicit panic propagation via resume_unwind. This ensures that
cleanup failures don't mask test results, and panicked tests properly
unwind through the cleanup code.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request modifies the error handling in several test files, including bond, bridge, and vlan tests, by replacing standard assertions with std::panic::resume_unwind after cleanup steps. The reviewer identified a significant issue where the cleanup logic still utilizes exec_cmd, which panics on failure. If a test fails and the subsequent cleanup also fails, it will trigger a double-panic and cause a process abort, preventing the test runner from reporting the original failure. It is recommended to use a non-panicking command execution method for cleanup to ensure it remains best-effort and does not mask test results.

Comment thread src/ip/link/tests/bond.rs
Comment thread src/ip/link/tests/bridge.rs
Comment thread src/ip/link/tests/dummy.rs
Comment thread src/ip/link/tests/nlmon.rs
Comment thread src/ip/link/tests/vlan.rs
Comment thread src/ip/link/tests/vxlan.rs
Replace assert-based cleanup with ignored deletion results and
explicit panic propagation via resume_unwind. This ensures that
cleanup failures don't mask test results, and panicked tests properly
unwind through the cleanup code.

Signed-off-by: Gris Ge <cnfourt@gmail.com>
@cathay4t cathay4t enabled auto-merge (rebase) May 24, 2026 13:20
@cathay4t cathay4t merged commit 40f12dd into rust-netlink:main May 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant