diff options
author | Ben Caimano <ben.caimano@10gen.com> | 2020-07-23 21:59:46 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-07-28 20:57:56 +0000 |
commit | 214379825c248f5a5e5f0a01ad9863b900faaf30 (patch) | |
tree | 077a4844ec0daaf1a738933920525cde7d440131 /src/mongo/db | |
parent | 6dd301449ec7a48e35a7114e93b888df9958217f (diff) | |
download | mongo-214379825c248f5a5e5f0a01ad9863b900faaf30.tar.gz |
SERVER-48650 Gave the ClockSourceMock a global impl
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/repl/initial_syncer_test.cpp | 7 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_test_fixture.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/service_context_test_fixture.cpp | 7 |
4 files changed, 13 insertions, 7 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript index 0fbabb87582..2f5aad83e4c 100644 --- a/src/mongo/db/SConscript +++ b/src/mongo/db/SConscript @@ -1697,6 +1697,7 @@ env.Library( ], LIBDEPS_PRIVATE=[ 'op_observer', + '$BUILD_DIR/mongo/util/clock_source_mock', ], ) diff --git a/src/mongo/db/repl/initial_syncer_test.cpp b/src/mongo/db/repl/initial_syncer_test.cpp index 4180a2a5b74..455dfd10d6a 100644 --- a/src/mongo/db/repl/initial_syncer_test.cpp +++ b/src/mongo/db/repl/initial_syncer_test.cpp @@ -67,6 +67,7 @@ #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/thread_pool_task_executor_test_fixture.h" #include "mongo/platform/mutex.h" +#include "mongo/util/clock_source_mock.h" #include "mongo/util/concurrency/thread_name.h" #include "mongo/util/concurrency/thread_pool.h" #include "mongo/util/fail_point.h" @@ -340,10 +341,8 @@ protected: }; auto* service = getGlobalServiceContext(); - service->setFastClockSource( - std::make_unique<executor::NetworkInterfaceMockClockSource>(getNet())); - service->setPreciseClockSource( - std::make_unique<executor::NetworkInterfaceMockClockSource>(getNet())); + service->setFastClockSource(std::make_unique<ClockSourceMock>()); + service->setPreciseClockSource(std::make_unique<ClockSourceMock>()); ThreadPool::Options dbThreadPoolOptions; dbThreadPoolOptions.poolName = "dbthread"; dbThreadPoolOptions.minThreads = 1U; diff --git a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp index f2147923ed9..e54eda1b6f1 100644 --- a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp +++ b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp @@ -153,9 +153,8 @@ void ReplCoordTest::init() { replicationProcess, _storageInterface, seed); - service->setFastClockSource(std::make_unique<executor::NetworkInterfaceMockClockSource>(_net)); - service->setPreciseClockSource( - std::make_unique<executor::NetworkInterfaceMockClockSource>(_net)); + service->setFastClockSource(std::make_unique<ClockSourceMock>()); + service->setPreciseClockSource(std::make_unique<ClockSourceMock>()); } void ReplCoordTest::init(const ReplSettings& settings) { diff --git a/src/mongo/db/service_context_test_fixture.cpp b/src/mongo/db/service_context_test_fixture.cpp index 3a1a8b4edb5..3ba046db3de 100644 --- a/src/mongo/db/service_context_test_fixture.cpp +++ b/src/mongo/db/service_context_test_fixture.cpp @@ -37,11 +37,18 @@ #include "mongo/db/client.h" #include "mongo/db/op_observer_registry.h" #include "mongo/util/assert_util.h" +#include "mongo/util/clock_source_mock.h" #include "mongo/util/diagnostic_info.h" namespace mongo { ScopedGlobalServiceContextForTest::ScopedGlobalServiceContextForTest() { + { + // Reset the global clock source + ClockSourceMock clkSource; + clkSource.reset(); + } + auto serviceContext = [] { auto serviceContext = ServiceContext::make(); auto serviceContextPtr = serviceContext.get(); |