summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2018-12-20 17:22:15 -0800
committerShentubot <shentubot@google.com>2018-12-20 17:23:26 -0800
commit8ba450363fed5aa44676c23b737404c52da26a5f (patch)
tree6a33b37bd28227f33b0f3e356fe8e85525136046
parentf6274804e14ece853c952cb71fde73dfb06b733a (diff)
Deflake gofer_test.
We must wait for all lazy resources to be released before closing the rootFile. PiperOrigin-RevId: 226419499 Change-Id: I1d4d961a92b3816e02690cf3eaf0a88944d730cc
-rw-r--r--pkg/sentry/fs/gofer/gofer_test.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/sentry/fs/gofer/gofer_test.go b/pkg/sentry/fs/gofer/gofer_test.go
index b450778ca..36201f017 100644
--- a/pkg/sentry/fs/gofer/gofer_test.go
+++ b/pkg/sentry/fs/gofer/gofer_test.go
@@ -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)