tests/functional/stale-file-handle: Skip if the error doesn't happen#409
tests/functional/stale-file-handle: Skip if the error doesn't happen#409
Conversation
This error no longer seems to occur on Linux 6.19+ anymore. Skip in that case to fix build.
📝 WalkthroughWalkthroughThe test for detecting "Stale file handle" errors in local overlay store now gracefully skips when unable to trigger the condition, rather than failing unconditionally. The assertion is wrapped in a conditional that calls Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/functional/local-overlay-store/stale-file-handle-inner.sh`:
- Around line 43-44: Don't treat any pipeline failure as a skip; run
expectStderr 1 triggerStaleFileHandle and inspect individual exit statuses so
only a missing "Stale file handle" match causes a skip. Concretely, capture the
pipeline outputs (or use bash's PIPESTATUS after running: expectStderr 1
triggerStaleFileHandle | grepQuiet 'Stale file handle'), then if expectStderr
(the producer) failed, fail the test instead of skipping; if expectStderr
succeeded but grepQuiet failed, call skipTest "Couldn't trigger the error". Use
the unique commands expectStderr, triggerStaleFileHandle and skipTest and rely
on PIPESTATUS (or save and check exit codes) to distinguish which stage failed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 845d2475-d7f7-42ab-89b0-c7f0d108765c
📒 Files selected for processing (1)
tests/functional/local-overlay-store/stale-file-handle-inner.sh
| ( expectStderr 1 triggerStaleFileHandle | grepQuiet 'Stale file handle' ) || \ | ||
| skipTest "Couldn't trigger the error" |
There was a problem hiding this comment.
Skip condition is too broad and can hide real regressions.
At Line 43, (... ) || skipTest ... turns any pipeline failure into a skip, including unexpected failures unrelated to kernel behavior. That weakens signal from this test.
Proposed tightening
-( expectStderr 1 triggerStaleFileHandle | grepQuiet 'Stale file handle' ) || \
- skipTest "Couldn't trigger the error"
+if output="$(triggerStaleFileHandle 2>&1)"; then
+ # Reproducer no longer triggers on newer kernels.
+ skipTest "Couldn't trigger the error"
+elif printf '%s\n' "$output" | grepQuiet 'Stale file handle'; then
+ :
+else
+ echo "$output" >&2
+ echo "Unexpected failure while triggering stale file handle" >&2
+ exit 1
+fi📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ( expectStderr 1 triggerStaleFileHandle | grepQuiet 'Stale file handle' ) || \ | |
| skipTest "Couldn't trigger the error" | |
| if output="$(triggerStaleFileHandle 2>&1)"; then | |
| # Reproducer no longer triggers on newer kernels. | |
| skipTest "Couldn't trigger the error" | |
| elif printf '%s\n' "$output" | grepQuiet 'Stale file handle'; then | |
| : | |
| else | |
| echo "$output" >&2 | |
| echo "Unexpected failure while triggering stale file handle" >&2 | |
| exit 1 | |
| fi |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/functional/local-overlay-store/stale-file-handle-inner.sh` around lines
43 - 44, Don't treat any pipeline failure as a skip; run expectStderr 1
triggerStaleFileHandle and inspect individual exit statuses so only a missing
"Stale file handle" match causes a skip. Concretely, capture the pipeline
outputs (or use bash's PIPESTATUS after running: expectStderr 1
triggerStaleFileHandle | grepQuiet 'Stale file handle'), then if expectStderr
(the producer) failed, fail the test instead of skipping; if expectStderr
succeeded but grepQuiet failed, call skipTest "Couldn't trigger the error". Use
the unique commands expectStderr, triggerStaleFileHandle and skipTest and rely
on PIPESTATUS (or save and check exit codes) to distinguish which stage failed.
This error no longer seems to occur on Linux 6.19+ anymore. Skip in that case to fix build.
Motivation
Backport of NixOS#15572
Fixes #379
Context
Summary by CodeRabbit