summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEsha Maharishi <esha.maharishi@mongodb.com>2016-10-20 10:32:12 -0400
committerEsha Maharishi <esha.maharishi@mongodb.com>2016-10-20 10:34:56 -0400
commitb649a9ac7caf8fdd43f8eb6bf783de6847b818d4 (patch)
treeb21ed84ce12bf01fe7f972c6c095f831584baa9e
parent0c41f08b3d906e98f3272e427a3e366a9b9754e2 (diff)
downloadmongo-b649a9ac7caf8fdd43f8eb6bf783de6847b818d4.tar.gz
SERVER-25934 rename MongodTestFixture to ShardingMongodTestFixture
-rw-r--r--src/mongo/db/s/sharding_state_test.cpp6
-rw-r--r--src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp4
-rw-r--r--src/mongo/s/catalog/replset_dist_lock_manager_test.cpp6
-rw-r--r--src/mongo/s/config_server_test_fixture.cpp2
-rw-r--r--src/mongo/s/config_server_test_fixture.h6
-rw-r--r--src/mongo/s/sharding_mongod_test_fixture.cpp69
-rw-r--r--src/mongo/s/sharding_mongod_test_fixture.h6
7 files changed, 50 insertions, 49 deletions
diff --git a/src/mongo/db/s/sharding_state_test.cpp b/src/mongo/db/s/sharding_state_test.cpp
index 1faaa5c839f..c20c1ac4a41 100644
--- a/src/mongo/db/s/sharding_state_test.cpp
+++ b/src/mongo/db/s/sharding_state_test.cpp
@@ -46,7 +46,7 @@ namespace mongo {
using executor::RemoteCommandRequest;
-class ShardingStateTest : public MongodTestFixture {
+class ShardingStateTest : public ShardingMongodTestFixture {
public:
ShardingState* shardingState() {
return &_shardingState;
@@ -58,7 +58,7 @@ protected:
void setUp() override {
serverGlobalParams.clusterRole = ClusterRole::None;
- MongodTestFixture::setUp();
+ ShardingMongodTestFixture::setUp();
// When sharding initialization is triggered, initialize sharding state as a shard server.
serverGlobalParams.clusterRole = ClusterRole::ShardServer;
@@ -91,7 +91,7 @@ protected:
// ShardingState initialize can modify ReplicaSetMonitor state.
ReplicaSetMonitor::cleanup();
- MongodTestFixture::tearDown();
+ ShardingMongodTestFixture::tearDown();
}
private:
diff --git a/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp b/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp
index 8130c7d168e..f54a806cdec 100644
--- a/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp
+++ b/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp
@@ -76,7 +76,7 @@ const HostAndPort dummyHost("dummy", 123);
/**
* Sets up the mocked out objects for testing the replica-set backed catalog manager.
*/
-class DistLockCatalogFixture : public MongodTestFixture {
+class DistLockCatalogFixture : public ShardingMongodTestFixture {
public:
std::shared_ptr<RemoteCommandTargeterMock> configTargeter() {
return RemoteCommandTargeterMock::get(shardRegistry()->getConfigShard()->getTargeter());
@@ -84,7 +84,7 @@ public:
protected:
void setUp() override {
- MongodTestFixture::setUp();
+ ShardingMongodTestFixture::setUp();
// Initialize sharding components as a shard server.
serverGlobalParams.clusterRole = ClusterRole::ShardServer;
diff --git a/src/mongo/s/catalog/replset_dist_lock_manager_test.cpp b/src/mongo/s/catalog/replset_dist_lock_manager_test.cpp
index 5c817306206..76dbe8a6ca4 100644
--- a/src/mongo/s/catalog/replset_dist_lock_manager_test.cpp
+++ b/src/mongo/s/catalog/replset_dist_lock_manager_test.cpp
@@ -88,7 +88,7 @@ const Seconds kLockExpiration(10);
* Basic fixture for ReplSetDistLockManager that starts it up before the test begins
* and shuts it down when a test finishes.
*/
-class ReplSetDistLockManagerFixture : public MongodTestFixture {
+class ReplSetDistLockManagerFixture : public ShardingMongodTestFixture {
public:
/**
* Returns the mocked catalog used by the lock manager being tested.
@@ -112,7 +112,7 @@ protected:
}
void setUp() override {
- MongodTestFixture::setUp();
+ ShardingMongodTestFixture::setUp();
getServiceContext()->setTickSource(makeTickSource());
@@ -126,7 +126,7 @@ protected:
void tearDown() override {
// Don't care about what shutDown passes to stopPing here.
getMockCatalog()->expectStopPing([](StringData) {}, Status::OK());
- MongodTestFixture::tearDown();
+ ShardingMongodTestFixture::tearDown();
}
std::unique_ptr<DistLockCatalog> makeDistLockCatalog(ShardRegistry* shardRegistry) override {
diff --git a/src/mongo/s/config_server_test_fixture.cpp b/src/mongo/s/config_server_test_fixture.cpp
index 563c88d807b..4261d037073 100644
--- a/src/mongo/s/config_server_test_fixture.cpp
+++ b/src/mongo/s/config_server_test_fixture.cpp
@@ -97,7 +97,7 @@ ConfigServerTestFixture::ConfigServerTestFixture() = default;
ConfigServerTestFixture::~ConfigServerTestFixture() = default;
void ConfigServerTestFixture::setUp() {
- MongodTestFixture::setUp();
+ ShardingMongodTestFixture::setUp();
// Initialize sharding components as a config server.
serverGlobalParams.clusterRole = ClusterRole::ConfigServer;
diff --git a/src/mongo/s/config_server_test_fixture.h b/src/mongo/s/config_server_test_fixture.h
index 1d0cf587b69..8d8bafa0c96 100644
--- a/src/mongo/s/config_server_test_fixture.h
+++ b/src/mongo/s/config_server_test_fixture.h
@@ -45,9 +45,9 @@ class StatusWith;
/**
* Provides config-specific functionality in addition to the mock storage engine and mock network
- * provided by MongodTestFixture.
+ * provided by ShardingMongodTestFixture.
*/
-class ConfigServerTestFixture : public MongodTestFixture {
+class ConfigServerTestFixture : public ShardingMongodTestFixture {
public:
ConfigServerTestFixture();
~ConfigServerTestFixture();
@@ -105,7 +105,7 @@ public:
executor::TaskExecutor* executorForAddShard() const;
/**
- * Same as MongodTestFixture::onCommand but run against _addShardNetworkTestEnv.
+ * Same as ShardingMongodTestFixture::onCommand but run against _addShardNetworkTestEnv.
*/
void onCommandForAddShard(executor::NetworkTestEnv::OnCommandFunction func);
diff --git a/src/mongo/s/sharding_mongod_test_fixture.cpp b/src/mongo/s/sharding_mongod_test_fixture.cpp
index c905fe3cdbd..ae91dc4ed5e 100644
--- a/src/mongo/s/sharding_mongod_test_fixture.cpp
+++ b/src/mongo/s/sharding_mongod_test_fixture.cpp
@@ -93,13 +93,13 @@ using std::string;
using std::vector;
using unittest::assertGet;
-MongodTestFixture::MongodTestFixture() = default;
+ShardingMongodTestFixture::ShardingMongodTestFixture() = default;
-MongodTestFixture::~MongodTestFixture() = default;
+ShardingMongodTestFixture::~ShardingMongodTestFixture() = default;
-const Seconds MongodTestFixture::kFutureTimeout{5};
+const Seconds ShardingMongodTestFixture::kFutureTimeout{5};
-void MongodTestFixture::setUp() {
+void ShardingMongodTestFixture::setUp() {
ServiceContextMongoDTest::setUp();
auto serviceContext = getServiceContext();
@@ -131,12 +131,12 @@ void MongodTestFixture::setUp() {
repl::createOplog(_opCtx.get());
}
-std::unique_ptr<ReplicationCoordinator> MongodTestFixture::makeReplicationCoordinator(
+std::unique_ptr<ReplicationCoordinator> ShardingMongodTestFixture::makeReplicationCoordinator(
ReplSettings replSettings) {
return stdx::make_unique<repl::ReplicationCoordinatorMock>(replSettings);
}
-std::unique_ptr<executor::TaskExecutorPool> MongodTestFixture::makeTaskExecutorPool() {
+std::unique_ptr<executor::TaskExecutorPool> ShardingMongodTestFixture::makeTaskExecutorPool() {
// Set up a NetworkInterfaceMock. Note, unlike NetworkInterfaceASIO, which has its own pool of
// threads, tasks in the NetworkInterfaceMock must be carried out synchronously by the (single)
// thread the unit test is running on.
@@ -174,7 +174,7 @@ std::unique_ptr<executor::TaskExecutorPool> MongodTestFixture::makeTaskExecutorP
return executorPool;
}
-std::unique_ptr<ShardRegistry> MongodTestFixture::makeShardRegistry(
+std::unique_ptr<ShardRegistry> ShardingMongodTestFixture::makeShardRegistry(
ConnectionString configConnStr) {
auto targeterFactory(stdx::make_unique<RemoteCommandTargeterFactoryMock>());
auto targeterFactoryPtr = targeterFactory.get();
@@ -212,39 +212,39 @@ std::unique_ptr<ShardRegistry> MongodTestFixture::makeShardRegistry(
return stdx::make_unique<ShardRegistry>(std::move(shardFactory), configConnStr);
}
-std::unique_ptr<DistLockCatalog> MongodTestFixture::makeDistLockCatalog(
+std::unique_ptr<DistLockCatalog> ShardingMongodTestFixture::makeDistLockCatalog(
ShardRegistry* shardRegistry) {
return nullptr;
}
-std::unique_ptr<DistLockManager> MongodTestFixture::makeDistLockManager(
+std::unique_ptr<DistLockManager> ShardingMongodTestFixture::makeDistLockManager(
std::unique_ptr<DistLockCatalog> distLockCatalog) {
return nullptr;
}
-std::unique_ptr<ShardingCatalogClient> MongodTestFixture::makeShardingCatalogClient(
+std::unique_ptr<ShardingCatalogClient> ShardingMongodTestFixture::makeShardingCatalogClient(
std::unique_ptr<DistLockManager> distLockManager) {
return nullptr;
}
-std::unique_ptr<ShardingCatalogManager> MongodTestFixture::makeShardingCatalogManager(
+std::unique_ptr<ShardingCatalogManager> ShardingMongodTestFixture::makeShardingCatalogManager(
ShardingCatalogClient* catalogClient) {
return nullptr;
}
-std::unique_ptr<CatalogCache> MongodTestFixture::makeCatalogCache() {
+std::unique_ptr<CatalogCache> ShardingMongodTestFixture::makeCatalogCache() {
return nullptr;
}
-std::unique_ptr<ClusterCursorManager> MongodTestFixture::makeClusterCursorManager() {
+std::unique_ptr<ClusterCursorManager> ShardingMongodTestFixture::makeClusterCursorManager() {
return nullptr;
}
-std::unique_ptr<BalancerConfiguration> MongodTestFixture::makeBalancerConfiguration() {
+std::unique_ptr<BalancerConfiguration> ShardingMongodTestFixture::makeBalancerConfiguration() {
return nullptr;
}
-Status MongodTestFixture::initializeGlobalShardingStateForMongodForTest(
+Status ShardingMongodTestFixture::initializeGlobalShardingStateForMongodForTest(
const ConnectionString& configConnStr) {
invariant(serverGlobalParams.clusterRole == ClusterRole::ShardServer ||
serverGlobalParams.clusterRole == ClusterRole::ConfigServer);
@@ -301,7 +301,7 @@ Status MongodTestFixture::initializeGlobalShardingStateForMongodForTest(
return Status::OK();
}
-void MongodTestFixture::tearDown() {
+void ShardingMongodTestFixture::tearDown() {
// Only shut down components that were actually initialized and not already shut down.
if (Grid::get(operationContext())->getExecutorPool() && !_executorPoolShutDown) {
@@ -326,90 +326,91 @@ void MongodTestFixture::tearDown() {
ServiceContextMongoDTest::tearDown();
}
-ShardingCatalogClient* MongodTestFixture::catalogClient() const {
+ShardingCatalogClient* ShardingMongodTestFixture::catalogClient() const {
invariant(Grid::get(operationContext())->catalogClient(operationContext()));
return Grid::get(operationContext())->catalogClient(operationContext());
}
-ShardingCatalogManager* MongodTestFixture::catalogManager() const {
+ShardingCatalogManager* ShardingMongodTestFixture::catalogManager() const {
invariant(Grid::get(operationContext())->catalogManager());
return Grid::get(operationContext())->catalogManager();
}
-CatalogCache* MongodTestFixture::catalogCache() const {
+CatalogCache* ShardingMongodTestFixture::catalogCache() const {
invariant(Grid::get(operationContext())->catalogCache());
return Grid::get(operationContext())->catalogCache();
}
-ShardRegistry* MongodTestFixture::shardRegistry() const {
+ShardRegistry* ShardingMongodTestFixture::shardRegistry() const {
invariant(Grid::get(operationContext())->shardRegistry());
return Grid::get(operationContext())->shardRegistry();
}
-ClusterCursorManager* MongodTestFixture::clusterCursorManager() const {
+ClusterCursorManager* ShardingMongodTestFixture::clusterCursorManager() const {
invariant(Grid::get(operationContext())->getCursorManager());
return Grid::get(operationContext())->getCursorManager();
}
-executor::TaskExecutorPool* MongodTestFixture::executorPool() const {
+executor::TaskExecutorPool* ShardingMongodTestFixture::executorPool() const {
invariant(Grid::get(operationContext())->getExecutorPool());
return Grid::get(operationContext())->getExecutorPool();
}
-void MongodTestFixture::shutdownExecutorPool() {
+void ShardingMongodTestFixture::shutdownExecutorPool() {
invariant(!_executorPoolShutDown);
executorPool()->shutdownAndJoin();
_executorPoolShutDown = true;
}
-executor::NetworkInterfaceMock* MongodTestFixture::network() const {
+executor::NetworkInterfaceMock* ShardingMongodTestFixture::network() const {
invariant(_mockNetwork);
return _mockNetwork;
}
-executor::TaskExecutor* MongodTestFixture::executor() const {
+executor::TaskExecutor* ShardingMongodTestFixture::executor() const {
invariant(Grid::get(operationContext())->getExecutorPool());
return Grid::get(operationContext())->getExecutorPool()->getFixedExecutor();
}
-repl::ReplicationCoordinator* MongodTestFixture::replicationCoordinator() const {
+repl::ReplicationCoordinator* ShardingMongodTestFixture::replicationCoordinator() const {
invariant(_replCoord);
return _replCoord;
}
-DistLockCatalog* MongodTestFixture::distLockCatalog() const {
+DistLockCatalog* ShardingMongodTestFixture::distLockCatalog() const {
invariant(_distLockCatalog);
return _distLockCatalog;
}
-DistLockManager* MongodTestFixture::distLock() const {
+DistLockManager* ShardingMongodTestFixture::distLock() const {
invariant(_distLockManager);
return _distLockManager;
}
-RemoteCommandTargeterFactoryMock* MongodTestFixture::targeterFactory() const {
+RemoteCommandTargeterFactoryMock* ShardingMongodTestFixture::targeterFactory() const {
invariant(_targeterFactory);
return _targeterFactory;
}
-OperationContext* MongodTestFixture::operationContext() const {
+OperationContext* ShardingMongodTestFixture::operationContext() const {
invariant(_opCtx);
return _opCtx.get();
}
-void MongodTestFixture::onCommand(NetworkTestEnv::OnCommandFunction func) {
+void ShardingMongodTestFixture::onCommand(NetworkTestEnv::OnCommandFunction func) {
_networkTestEnv->onCommand(func);
}
-void MongodTestFixture::onCommandWithMetadata(NetworkTestEnv::OnCommandWithMetadataFunction func) {
+void ShardingMongodTestFixture::onCommandWithMetadata(
+ NetworkTestEnv::OnCommandWithMetadataFunction func) {
_networkTestEnv->onCommandWithMetadata(func);
}
-void MongodTestFixture::onFindCommand(NetworkTestEnv::OnFindCommandFunction func) {
+void ShardingMongodTestFixture::onFindCommand(NetworkTestEnv::OnFindCommandFunction func) {
_networkTestEnv->onFindCommand(func);
}
-void MongodTestFixture::onFindWithMetadataCommand(
+void ShardingMongodTestFixture::onFindWithMetadataCommand(
NetworkTestEnv::OnFindCommandWithMetadataFunction func) {
_networkTestEnv->onFindWithMetadataCommand(func);
}
diff --git a/src/mongo/s/sharding_mongod_test_fixture.h b/src/mongo/s/sharding_mongod_test_fixture.h
index 00b19470e75..e3ffa13d582 100644
--- a/src/mongo/s/sharding_mongod_test_fixture.h
+++ b/src/mongo/s/sharding_mongod_test_fixture.h
@@ -71,10 +71,10 @@ class ReplSettings;
* components (including a NetworkInterface/TaskExecutor subsystem backed by the NetworkTestEnv),
* but allows subclasses to replace any component with its real implementation, a mock, or nullptr.
*/
-class MongodTestFixture : public ServiceContextMongoDTest {
+class ShardingMongodTestFixture : public ServiceContextMongoDTest {
public:
- MongodTestFixture();
- ~MongodTestFixture();
+ ShardingMongodTestFixture();
+ ~ShardingMongodTestFixture();
static const Seconds kFutureTimeout;