From 1be571b14f964dd709389ef84e8d587f4cf5ad02 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Sat, 13 May 2023 00:11:04 -0700 Subject: [PATCH] Add sync before unmount on snapshotter layer test Signed-off-by: Derek McGowan --- snapshots/testsuite/testsuite.go | 1 + snapshots/testsuite/testsuite_unix.go | 10 +++++++++- snapshots/testsuite/testsuite_windows.go | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/snapshots/testsuite/testsuite.go b/snapshots/testsuite/testsuite.go index 36982adab..7afbd953e 100644 --- a/snapshots/testsuite/testsuite.go +++ b/snapshots/testsuite/testsuite.go @@ -959,6 +959,7 @@ func check128LayersMount(name string) func(ctx context.Context, t *testing.T, sn t.Fatalf("[layer %d] preparing doesn't equal to flat after apply: %+v", i, err) } + sync() testutil.Unmount(t, preparing) parent = filepath.Join(work, fmt.Sprintf("committed-%d", i)) diff --git a/snapshots/testsuite/testsuite_unix.go b/snapshots/testsuite/testsuite_unix.go index 46a974b71..8a274ce24 100644 --- a/snapshots/testsuite/testsuite_unix.go +++ b/snapshots/testsuite/testsuite_unix.go @@ -18,7 +18,11 @@ package testsuite -import "syscall" +import ( + "syscall" + + "golang.org/x/sys/unix" +) func clearMask() func() { oldumask := syscall.Umask(0) @@ -26,3 +30,7 @@ func clearMask() func() { syscall.Umask(oldumask) } } + +func sync() { + unix.Sync() +} diff --git a/snapshots/testsuite/testsuite_windows.go b/snapshots/testsuite/testsuite_windows.go index a3cb82fbf..382a85978 100644 --- a/snapshots/testsuite/testsuite_windows.go +++ b/snapshots/testsuite/testsuite_windows.go @@ -19,3 +19,5 @@ package testsuite func clearMask() func() { return func() {} } + +func sync() {}