Skip to content

tests/functional/stale-file-handle: Skip if the error doesn't happen#409

Merged
cole-h merged 1 commit intomainfrom
fixup-stale-file-handle-test
Mar 31, 2026
Merged

tests/functional/stale-file-handle: Skip if the error doesn't happen#409
cole-h merged 1 commit intomainfrom
fixup-stale-file-handle-test

Conversation

@cole-h
Copy link
Copy Markdown
Member

@cole-h cole-h commented Mar 31, 2026

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

  • Tests
    • Improved test robustness for "Stale file handle" error detection. The test now gracefully skips when the specific error condition cannot be reproduced, rather than failing.

This error no longer seems to occur on Linux 6.19+ anymore. Skip in that
case to fix build.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 31, 2026

📝 Walkthrough

Walkthrough

The 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 skipTest on failure instead of halting the test.

Changes

Cohort / File(s) Summary
Test Error Handling
tests/functional/local-overlay-store/stale-file-handle-inner.sh
Modified test assertion to skip test if "Stale file handle" error cannot be triggered, replacing unconditional failure with conditional skip behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A test once strict, now learns to bend,
When errors hide, we skip, not fail, dear friend!
The stale file vanishes into the night,
Yet still our suite runs steady and bright.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: making the stale-file-handle test skip when the error doesn't occur, which directly addresses the PR's objective.
Linked Issues check ✅ Passed The PR implements the objective from issue #379 by making the test skip when the stale file handle error doesn't occur, preventing build failures on newer kernels.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the stated objective: modifying the stale-file-handle test to skip conditionally; no extraneous modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fixup-stale-file-handle-test

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

@github-actions github-actions bot temporarily deployed to pull request March 31, 2026 14:14 Inactive
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between cb9989b and 72b75c3.

📒 Files selected for processing (1)
  • tests/functional/local-overlay-store/stale-file-handle-inner.sh

Comment on lines +43 to +44
( expectStderr 1 triggerStaleFileHandle | grepQuiet 'Stale file handle' ) || \
skipTest "Couldn't trigger the error"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested change
( 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.

@cole-h cole-h enabled auto-merge March 31, 2026 14:33
@cole-h cole-h added this pull request to the merge queue Mar 31, 2026
Merged via the queue into main with commit 2f1ca41 Mar 31, 2026
28 checks passed
@cole-h cole-h deleted the fixup-stale-file-handle-test branch March 31, 2026 15:28
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.

nix-functional-tests: test failure: local-overlay-store - nix-functional-tests:stale-file-handle

3 participants