Skip to content

Commit 96fbe5b

Browse files
Fix layer comparison and enable read-only checks
fstest.CheckDirectoryEqual checks if any files in the diff matches a list of known metadataFiles. This only happens if we specify the initial layer as the first parameter and the mutated layer as the second. This also enables the read-only view checks, as the bind filter allows us to mount a layer as ro. Signed-off-by: Gabriel Adrian Samfira <[email protected]>
1 parent 279e0d3 commit 96fbe5b

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

snapshots/testsuite/testsuite.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -796,10 +796,6 @@ func checkRemove(ctx context.Context, t *testing.T, snapshotter snapshots.Snapsh
796796
// checkSnapshotterViewReadonly ensures a KindView snapshot to be mounted as a read-only filesystem.
797797
// This function is called only when WithTestViewReadonly is true.
798798
func checkSnapshotterViewReadonly(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshotter, work string) {
799-
if runtime.GOOS == "windows" {
800-
t.Skip("Read-only protection on views is not supported on WCOW")
801-
}
802-
803799
preparing := filepath.Join(work, "preparing")
804800
if _, err := snapshotter.Prepare(ctx, preparing, "", opt); err != nil {
805801
t.Fatal(err)
@@ -946,7 +942,7 @@ func check128LayersMount(name string) func(ctx context.Context, t *testing.T, sn
946942

947943
t.Log("mount", preparing)
948944

949-
if err := fstest.CheckDirectoryEqual(preparing, flat); err != nil {
945+
if err := fstest.CheckDirectoryEqual(flat, preparing); err != nil {
950946
testutil.Unmount(t, preparing)
951947
t.Fatalf("[layer %d] preparing doesn't equal to flat before apply: %+v", i, err)
952948
}
@@ -961,7 +957,7 @@ func check128LayersMount(name string) func(ctx context.Context, t *testing.T, sn
961957
t.Fatalf("[layer %d] failed to apply on preparing dir: %+v", i, err)
962958
}
963959

964-
if err := fstest.CheckDirectoryEqual(preparing, flat); err != nil {
960+
if err := fstest.CheckDirectoryEqual(flat, preparing); err != nil {
965961
testutil.Unmount(t, preparing)
966962
t.Fatalf("[layer %d] preparing doesn't equal to flat after apply: %+v", i, err)
967963
}
@@ -990,7 +986,7 @@ func check128LayersMount(name string) func(ctx context.Context, t *testing.T, sn
990986
}
991987
defer testutil.Unmount(t, view)
992988

993-
if err := fstest.CheckDirectoryEqual(view, flat); err != nil {
989+
if err := fstest.CheckDirectoryEqual(flat, view); err != nil {
994990
t.Fatalf("fullview should equal to flat: %+v", err)
995991
}
996992
}

0 commit comments

Comments
 (0)