Skip to content

fslock: tests for what a pending delete does to a Lock - #9

Open
bheni wants to merge 1 commit into
fulghum/windows-delete-pendingfrom
bh/delete-pending-tests
Open

bheni wants to merge 1 commit into
fulghum/windows-delete-pendingfrom
bh/delete-pending-tests

Conversation

@bheni

@bheni bheni commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Stacked on #8. Adds Windows-only tests in lock_windows_pending_test.go; no code changes.

Windows CI is expected to fail on this PR. The tests have only been compile-checked (GOOS=windows go vet), not run, so the expectations below are predictions from reading the code.

Test What it checks Expected on #8
TestLockUsableAfterDeletePending A Lock that met a pending delete works again once the delete finishes. reopen leaves it closed, so the next TryLock should report "lock is closed". Fail
TestWaitOutlastsDeletePending LockWithTimeout(10s) waits out a delete that finishes 50ms later instead of returning os.ErrNotExist at once. Fail
TestDeletePendingIsTemporary A pending delete can be told apart from a missing parent directory. Both are Kind Failed wrapping os.ErrNotExist, and IsTemporary is false for both. Fail
TestRacingRemoveWhileHeld The pattern that failed in Dolt's CI: four cleaners take lock files and os.Remove them while held, racing a creator, with Dolt's 100ms retry on access denied. Unknown

The first three encode design opinions: the lock should recover, waits should wait, and the error should be distinguishable.

The fourth is there to test the diagnosis behind #8. The first commit of #8 showed that os.Remove of a held lock file on windows-latest does not leave the name delete-pending (New(deleted) = <nil>), and os.Remove is what Dolt uses.

It is a race test, so one green run proves little.

🤖 Generated with Claude Code

Three of these are expected to fail on Windows as the code stands: a Lock
that meets a pending delete stays closed after the delete finishes, a
waiting acquire fails instead of waiting it out, and the error cannot be
told apart from a missing directory.

The fourth runs the pattern that failed in Dolt's CI, lock files removed
with os.Remove while held, to find out whether a pending delete is what
caused it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.

1 participant