mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #15422 from kolyshkin/graphtest-fix
graphtest: filter out lost+found dir entry
This commit is contained in:
commit
0bfad28b86
1 changed files with 21 additions and 2 deletions
|
@ -151,6 +151,25 @@ func verifyFile(t *testing.T, path string, mode os.FileMode, uid, gid uint32) {
|
|||
|
||||
}
|
||||
|
||||
// readDir reads a directory just like ioutil.ReadDir()
|
||||
// then hides specific files (currently "lost+found")
|
||||
// so the tests don't "see" it
|
||||
func readDir(dir string) ([]os.FileInfo, error) {
|
||||
a, err := ioutil.ReadDir(dir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
b := a[:0]
|
||||
for _, x := range a {
|
||||
if x.Name() != "lost+found" { // ext4 always have this dir
|
||||
b = append(b, x)
|
||||
}
|
||||
}
|
||||
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// DriverTestCreateEmpty creates an new image and verifies it is empty and the right metadata
|
||||
func DriverTestCreateEmpty(t *testing.T, drivername string) {
|
||||
driver := GetDriver(t, drivername)
|
||||
|
@ -172,7 +191,7 @@ func DriverTestCreateEmpty(t *testing.T, drivername string) {
|
|||
verifyFile(t, dir, 0755|os.ModeDir, 0, 0)
|
||||
|
||||
// Verify that the directory is empty
|
||||
fis, err := ioutil.ReadDir(dir)
|
||||
fis, err := readDir(dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -231,7 +250,7 @@ func verifyBase(t *testing.T, driver graphdriver.Driver, name string) {
|
|||
file := path.Join(dir, "a file")
|
||||
verifyFile(t, file, 0222|os.ModeSetuid, 0, 0)
|
||||
|
||||
fis, err := ioutil.ReadDir(dir)
|
||||
fis, err := readDir(dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue