8000 ci: add nightly NFS and Docker lock tests (#324) by adityamukho · Pull Request #333 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

ci: add nightly NFS and Docker lock tests (#324) - #333

Merged
adityamukho merged 4 commits into
mainfrom
nfs-docker-lock-tests
Aug 23, 2026
Merged

adityamukho merged 4 commits into
mainfrom
nfs-docker-lock-tests

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Summary

Tiers 2 and 3 from the kernel file-locking design
(docs/superpowers/specs/2026-08-22-kernel-file-locking-design.md),
deferred from #317/#332: the per-PR suite (tests/pid_namespace_test.rs)
covers PID namespaces but cannot reach how std::fs::File::try_lock
behaves on a network filesystem or in real containers.

  • tests/nfs_lock_test.rs — asserts the core ci: nightly file-locking tests on NFS and in containers #324 property on a loopback
    NFSv4 mount and an NFSv3 mount without lockd: a lock held by one
    process must never let a second process also believe it holds it (a
    silent no-op must fail the build). Also proves allow_unlocked is
    consulted only on a mount that cannot lock at all, never to bypass a
    live lock.
  • tests/docker_lock_test.rs — runs the FileLock refuses stale lock under PID namespaces (Kubernetes): every container is PID 1 #317 regression shape (a killed
    holder's replacement must still be able to open) across two containers
    sharing a Docker volume, matching the original report literally.
  • Both reuse examples/pid_ns_helper.rs, which gains an explicit mode
    match (an unrecognized mode now fails loudly instead of silently
    behaving like open) and a new open-unlocked mode.
  • .github/workflows/nfs-lock.yml — new nightly workflow (+
    workflow_dispatch) provisioning the loopback NFS export and running
    both suites, with the same failure-tracking-issue convention as
    fuzz.yml/property-tests.yml.

Test plan

  • cargo test --lib — 678 passed
  • cargo test (full suite) — all 36 test binaries pass, 0 failed
  • cargo fmt --check, cargo clippy --all-features -- -D warnings (CI's exact invocation) — clean
  • Locally verifiable pieces TDD'd: mode validation, open-unlocked on
    an ordinary filesystem, docker_available() correctly reporting
    false in this sandbox (no Docker, no root)
  • The NFS- and Docker-gated assertions need root and a container
    runtime this sandbox doesn't have — will dispatch nfs-lock.yml
    manually once it's on a ref GitHub can run it from, to verify for
    real on an Actions runner

Closes #324

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU

adityamukho and others added 4 commits August 22, 2026 23:10
Tiers 2 and 3 from the kernel file-locking design, deferred from #317/#332:
the per-PR suite covers PID namespaces but cannot reach how
std::fs::File::try_lock behaves on a network filesystem or in real
containers.

tests/nfs_lock_test.rs asserts the core #324 property on a loopback NFSv4
mount and an NFSv3 mount without lockd: a lock held by one process must
never let a second process also believe it holds it. It also proves
allow_unlocked is consulted only on a mount that cannot lock at all, never
to bypass a live lock. tests/docker_lock_test.rs runs the same #317
regression shape (a killed holder's replacement must still be able to
open) across two containers sharing a Docker volume, matching the
original report literally.

Both reuse examples/pid_ns_helper.rs, which gains an explicit mode match
(an unrecognized mode now fails loudly instead of silently behaving like
"open") and a new open-unlocked mode.

Locally verifiable pieces (mode validation, open-unlocked on an ordinary
filesystem, docker_available() reflecting a sandbox with no Docker) are
covered by TDD here. The NFS- and Docker-gated assertions need root and a
container runtime this sandbox doesn't have; they skip cleanly without
their environment and are exercised for real by the new
.github/workflows/nfs-lock.yml nightly workflow, which also records
failures as tracking issues, matching fuzz.yml/property-tests.yml.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU
test_docker_availability_check_reflects_this_sandbox asserted docker was
never reachable, true only in the local sandbox this branch was written
in. GitHub's ubuntu-latest runners have Docker preinstalled and running,
so the assertion failed there -- while, in the same run, the two real
gated tests it was meant to backstop actually exercised Docker for real
and passed. Those two are the genuine proof; this one just encoded an
environment assumption as a hard failure.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU
cargo tarpaulin does not build examples/ before running tests, unlike
plain cargo test. tests/nfs_lock_test.rs and tests/docker_lock_test.rs
resolve examples/pid_ns_helper relative to the test binary's own target
dir, so it must already be built. tests/pid_namespace_test.rs never hit
this because it skips before reaching that check when unshare isn't
available in tarpaulin's environment; the new tests don't have an
equivalent early-out.

Reproduced and verified the fix locally with cargo tarpaulin directly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU
cargo tarpaulin deletes target/debug/examples/ as part of its own
instrumented build, regardless of when it was built -- a plain
`cargo build --examples` step before the tarpaulin run doesn't survive
it. Reproduced locally against cargo-tarpaulin 0.35.2 from a clean
checkout: the previous fix (build-examples-first) still failed with
"helper binary not found", and target/debug/examples/ was empty after
tarpaulin ran.

nfs_lock_test.rs and docker_lock_test.rs now check
MINIGRAF_PID_NS_HELPER before falling back to the current_exe()-derived
path. coverage.yml builds the helper into an isolated --target-dir
tarpaulin never touches and points the variable at it. Verified against
a clean checkout with cargo tarpaulin directly: both suites pass.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU
@codecov
codecov Bot commented Aug 23, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit c4ac994 into main Aug 23, 2026
17 checks passed
@adityamukho
adityamukho deleted the nfs-docker-lock-tests branch August 23, 2026 04:00
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.

ci: nightly file-locking tests on NFS and in containers

1 participant

0