summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-03-07 16:04:15 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-03-07 16:13:15 -0500
commiteb90269e893cd978d880c403d344343a9b9eeacd (patch)
treef0236d5273d1bf8bf9335e3b338f63d411145606 /src/mongo
parent8784e594b52f70a14a7780986d841740a1273224 (diff)
downloadmongo-eb90269e893cd978d880c403d344343a9b9eeacd.tar.gz
SERVER-29908 Fix broken keys_collection_manager_sharding_test
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/SConscript3
-rw-r--r--src/mongo/db/key_generator_update_test.cpp11
-rw-r--r--src/mongo/db/keys_collection_manager_sharding_test.cpp11
-rw-r--r--src/mongo/db/logical_time_validator_test.cpp11
4 files changed, 32 insertions, 4 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index e3bbf70a02f..b9c326484fb 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -1609,8 +1609,9 @@ env.CppUnitTest(
'keys_collection_manager_sharding_test.cpp',
],
LIBDEPS=[
- 'keys_collection_manager',
+ '$BUILD_DIR/mongo/s/catalog/dist_lock_manager_mock',
'$BUILD_DIR/mongo/s/config_server_test_fixture',
+ 'keys_collection_manager',
],
)
diff --git a/src/mongo/db/key_generator_update_test.cpp b/src/mongo/db/key_generator_update_test.cpp
index 5c30b3214eb..3aef06bdf67 100644
--- a/src/mongo/db/key_generator_update_test.cpp
+++ b/src/mongo/db/key_generator_update_test.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/keys_collection_client_sharded.h"
#include "mongo/db/keys_collection_document.h"
#include "mongo/db/logical_clock.h"
-#include "mongo/db/namespace_string.h"
+#include "mongo/s/catalog/dist_lock_manager_mock.h"
#include "mongo/s/config_server_test_fixture.h"
#include "mongo/stdx/memory.h"
#include "mongo/unittest/unittest.h"
@@ -60,6 +60,15 @@ protected:
return _catalogClient.get();
}
+ /**
+ * Intentionally create a DistLockManagerMock, even though this is a config serfver test in
+ * order to avoid the lock pinger thread from executing and accessing uninitialized state.
+ */
+ std::unique_ptr<DistLockManager> makeDistLockManager(
+ std::unique_ptr<DistLockCatalog> distLockCatalog) override {
+ return stdx::make_unique<DistLockManagerMock>(std::move(distLockCatalog));
+ }
+
private:
std::unique_ptr<KeysCollectionClient> _catalogClient;
};
diff --git a/src/mongo/db/keys_collection_manager_sharding_test.cpp b/src/mongo/db/keys_collection_manager_sharding_test.cpp
index c97ca659dd6..d21db07a5ff 100644
--- a/src/mongo/db/keys_collection_manager_sharding_test.cpp
+++ b/src/mongo/db/keys_collection_manager_sharding_test.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/keys_collection_document.h"
#include "mongo/db/keys_collection_manager.h"
#include "mongo/db/logical_clock.h"
-#include "mongo/db/namespace_string.h"
+#include "mongo/s/catalog/dist_lock_manager_mock.h"
#include "mongo/s/config_server_test_fixture.h"
#include "mongo/stdx/memory.h"
#include "mongo/unittest/unittest.h"
@@ -73,6 +73,15 @@ protected:
ConfigServerTestFixture::tearDown();
}
+ /**
+ * Intentionally create a DistLockManagerMock, even though this is a config serfver test in
+ * order to avoid the lock pinger thread from executing and accessing uninitialized state.
+ */
+ std::unique_ptr<DistLockManager> makeDistLockManager(
+ std::unique_ptr<DistLockCatalog> distLockCatalog) override {
+ return stdx::make_unique<DistLockManagerMock>(std::move(distLockCatalog));
+ }
+
private:
std::unique_ptr<KeysCollectionManager> _keyManager;
};
diff --git a/src/mongo/db/logical_time_validator_test.cpp b/src/mongo/db/logical_time_validator_test.cpp
index 5db41df3d72..2b44cd12726 100644
--- a/src/mongo/db/logical_time_validator_test.cpp
+++ b/src/mongo/db/logical_time_validator_test.cpp
@@ -37,7 +37,7 @@
#include "mongo/db/server_options.h"
#include "mongo/db/signed_logical_time.h"
#include "mongo/db/time_proof_service.h"
-#include "mongo/platform/basic.h"
+#include "mongo/s/catalog/dist_lock_manager_mock.h"
#include "mongo/s/config_server_test_fixture.h"
#include "mongo/stdx/memory.h"
#include "mongo/unittest/unittest.h"
@@ -76,6 +76,15 @@ protected:
}
/**
+ * Intentionally create a DistLockManagerMock, even though this is a config serfver test in
+ * order to avoid the lock pinger thread from executing and accessing uninitialized state.
+ */
+ std::unique_ptr<DistLockManager> makeDistLockManager(
+ std::unique_ptr<DistLockCatalog> distLockCatalog) override {
+ return stdx::make_unique<DistLockManagerMock>(std::move(distLockCatalog));
+ }
+
+ /**
* Forces KeyManager to refresh cache and generate new keys.
*/
void refreshKeyManager() {