Skip to content

Commit

Permalink
drivers/graphtest: remove temp dirs in case of errors
Browse files Browse the repository at this point in the history
In the default ('go test'), the /tmp/ is typically not on btrfs, and
running the test leaves the temp dirs in place.

Signed-off-by: Han-Wen Nienhuys <[email protected]>
  • Loading branch information
hanwen-flow committed Jan 23, 2025
1 parent 7b9d116 commit 4cc70d4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/graphtest/graphtest_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ func newGraphDriver(t testing.TB, name string, options []string, root string, ru
d, err := graphdriver.GetDriver(name, graphdriver.Options{DriverOptions: options, Root: root, RunRoot: runroot})
if err != nil {
t.Logf("graphdriver: %v\n", err)
os.RemoveAll(runroot)
os.RemoveAll(root)
if errors.Is(err, graphdriver.ErrNotSupported) || errors.Is(err, graphdriver.ErrPrerequisites) || errors.Is(err, graphdriver.ErrIncompatibleFS) {
t.Skipf("Driver %s not supported", name)
}
Expand Down

0 comments on commit 4cc70d4

Please sign in to comment.