diff options
author | Kevin Pulo <kevin.pulo@mongodb.com> | 2020-06-10 18:00:24 +1000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-11 01:23:55 +0000 |
commit | dba968473d0b4dd3e8c7b31e524d3e8ed20bf6ae (patch) | |
tree | 3e170f8e2d898f1782420a54df9644514397e7cc /src/mongo/db | |
parent | c08a726e61157ae501c28cf7e222e16d49954fbf (diff) | |
download | mongo-dba968473d0b4dd3e8c7b31e524d3e8ed20bf6ae.tar.gz |
SERVER-48683 VectorClockConfigServerTest should use DistLockManagerMock
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/s/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/s/vector_clock_config_server_test.cpp | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/s/SConscript b/src/mongo/db/s/SConscript index fb555cb1171..e6f46132f70 100644 --- a/src/mongo/db/s/SConscript +++ b/src/mongo/db/s/SConscript @@ -368,6 +368,7 @@ env.CppUnitTest( LIBDEPS=[ '$BUILD_DIR/mongo/db/auth/authmocks', '$BUILD_DIR/mongo/db/auth/authmocks', + '$BUILD_DIR/mongo/s/catalog/dist_lock_manager_mock', '$BUILD_DIR/mongo/s/config_server_test_fixture', '$BUILD_DIR/mongo/s/sharding_router_test_fixture', 'chunk_splitter', diff --git a/src/mongo/db/s/vector_clock_config_server_test.cpp b/src/mongo/db/s/vector_clock_config_server_test.cpp index 6c62f4834ac..e6b1a4d2bb3 100644 --- a/src/mongo/db/s/vector_clock_config_server_test.cpp +++ b/src/mongo/db/s/vector_clock_config_server_test.cpp @@ -33,6 +33,7 @@ #include "mongo/db/keys_collection_manager.h" #include "mongo/db/logical_time_validator.h" #include "mongo/db/vector_clock_mutable.h" +#include "mongo/s/catalog/dist_lock_manager_mock.h" #include "mongo/s/config_server_test_fixture.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" @@ -68,6 +69,15 @@ protected: ConfigServerTestFixture::tearDown(); } + // The VectorClock tests assume nothing else ticks ClusterTime. However, + // ConfigServerTestFixture installs an actual DistLockManager, which does writes (thereby + // ticking ClusterTime). So for these tests, that is overridden to be a mock. + std::unique_ptr<DistLockManager> makeDistLockManager( + std::unique_ptr<DistLockCatalog> distLockCatalog) override { + invariant(distLockCatalog); + return std::make_unique<DistLockManagerMock>(std::move(distLockCatalog)); + } + /** * Forces KeyManager to refresh cache and generate new keys. */ |