The following issues were found
src/mongo/s/request_types/add_shard_request_test.cpp
1 issues
Line: 49
// top-level command name) are identical between the external mongos version and internal config
// version.
TEST(AddShardRequest, ParseInternalFieldsInvalidConnectionString) {
{
BSONObj obj = BSON(AddShardRequest::mongosAddShard << ",,,");
auto swAddShardRequest = AddShardRequest::parseFromMongosCommand(obj);
ASSERT_NOT_OK(swAddShardRequest.getStatus());
Reported by Cppcheck.
src/mongo/s/request_types/add_shard_to_zone_request_test.cpp
1 issues
Line: 53
ASSERT_EQ("z", request.getZoneName());
}
TEST(AddShardToZoneRequest, CommandBuilderShouldAlwaysCreateConfigCommand) {
auto requestStatus = AddShardToZoneRequest::parseFromMongosCommand(BSON("addShardToZone"
<< "a"
<< "zone"
<< "z"));
ASSERT_OK(requestStatus.getStatus());
Reported by Cppcheck.
src/mongo/s/request_types/balance_chunk_request_test.cpp
1 issues
Line: 45
using unittest::assertGet;
TEST(BalanceChunkRequest, ParseFromConfigCommandNoSecondaryThrottle) {
const ChunkVersion version(1, 0, OID::gen(), boost::none /* timestamp */);
auto request = assertGet(BalanceChunkRequest::parseFromConfigCommand(
BSON("_configsvrMoveChunk"
<< 1 << "ns"
<< "TestDB.TestColl"
Reported by Cppcheck.
src/mongo/s/request_types/commit_chunk_migration_request_test.cpp
1 issues
Line: 55
const char kConfigSvrCommitChunkMigration[] = "_configsvrCommitChunkMigration";
TEST(CommitChunkMigrationRequest, WithoutControlChunk) {
BSONObjBuilder builder;
ChunkType migratedChunk;
migratedChunk.setMin(kKey0);
migratedChunk.setMax(kKey1);
Reported by Cppcheck.
src/mongo/s/request_types/merge_chunk_request_test.cpp
1 issues
Line: 43
IDLParserErrorContext ctx("_configsvrCommitChunkMerge");
TEST(ConfigSvrMergeChunk, BasicValidConfigCommand) {
auto request = ConfigSvrMergeChunk::parse(
ctx,
BSON("_configsvrCommitChunkMerge"
<< "TestDB.TestColl"
<< "shard"
Reported by Cppcheck.
src/mongo/s/request_types/merge_chunks_request_test.cpp
1 issues
Line: 45
ChunkRange chunkRange(BSON("a" << 1), BSON("a" << 10));
IDLParserErrorContext ctx("_configsvrCommitChunksMerge");
TEST(ConfigSvrMergeChunks, BasicValidConfigCommand) {
auto collUUID = UUID::gen();
auto request = ConfigSvrMergeChunks::parse(
ctx,
BSON("_configsvrCommitChunksMerge"
<< "TestDB.TestColl"
Reported by Cppcheck.
src/mongo/s/request_types/migration_secondary_throttle_options_test.cpp
1 issues
Line: 51
ASSERT_BSONOBJ_EQ(BSONObj(), options.toBSON());
}
TEST(MigrationSecondaryThrottleOptions, CreateOn) {
MigrationSecondaryThrottleOptions options =
MigrationSecondaryThrottleOptions::create(MigrationSecondaryThrottleOptions::kOn);
ASSERT_EQ(MigrationSecondaryThrottleOptions::kOn, options.getSecondaryThrottle());
ASSERT(!options.isWriteConcernSpecified());
ASSERT_BSONOBJ_EQ(BSON("secondaryThrottle" << true), options.toBSON());
Reported by Cppcheck.
src/mongo/s/request_types/move_chunk_request_test.cpp
1 issues
Line: 51
const int kMaxChunkSizeBytes = 1024;
const bool kWaitForDelete = true;
TEST(MoveChunkRequest, Roundtrip) {
const ChunkVersion chunkVersion(3, 1, OID::gen(), boost::none /* timestamp */);
BSONObjBuilder builder;
MoveChunkRequest::appendAsCommand(
&builder,
Reported by Cppcheck.
src/mongo/s/request_types/remove_shard_from_zone_request_test.cpp
1 issues
Line: 54
ASSERT_EQ("z", request.getZoneName());
}
TEST(RemoveShardFromZoneRequest, CommandBuilderShouldAlwaysCreateConfigCommand) {
auto requestStatus =
RemoveShardFromZoneRequest::parseFromMongosCommand(BSON("removeShardFromZone"
<< "a"
<< "zone"
<< "z"));
Reported by Cppcheck.
src/mongo/s/request_types/set_shard_version_request_test.cpp
1 issues
Line: 60
ASSERT_EQ(request.getNSVersion().epoch(), chunkVersion.epoch());
}
TEST(SetShardVersionRequest, ParseFullWithAuthoritative) {
const ChunkVersion chunkVersion(1, 2, OID::gen(), boost::none /* timestamp */);
SetShardVersionRequest request =
assertGet(SetShardVersionRequest::parseFromBSON(
BSON("setShardVersion"
Reported by Cppcheck.