tests: fix build failure on Go 1.15 and older

These don't have os.ReadDir yet.

Error was:

	Error: vet: tests/defaults/overlayfs_test.go:104:15: ReadDir not declared by package os
This commit is contained in:
Jakob Unterwurzacher 2022-01-22 16:07:59 +01:00
parent 696f11499b
commit 47358938ec

View File

@ -50,7 +50,12 @@ func TestRenameWhiteout(t *testing.T) {
t.Error(err)
}
// readdir should not choke on leftover or missing .name files
_, err = os.ReadDir(test_helpers.DefaultPlainDir)
dir, err := os.Open(test_helpers.DefaultPlainDir)
if err != nil {
t.Fatal(err)
}
defer dir.Close()
_, err = dir.Readdir(0)
if err != nil {
t.Error(err)
}
@ -101,7 +106,12 @@ func TestRenameExchange(t *testing.T) {
t.Error(err)
}
// readdir should not choke on leftover or missing .name files
_, err = os.ReadDir(test_helpers.DefaultPlainDir)
dir, err := os.Open(test_helpers.DefaultPlainDir)
if err != nil {
t.Fatal(err)
}
defer dir.Close()
_, err = dir.Readdir(0)
if err != nil {
t.Error(err)
}