Remove fstest dependency on root package#281
Open
dmcgowan wants to merge 2 commits intocontainerd:mainfrom
Open
Remove fstest dependency on root package#281dmcgowan wants to merge 2 commits intocontainerd:mainfrom
dmcgowan wants to merge 2 commits intocontainerd:mainfrom
Conversation
Replace the fstest package's use of continuity.NewContext, continuity.BuildManifest, and the continuity Resource interfaces with a local directory walker and concrete resource type. This breaks the second-order dependency chain where external consumers of CheckDirectoryEqual (used in ~37 test files across containerd and buildkit) transitively pulled in the entire root package with its manifest, protobuf, and driver machinery. The new walker uses filepath.Walk, crypto/sha256 for content comparison, and platform-specific stat calls for uid/gid, hardlinks, and device info. Signed-off-by: Derek McGowan <derek@mcg.dev>
af32332 to
3ce6856
Compare
Cover CheckDirectoryEqual, CheckDirectoryEqualWithApplier, and buildResources with tests for: identical directories, content differences, extra/missing files, symlinks, symlink target differences, hardlinks, and permission differences. Signed-off-by: Derek McGowan <derek@mcg.dev>
3ce6856 to
5685988
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related to #277
Summary
fstest's use ofcontinuity.NewContext,continuity.BuildManifest, and thecontinuity.Resourceinterfaces with a local directory walker and plain resource structCheckDirectoryEqual(used in ~37 test files across containerd and buildkit) pull in the full root package with its protobuf, manifest, and driver machineryCheckDirectoryEqual,CheckDirectoryEqualWithApplier, and the newbuildResourceswalkerDetails
The
fs/fstestpackage providesCheckDirectoryEqualfor comparing two directory trees in tests. Previously this worked by building full continuity manifests (context + manifest + protobuf resources), which dragged in the entire rootcontinuitypackage as a dependency. Any external repo importingfs/fstestfor test helpers transitively required protobuf, the driver framework, digest libraries, and other machinery unrelated to simple directory comparison.The new implementation replaces this with:
walker.go— afilepath.Walk-based directory walker that produces a sorted[]resourcelist with path, mode, uid/gid, size, SHA256 content hash, symlink target, and device major/minorwalker_unix.go/walker_windows.go— platform-specific stat, hardlink detection, and device info extractioncontinuity_util.go— updated diff and comparison functions operating on the concreteresourcetype instead ofcontinuity.ResourceinterfacesThe comparison behavior is preserved:
// TODOin old code) and remain uncomparedTest plan
compare_test.gocover: identical directories, content differences, extra/missing files, symlinks, symlink target differences, hardlinks, permission differences, applier-based comparison, andbuildResourcesoutput validationgo test ./fs/fstest/passesfs/test suite (TestDirectoryCompare, copy tests usingCheckDirectoryEqual) continues to pass