Skip to content

add grow-case tests for squashfs and FAT32 copyFilesystems paths#8

Open
eriknordmark wants to merge 1 commit into
diskfs:mainfrom
eriknordmark:grow-coverage-squashfs-and-fat32
Open

add grow-case tests for squashfs and FAT32 copyFilesystems paths#8
eriknordmark wants to merge 1 commit into
diskfs:mainfrom
eriknordmark:grow-coverage-squashfs-and-fat32

Conversation

@eriknordmark
Copy link
Copy Markdown

Summary

Two new tests covering the grow case (target partition larger than source) for the two filesystem types EVE-style partition migrations actually exercise:

TestCopyFilesystemsSquashfs

Builds a real squashfs into a source partition using go-diskfs's writer, then grows it 3× via copyFilesystems. Hits the squashfs branch, exercises the full raw-copy + verifyBlockCopy + squashfs.Read round-trip, with file content verification at the end.

Depends on diskfs/go-diskfs#404. Against the current upstream go-diskfs HEAD (7b44905), this test fails because:

  • squashfs.Finalize writes the squashfs at byte 0 of the disk instead of the partition's byte offset (clobbering the GPT).
  • sync.verifyBlockCopy would reject the grow case afterward because target size > source size.

With #404 applied (Sub-wrapping the backend in squashfs.Create/Read; LimitWriter on both sides in verifyBlockCopy), the test passes:

$ go test -run TestCopyFilesystemsSquashfs ./...
copying data from original partition 1 to new partition 2
partition 1 -> 2: performing raw data copy for filesystem type 2
partition 1 -> 2: contents copied byte for byte, 8388608 bytes copied
partition 1 -> 2: block copy verified
--- PASS: TestCopyFilesystemsSquashfs (0.12s)

TestCopyFilesystemsFat32Grow

Builds a FAT32 source with a known marker file and grows it 4×. Hits the FAT32 branch of copyFilesystems (CreateFilesystem + CopyFileSystem + CompareFS), which the existing TestCopyFilesystems didn't cover — that one uses an equal-sized target.

Does not depend on #404. Passes against unmodified upstream go-diskfs as-is; the FAT32 path uses file-level copy, not the raw-copy / verifyBlockCopy code that #404 touches.

Why this matters

Together, these two tests pin down the two filesystem-copy code paths that real grow workflows hit:

  • squashfs rootfs partitions grown to make room for a larger replacement,
  • ESP (FAT32) partitions grown to fit larger bootloader payloads.

Without them, copyFilesystems' grow behavior was only exercised end-to-end by TestRun, which is currently blocked on a separate go-diskfs ext4 multi-GB CreateFilesystem issue (diskfs/go-diskfs#402) and so doesn't surface regressions in the squashfs/FAT32 paths.

Merge order

This PR should land after diskfs/go-diskfs#404 merges and partitionresizer's go.mod bumps to a version that includes the fix. Until then, CI will report TestCopyFilesystemsSquashfs failing here.

The FAT32 test can be cherry-picked or split out earlier if you'd prefer; happy to follow either path.

Signed-off-by: eriknordmark erik@zededa.com

Two new tests cover the grow case (target larger than source) for the
two filesystem types EVE-style migrations actually exercise:

- TestCopyFilesystemsSquashfs builds a real squashfs into a source
  partition using go-diskfs's writer, then grows it 3x via
  copyFilesystems. Hits the squashfs branch and exercises the full
  raw-copy + verifyBlockCopy + squashfs-read round-trip, with file
  content verification at the end. Requires the upstream go-diskfs
  squashfs partition-offset and verifyBlockCopy grow fixes
  (diskfs/go-diskfs#404).

- TestCopyFilesystemsFat32Grow builds a FAT32 source with a known
  marker file and grows it 4x. Hits the FAT32 branch
  (CreateFilesystem + CopyFileSystem + CompareFS), which the
  existing TestCopyFilesystems didn't exercise — that one uses an
  equal-sized target. Does not depend on the go-diskfs squashfs fix;
  passes against upstream go-diskfs as-is.

Together they pin down the two filesystem-copy paths that drive the
realistic shape of partition-grow workflows (rootfs squashfs grow
and ESP FAT32 grow).

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 4.7 <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