The following issues were found
src/mongo/s/chunk_manager_targeter_test.cpp
1 issues
Line: 81
boost::optional<ChunkManager> chunkManager;
};
TEST_F(ChunkManagerTargeterTest, TargetInsertWithRangePrefixHashedShardKey) {
// Create 5 chunks and 5 shards such that shardId '0' has chunk [MinKey, null), '1' has chunk
// [null, -100), '2' has chunk [-100, 0), '3' has chunk ['0', 100) and '4' has chunk
// [100, MaxKey).
std::vector<BSONObj> splitPoints = {
BSON("a.b" << BSONNULL), BSON("a.b" << -100), BSON("a.b" << 0), BSON("a.b" << 100)};
Reported by Cppcheck.
src/mongo/s/chunk_map_test.cpp
1 issues
Line: 54
} // namespace
TEST_F(ChunkMapTest, TestAddChunk) {
const OID epoch = OID::gen();
ChunkVersion version{1, 0, epoch, boost::none /* timestamp */};
auto chunk = std::make_shared<ChunkInfo>(
ChunkType{kNss,
Reported by Cppcheck.
src/mongo/s/chunk_test.cpp
1 issues
Line: 48
const ShardId kShardTwo("shardTwo");
const KeyPattern kShardKeyPattern(BSON("a" << 1));
TEST(ChunkTest, HasMovedSincePinnedTimestamp) {
const OID epoch = OID::gen();
ChunkVersion version{1, 0, epoch, boost::none /* timestamp */};
ChunkType chunkType(kNss,
ChunkRange{kShardKeyPattern.globalMin(), kShardKeyPattern.globalMax()},
Reported by Cppcheck.
src/mongo/s/chunk_version_test.cpp
1 issues
Line: 42
using unittest::assertGet;
TEST(ChunkVersionParsing, ToFromBSONRoundtrip) {
ChunkVersion version(1, 2, OID::gen(), Timestamp(42));
const auto roundTripVersion = assertGet(ChunkVersion::parseWithField(
[&] {
BSONObjBuilder builder;
version.appendWithField(&builder, "testVersionField");
Reported by Cppcheck.
src/mongo/s/chunk_writes_tracker_test.cpp
1 issues
Line: 45
ASSERT_EQ(wt.getBytesWritten(), 0ull);
}
TEST(ChunkWritesTrackerTest, AddBytesWrittenCorrectlyAddsBytes) {
ChunkWritesTracker wt;
uint64_t bytesToAdd{4};
wt.addBytesWritten(bytesToAdd);
ASSERT_EQ(wt.getBytesWritten(), bytesToAdd);
}
Reported by Cppcheck.
src/mongo/s/client/shard_remote_test.cpp
1 issues
Line: 96
return BSON("lastCommittedOpTime" << time.asTimestamp());
}
TEST_F(ShardRemoteTest, GetAndSetLatestLastCommittedOpTime) {
auto shard = shardRegistry()->getShardNoReload(kTestShardIds[0]);
// Shards can store last committed opTimes.
LogicalTime time(Timestamp(10, 2));
shard->updateLastCommittedOpTime(time);
Reported by Cppcheck.
src/mongo/s/cluster_identity_loader_test.cpp
1 issues
Line: 104
HostAndPort configHost{"TestHost1"};
};
TEST_F(ClusterIdentityTest, BasicLoadSuccess) {
// The first time you ask for the cluster ID it will have to be loaded from the config servers.
auto future = launchAsync([&] {
auto clusterIdStatus =
ClusterIdentityLoader::get(operationContext())
Reported by Cppcheck.
src/mongo/s/commands/cluster_aggregate_test.cpp
1 issues
Line: 111
}
};
TEST_F(ClusterAggregateTest, NoErrors) {
testNoErrors(kAggregateCmdTargeted, kAggregateCmdScatterGather);
}
TEST_F(ClusterAggregateTest, RetryOnSnapshotError) {
testRetryOnSnapshotError(kAggregateCmdTargeted, kAggregateCmdScatterGather);
Reported by Cppcheck.
src/mongo/s/commands/cluster_delete_test.cpp
1 issues
Line: 71
}
};
TEST_F(ClusterDeleteTest, NoErrors) {
testNoErrors(kDeleteCmdTargeted, kDeleteCmdScatterGather);
}
TEST_F(ClusterDeleteTest, AttachesAtClusterTimeForSnapshotReadConcern) {
testAttachesAtClusterTimeForSnapshotReadConcern(kDeleteCmdTargeted, kDeleteCmdScatterGather);
Reported by Cppcheck.
src/mongo/s/commands/cluster_distinct_test.cpp
1 issues
Line: 70
}
};
TEST_F(ClusterDistinctTest, NoErrors) {
testNoErrors(kDistinctCmdTargeted, kDistinctCmdScatterGather);
}
TEST_F(ClusterDistinctTest, RetryOnSnapshotError) {
testRetryOnSnapshotError(kDistinctCmdTargeted, kDistinctCmdScatterGather);
Reported by Cppcheck.