summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp')
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp
index 23b9df8e219..7bbe9000bc7 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp
@@ -1348,12 +1348,11 @@ TEST_F(PrimaryCatchUpTest, PrimaryStepsDownDuringFreshnessScan) {
ASSERT_TRUE(evh.isValid());
getReplExec()->waitForEvent(evh);
ASSERT_TRUE(getReplCoord()->getMemberState().secondary());
- ASSERT_FALSE(getReplCoord()->isCatchingUp());
- ASSERT_FALSE(getReplCoord()->isWaitingForApplierToDrain());
auto net = getNet();
net->enterNetwork();
net->runUntil(net->now() + config.getCatchUpTimeoutPeriod());
net->exitNetwork();
+ ASSERT_FALSE(getReplCoord()->isWaitingForApplierToDrain());
stopCapturingLogMessages();
ASSERT_EQUALS(1, countLogLinesContaining("Stopped transition to primary"));
ASSERT_FALSE(getReplCoord()->canAcceptWritesForDatabase("test"));
@@ -1378,12 +1377,15 @@ TEST_F(PrimaryCatchUpTest, PrimaryStepsDownDuringCatchUp) {
ASSERT_TRUE(evh.isValid());
getReplExec()->waitForEvent(evh);
ASSERT_TRUE(getReplCoord()->getMemberState().secondary());
- ASSERT_FALSE(getReplCoord()->isCatchingUp());
- ASSERT_FALSE(getReplCoord()->isWaitingForApplierToDrain());
auto net = getNet();
net->enterNetwork();
net->runReadyNetworkOperations();
net->exitNetwork();
+ auto txn = makeOperationContext();
+ // Simulate bgsync signaling replCoord to exit drain mode.
+ // At this point, we see the stepdown and reset the states.
+ getReplCoord()->signalDrainComplete(txn.get());
+ ASSERT_FALSE(getReplCoord()->isWaitingForApplierToDrain());
stopCapturingLogMessages();
ASSERT_EQUALS(1, countLogLinesContaining("Cannot catch up oplog after becoming primary"));
ASSERT_FALSE(getReplCoord()->canAcceptWritesForDatabase("test"));