summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2019-06-27 09:33:33 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2019-06-27 10:50:20 -0400
commit4b955e6a1a35b1704a05aa29bd7e6ed42612333c (patch)
treee65320a19784f295ded197f4b121b71410abf66a /src/mongo/s
parent8fd79fe845e3e4717df26abb78c3fb7859f3823e (diff)
downloadmongo-4b955e6a1a35b1704a05aa29bd7e6ed42612333c.tar.gz
SERVER-26531 Change ConfigServerTestFixture::setupChunks to `void`
... because having it return Status just so all callers can assert that it's OK is useless.
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/config_server_test_fixture.cpp18
-rw-r--r--src/mongo/s/config_server_test_fixture.h4
-rw-r--r--src/mongo/s/sharding_router_test_fixture.cpp1
3 files changed, 7 insertions, 16 deletions
diff --git a/src/mongo/s/config_server_test_fixture.cpp b/src/mongo/s/config_server_test_fixture.cpp
index 4a1c10a95f2..36d87c5e46b 100644
--- a/src/mongo/s/config_server_test_fixture.cpp
+++ b/src/mongo/s/config_server_test_fixture.cpp
@@ -284,16 +284,11 @@ StatusWith<BSONObj> ConfigServerTestFixture::findOneOnConfigCollection(Operation
return findResult.docs.front().getOwned();
}
-Status ConfigServerTestFixture::setupShards(const std::vector<ShardType>& shards) {
+void ConfigServerTestFixture::setupShards(const std::vector<ShardType>& shards) {
const NamespaceString shardNS(ShardType::ConfigNS);
for (const auto& shard : shards) {
- auto insertStatus = insertToConfigCollection(operationContext(), shardNS, shard.toBSON());
- if (!insertStatus.isOK()) {
- return insertStatus;
- }
+ ASSERT_OK(insertToConfigCollection(operationContext(), shardNS, shard.toBSON()));
}
-
- return Status::OK();
}
StatusWith<ShardType> ConfigServerTestFixture::getShardDoc(OperationContext* opCtx,
@@ -311,16 +306,11 @@ StatusWith<ShardType> ConfigServerTestFixture::getShardDoc(OperationContext* opC
return ShardType::fromBSON(doc.getValue());
}
-Status ConfigServerTestFixture::setupChunks(const std::vector<ChunkType>& chunks) {
+void ConfigServerTestFixture::setupChunks(const std::vector<ChunkType>& chunks) {
const NamespaceString chunkNS(ChunkType::ConfigNS);
for (const auto& chunk : chunks) {
- auto insertStatus =
- insertToConfigCollection(operationContext(), chunkNS, chunk.toConfigBSON());
- if (!insertStatus.isOK())
- return insertStatus;
+ ASSERT_OK(insertToConfigCollection(operationContext(), chunkNS, chunk.toConfigBSON()));
}
-
- return Status::OK();
}
StatusWith<ChunkType> ConfigServerTestFixture::getChunkDoc(OperationContext* opCtx,
diff --git a/src/mongo/s/config_server_test_fixture.h b/src/mongo/s/config_server_test_fixture.h
index a66b43b37c4..649dddbe42b 100644
--- a/src/mongo/s/config_server_test_fixture.h
+++ b/src/mongo/s/config_server_test_fixture.h
@@ -90,7 +90,7 @@ public:
/**
* Setup the config.shards collection to contain the given shards.
*/
- Status setupShards(const std::vector<ShardType>& shards);
+ void setupShards(const std::vector<ShardType>& shards);
/**
* Retrieves the shard document from the config server.
@@ -101,7 +101,7 @@ public:
/**
* Setup the config.chunks collection to contain the given chunks.
*/
- Status setupChunks(const std::vector<ChunkType>& chunks);
+ void setupChunks(const std::vector<ChunkType>& chunks);
/**
* Retrieves the chunk document from the config server.
diff --git a/src/mongo/s/sharding_router_test_fixture.cpp b/src/mongo/s/sharding_router_test_fixture.cpp
index 63ff2cdb67d..189b76e73d6 100644
--- a/src/mongo/s/sharding_router_test_fixture.cpp
+++ b/src/mongo/s/sharding_router_test_fixture.cpp
@@ -257,6 +257,7 @@ void ShardingTestFixture::addRemoteShards(
targeterFactory()->addTargeterToReturn(ConnectionString(std::get<1>(shard)),
std::move(targeter));
}
+
setupShards(shards);
}