summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replication_executor_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/repl/replication_executor_test.cpp')
-rw-r--r--src/mongo/db/repl/replication_executor_test.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mongo/db/repl/replication_executor_test.cpp b/src/mongo/db/repl/replication_executor_test.cpp
index ba41df46769..2e8a66465de 100644
--- a/src/mongo/db/repl/replication_executor_test.cpp
+++ b/src/mongo/db/repl/replication_executor_test.cpp
@@ -249,6 +249,21 @@ TEST_F(ReplicationExecutorTest, ScheduleCallbackAtNow) {
executor.waitForEvent(finishEvent);
}
+TEST_F(ReplicationExecutorTest, ScheduleCallbackInPast) {
+ launchExecutorThread();
+ getNet()->exitNetwork();
+
+ ReplicationExecutor& executor = getReplExecutor();
+ auto finishEvent = assertGet(executor.makeEvent());
+ auto fn = [&executor, finishEvent](const ReplicationExecutor::CallbackArgs& cbData) {
+ ASSERT_OK(cbData.status);
+ executor.signalEvent(finishEvent);
+ };
+
+ auto cb = executor.scheduleWorkAt(getNet()->now() - Milliseconds(1000), fn);
+ executor.waitForEvent(finishEvent);
+}
+
TEST_F(ReplicationExecutorTest, ScheduleCallbackAtAFutureTime) {
launchExecutorThread();
getNet()->exitNetwork();