diff options
author | Spencer T Brody <spencer@mongodb.com> | 2020-09-01 20:56:44 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-02 18:41:47 +0000 |
commit | 64c64ccdb09203532faf2c07ea38b8972ee2c16b (patch) | |
tree | 3e622c77715525f312756f23101e829fe4427107 /src | |
parent | 7acaf5a8297d3f3b3d7bca656ec6f46419014122 (diff) | |
download | mongo-64c64ccdb09203532faf2c07ea38b8972ee2c16b.tar.gz |
SERVER-50691 Fix race in PrimaryOnlyServiceTest::LookupInstance
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/repl/primary_only_service_test.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mongo/db/repl/primary_only_service_test.cpp b/src/mongo/db/repl/primary_only_service_test.cpp index 1d4242ae012..076a5613181 100644 --- a/src/mongo/db/repl/primary_only_service_test.cpp +++ b/src/mongo/db/repl/primary_only_service_test.cpp @@ -333,17 +333,17 @@ TEST_F(PrimaryOnlyServiceTest, BasicCreateInstance) { } TEST_F(PrimaryOnlyServiceTest, LookupInstance) { - TestServiceHangDuringCompletion.setMode(FailPoint::alwaysOn); + // Make sure the instance doesn't complete before we try to look it up. + TestServiceHangDuringInitialization.setMode(FailPoint::alwaysOn); auto instance = TestService::Instance::getOrCreate(_service, BSON("_id" << 0 << "state" << 0)); ASSERT(instance.get()); ASSERT_EQ(0, instance->getID()); - auto instance2 = TestService::Instance::lookup(_service, BSON("_id" << 0)); + auto instance2 = TestService::Instance::lookup(_service, BSON("_id" << 0)).get(); - ASSERT(instance2.get()); - ASSERT_EQ(instance.get(), instance2.get().get()); + ASSERT_EQ(instance.get(), instance2.get()); - TestServiceHangDuringCompletion.setMode(FailPoint::off); + TestServiceHangDuringInitialization.setMode(FailPoint::off); instance->getCompletionFuture().get(); // Shouldn't be able to look up instance after it has completed running. |