Skip to content

Commit cbc61fa

Browse files
authored
fix: false success in unmount flow (#182)
1 parent b8f47b0 commit cbc61fa

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

unmount_linux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ func unmount(dir string) error {
1313
if strings.HasPrefix(dir, "/dev/fd/") {
1414
return fmt.Errorf("%w: %s", ErrExternallyManagedMountPoint, err)
1515
}
16+
return err
1617
}
1718
return nil
1819
}

unmount_linux_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ func Test_umountNoCustomError(t *testing.T) {
1818
t.Setenv("PATH", "") // Clear PATH to fail unmount with fusermount is not found
1919

2020
err := unmount("/dev")
21-
if err != nil && errors.Is(err, ErrExternallyManagedMountPoint) {
22-
t.Errorf("Not expected custom error.")
21+
if err == nil {
22+
t.Fatal("Expected error but got none.")
23+
}
24+
if errors.Is(err, ErrExternallyManagedMountPoint) {
25+
t.Error("Custom error was not expected.")
2326
}
2427
}

0 commit comments

Comments
 (0)