From 8538e7a2ac700cfe788e5eea709fd31521bad8d9 Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Tue, 4 Apr 2023 12:07:34 -0700 Subject: [PATCH] Improve error messages and remove check * Improve error messages * remove a check for the existance of unmount target. We probably should not mask that the target was missing. Signed-off-by: Gabriel Adrian Samfira --- mount/mount_windows.go | 8 -------- snapshots/testsuite/issues.go | 2 +- snapshots/testsuite/testsuite.go | 2 +- snapshots/windows/windows.go | 2 +- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/mount/mount_windows.go b/mount/mount_windows.go index b86ba0d7a..855d78c02 100644 --- a/mount/mount_windows.go +++ b/mount/mount_windows.go @@ -132,14 +132,6 @@ func (m *Mount) GetParentPaths() ([]string, error) { // Unmount the mount at the provided path func Unmount(mount string, flags int) error { - if _, err := os.Stat(mount); err != nil { - if os.IsNotExist(err) { - return nil - } - - return fmt.Errorf("failed to access mount point %s: %w", mount, err) - } - mount = filepath.Clean(mount) adsFile := mount + ":" + sourceStreamName var layerPath string diff --git a/snapshots/testsuite/issues.go b/snapshots/testsuite/issues.go index 92a04526e..df6eb4848 100644 --- a/snapshots/testsuite/issues.go +++ b/snapshots/testsuite/issues.go @@ -96,7 +96,7 @@ func checkRemoveDirectoryInLowerLayer(ctx context.Context, t *testing.T, sn snap // see https://github.com/docker/docker/issues/28391 overlay2 func checkChown(ctx context.Context, t *testing.T, sn snapshots.Snapshotter, work string) { if runtime.GOOS == "windows" { - t.Skip("Chown is not supported on WCOW") + t.Skip("Chown is not supported on Windows") } l1Init := fstest.Apply( fstest.CreateDir("/opt", 0700), diff --git a/snapshots/testsuite/testsuite.go b/snapshots/testsuite/testsuite.go index 0eee9938d..36982adab 100644 --- a/snapshots/testsuite/testsuite.go +++ b/snapshots/testsuite/testsuite.go @@ -877,7 +877,7 @@ func closeTwice(ctx context.Context, t *testing.T, snapshotter snapshots.Snapsho func checkRootPermission(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshotter, work string) { if runtime.GOOS == "windows" { - t.Skip("Filesystem permissions are not supported on WCOW") + t.Skip("Filesystem permissions are not supported on Windows") } preparing, err := snapshotterPrepareMount(ctx, snapshotter, "preparing", "", work) diff --git a/snapshots/windows/windows.go b/snapshots/windows/windows.go index 4b89afe44..8e79f10e7 100644 --- a/snapshots/windows/windows.go +++ b/snapshots/windows/windows.go @@ -356,7 +356,7 @@ func (s *snapshotter) createSnapshot(ctx context.Context, kind snapshots.Kind, k // Create the new snapshot dir snDir := s.getSnapshotDir(newSnapshot.ID) if err = os.MkdirAll(snDir, 0700); err != nil { - return fmt.Errorf("creating snapshot dir: %w", err) + return fmt.Errorf("failed to create snapshot dir %s: %w", snDir, err) } if strings.Contains(key, snapshots.UnpackKeyPrefix) {