Deflake gofer_test.

We must wait for all lazy resources to be released before closing the rootFile.

PiperOrigin-RevId: 226419499
Change-Id: I1d4d961a92b3816e02690cf3eaf0a88944d730cc
This commit is contained in:
Nicolas Lacasse
2018-12-20 17:23:26 -08:00
committed by Shentubot
parent f6274804e1
commit 8ba450363f
+7 -1
View File
@@ -68,7 +68,13 @@ func rootTest(t *testing.T, name string, cp cachePolicy, fn func(context.Context
// Ensure that the cache is fully invalidated, so that any
// close actions actually take place before the full harness is
// torn down.
defer m.FlushDirentRefs()
defer func() {
m.FlushDirentRefs()
// Wait for all resources to be released, otherwise the
// operations may fail after we close the rootFile.
fs.AsyncBarrier()
}()
// Execute the test.
fn(ctx, h, root, rootInode)