summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2018-04-26 14:03:16 -0400
committerRandolph Tan <randolph@10gen.com>2018-04-30 09:47:23 -0400
commitc734bb32c3237f67a99c47ca3835967909c2e2d1 (patch)
tree0b0ee0a92fe88c74821aa53ffe98bd48a3d10960
parent3dc959acef929fc69c6517a415f18372c03b4589 (diff)
downloadmongo-c734bb32c3237f67a99c47ca3835967909c2e2d1.tar.gz
SERVER-34367 Change test to use clock source mock to control yield timing
-rw-r--r--src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp
index 49aec18b0fd..e92f24d0468 100644
--- a/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp
+++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp
@@ -38,6 +38,7 @@
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/shard_server_test_fixture.h"
#include "mongo/unittest/unittest.h"
+#include "mongo/util/clock_source_mock.h"
namespace mongo {
namespace {
@@ -91,6 +92,14 @@ protected:
RemoteCommandTargeterMock::get(recipientShard->getTargeter())
->setFindHostReturnValue(kRecipientConnStr.getServers()[0]);
}
+
+ auto clockSource = stdx::make_unique<ClockSourceMock>();
+
+ // Timestamps of "0 seconds" are not allowed, so we must advance our clock mock to the first
+ // real second.
+ clockSource->advance(Seconds(1));
+
+ operationContext()->getServiceContext()->setFastClockSource(std::move(clockSource));
}
void tearDown() override {