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
This commit is contained in:
sdong 2016-08-10 10:58:15 -07:00
parent 821bcb0b39
commit 4beffe001d

View File

@ -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;