This repository was archived by the owner on Nov 8, 2026. It is now read-only.
Repository navigation
test: direct package coverage for differ, loop and mountutils - #44
Merged
Merged
Conversation
…geFile The package's mount paths were exercised only cross-package from internal/snapshotter tests, which doesn't count toward this package's coverage and left regressions invisible in per-package reports. Add root-gated in-package tests: plain mount.All path with partial-mount unwind, real multi-device EROFS mounts (two mkfs-built layers merged into an fsmeta) with loop-release verification, the sibling-mount guard, loop setup failure cleanup, read-only ext4 mounting with lock lifecycle, and both VM-in-use detection branches (flock and QEMU-style OFD locks). MountAll 0% -> 87.5%, MountExt4 0% -> 85.0%, lockImageFile 0% -> 86.7%; package 91.7%. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
FindBySerial had no coverage at all; Detach/DetachPath/GetInfo error and already-detached paths were untested. Add tests for double-detach (ENXIO), non-loop files (ENOTTY), unopenable paths, detached-device GetInfo, backing-file lookups (hit and miss, including the deleted-cwd filepath.Abs fallback), read-only and DirectIO setups, and serial-based cleanup (skipping gracefully on kernels without loop serial sysfs support, like the Docker test kernel). Package coverage 78.1% -> 81.2%; Detach and GetInfo at 100%. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Apply and every with*Mount helper were exercised only from internal/snapshotter tests. Add in-package tests: Apply tar conversion (uncompressed and gzip) and the native EROFS copy path (copyBlobAtomic incl. read-error cleanup), stacked per-layer EROFS mounts merged via read-only overlay (newest-wins asserted), multi-device fsmeta mounts built with the exact generateFsMeta invocation, ext4-only upper routing (diff root is upper/, never the raw ext4 root) including the unexpected-root-entries warning and the empty-upper case, the active snapshot overlay with whiteout handling, ensureUncompressedLabel update semantics, and all writeCompressedDiff compressor error branches. Apply 27.7% -> 76.6%; all previously-0% functions covered; package 78.9%. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
'task coverage' runs the root test suite in Docker with -coverpkg=./internal/..., so coverage earned cross-package (e.g. snapshotter tests driving mountutils) is attributed correctly - the per-package numbers CI/codecov report without it significantly understate real coverage. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the per-package coverage gap in
differ,loopandmountutils(+1660 test lines).Root cause analysis
Most of the "very low" numbers were a measurement artifact: CI runs
go test ./...without-coverpkg, so coverage earned cross-package (snapshotter's differ tests drivemountutils.MountAll/MountExt4heavily) is not attributed. With cross-package attribution, mountutils was already at ~85% average. The genuine gaps were 5 functions at absolute 0% plusApplyat 27%.Changes
MountAll(plain path with partial-mount unwind, real multi-device EROFS mounts with loop-release verification, sibling guard, loop-failure cleanup),MountExt4(read-only mount + lock lifecycle, mount-failure resource release) andlockImageFile(flock and QEMU-style OFD conflict branches →ErrFailedPrecondition).Detach/GetInfoat 100%): detach idempotence (ENXIO), non-loop/unopenable paths, backing-file lookups incl. the deleted-cwd fallback, read-only/DirectIO setups, serial-based cleanup (skips gracefully on kernels without loop-serial sysfs, like the linuxkit Docker kernel).Apply27.7% → 76.6%, every 0% function covered, package 78.9%): in-package tests for tar and native-EROFS Apply (incl.copyBlobAtomicerror cleanup), stacked-layer overlay merging (newest-wins), multi-device fsmeta mounts, ext4-only upper routing + root-entry warnings, active-snapshot overlay with whiteouts, label semantics, and all compressor error branches.task coverage: new target running the root suite in Docker with-coverpkg=./internal/...for honest cross-package numbers locally.Final per-package coverage (Linux root run)
All root tests verified in the privileged Docker image (mkfs.erofs/mkfs.ext4/loop devices); no loop or mount leaks (asserted per test). Lint clean on golangci-lint 2.11 and 2.12.
Follow-up needing maintainer approval
Adding
-coverpkg=./internal/...to the CI coverage invocation inci.ymlwould make codecov report attribution-correct numbers (snapshotter currently gets no credit for the mountutils/differ paths it exercises). One-line change, left out because CI workflow edits require explicit approval.🤖 Generated with Claude Code