diff --git a/samples/memfs/memfs_test.go b/samples/memfs/memfs_test.go index e332107..6030236 100644 --- a/samples/memfs/memfs_test.go +++ b/samples/memfs/memfs_test.go @@ -734,12 +734,16 @@ func (t *MemFSTest) Rmdir_OpenedForReading() { // https://github.com/bazillion/fuse/issues/66 // ExpectEq(0, fi.Sys().(*syscall.Stat_t).Nlink) - // Attempt to read from the directory. This should succeed even though it has - // been unlinked, and we shouldn't see any junk from the new directory. + // Attempt to read from the directory. This shouldn't see any junk from the + // new directory. It should either succeed with an empty result or should + // return ENOENT. entries, err := f.Readdir(0) - AssertEq(nil, err) - ExpectThat(entries, ElementsAre()) + if err != nil { + ExpectThat(err, Error(HasSubstr("no such file"))) + } else { + ExpectThat(entries, ElementsAre()) + } } func (t *MemFSTest) CaseSensitive() { diff --git a/samples/memfs/posix_test.go b/samples/memfs/posix_test.go index 1cbd283..4e10718 100644 --- a/samples/memfs/posix_test.go +++ b/samples/memfs/posix_test.go @@ -354,10 +354,14 @@ func (t *PosixTest) RmdirWhileOpenedForReading() { ExpectEq("dir", fi.Name()) ExpectEq(0, fi.Sys().(*syscall.Stat_t).Nlink) - // Attempt to read from the directory. This should succeed even though it has - // been unlinked, and we shouldn't see any junk from the new directory. + // Attempt to read from the directory. This shouldn't see any junk from the + // new directory. It should either succeed with an empty result or should + // return ENOENT. entries, err := f.Readdir(0) - AssertEq(nil, err) - ExpectThat(entries, ElementsAre()) + if err != nil { + ExpectThat(err, Error(HasSubstr("no such file"))) + } else { + ExpectThat(entries, ElementsAre()) + } }