From 4beffe001db952a7a842b7068fd4939e696e91b9 Mon Sep 17 00:00:00 2001 From: sdong Date: Wed, 10 Aug 2016 10:58:15 -0700 Subject: [PATCH] Fix test data race in two FaultInjectionTest tests Summary: Background sleeping tasks may conflict with test cleaning up. Wait for the sleeping tasks to finish before ending the test. Test Plan: Run these tests. Reviewers: andrewkr, yiwu Reviewed By: yiwu Subscribers: leveldb, andrewkr, dhruba Differential Revision: https://reviews.facebook.net/D61827 --- db/fault_injection_test.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/fault_injection_test.cc b/db/fault_injection_test.cc index 0883de77b..d4d4932aa 100644 --- a/db/fault_injection_test.cc +++ b/db/fault_injection_test.cc @@ -405,6 +405,7 @@ TEST_P(FaultInjectionTest, WriteOptionSyncTest) { env_->SetFilesystemActive(false); NoWriteTestReopenWithFault(kResetDropAndDeleteUnsynced); sleeping_task_low.WakeUp(); + sleeping_task_low.WaitUntilDone(); ASSERT_OK(OpenDB()); std::string val; @@ -489,6 +490,7 @@ TEST_P(FaultInjectionTest, ManualLogSyncTest) { env_->SetFilesystemActive(false); NoWriteTestReopenWithFault(kResetDropAndDeleteUnsynced); sleeping_task_low.WakeUp(); + sleeping_task_low.WaitUntilDone(); ASSERT_OK(OpenDB()); std::string val;