The following issues were found
src/mongo/s/request_types/split_chunk_request_test.cpp
1 issues
Line: 43
using unittest::assertGet;
TEST(SplitChunkRequest, BasicValidConfigCommand) {
auto request = assertGet(SplitChunkRequest::parseFromConfigCommand(
BSON("_configsvrCommitChunkSplit"
<< "TestDB.TestColl"
<< "collEpoch" << OID("7fffffff0000000000000001") << "min" << BSON("a" << 1) << "max"
<< BSON("a" << 10) << "splitPoints" << BSON_ARRAY(BSON("a" << 5)) << "shard"
Reported by Cppcheck.
src/mongo/s/request_types/update_zone_key_range_request_test.cpp
1 issues
Line: 59
ASSERT_EQ("z", request.getZoneName());
}
TEST(UpdateZoneKeyRangeRequest, BasicValidMongosRemoveCommand) {
auto requestStatus = UpdateZoneKeyRangeRequest::parseFromMongosCommand(fromjson(R"BSON({
updateZoneKeyRange: "foo.bar",
min: { x: 1 },
max: { x: 100 },
zone: null
Reported by Cppcheck.
src/mongo/s/routing_table_history_test.cpp
1 issues
Line: 236
std::vector<BSONObj> _initialChunkBoundaryPoints;
};
TEST_F(RoutingTableHistoryTest, SplittingOnlyChunkCopiesBytesWrittenToAllSubchunks) {
auto minKey = BSON("a" << 10);
auto maxKey = BSON("a" << 20);
auto newChunkBoundaryPoints = {
getShardKeyPattern().globalMin(), minKey, maxKey, getShardKeyPattern().globalMax()};
Reported by Cppcheck.
src/mongo/s/sessions_collection_sharded_test.cpp
1 issues
Line: 78
std::vector<ShardType> _shards;
};
TEST_F(SessionsCollectionShardedTest, RefreshOneSessionOKTest) {
// Set up routing table for the logical sessions collection.
loadRoutingTableWithTwoChunksAndTwoShardsImpl(NamespaceString::kLogicalSessionsNamespace,
BSON("_id" << 1));
auto future = launchAsync([&] {
auto now = Date_t::now();
Reported by Cppcheck.
src/mongo/s/shard_id_test.cpp
1 issues
Line: 42
using std::string;
using namespace mongo;
TEST(ShardId, Valid) {
ShardId shardId("my_shard_id");
ASSERT(shardId.isValid());
}
TEST(ShardId, Invalid) {
Reported by Cppcheck.
src/mongo/s/shard_key_pattern_test.cpp
1 issues
Line: 57
OperationContext* const _opCtx{_opCtxHolder.get()};
};
TEST_F(ShardKeyPatternTest, SingleFieldShardKeyPatternsValidityCheck) {
ShardKeyPattern s1(BSON("a" << 1));
ShardKeyPattern s2(BSON("a" << 1.0f));
ShardKeyPattern s3(BSON("a" << (long long)1L));
ShardKeyPattern s4(BSON("a"
<< "hashed"));
Reported by Cppcheck.
src/mongo/s/sharding_router_test_fixture.cpp
1 issues
Line: 293
auto itInserted = inserted.begin();
auto itExpected = expected.begin();
for (; itInserted != inserted.end(); itInserted++, itExpected++) {
ASSERT_BSONOBJ_EQ(*itExpected, *itInserted);
}
BatchedCommandResponse response;
response.setStatus(Status::OK());
Reported by Cppcheck.
src/mongo/s/sharding_task_executor_test.cpp
1 issues
Line: 132
const RemoteCommandRequest request(
HostAndPort("localhost", 27017), "mydb", bob.obj(), operationContext());
TaskExecutor::CallbackHandle cbHandle = unittest::assertGet(executor.scheduleRemoteCommand(
request, [=](const executor::TaskExecutor::RemoteCommandCallbackArgs) -> void {}, nullptr));
ASSERT(_network->hasReadyRequests());
NetworkInterfaceMock::NetworkOperationIterator noi = _network->getNextReadyRequest();
auto cmdObj = noi->getRequest().cmdObj;
Reported by Cppcheck.
src/mongo/s/stale_exception_test.cpp
1 issues
Line: 46
const NamespaceString kNss("test.nss");
TEST_F(StaleExceptionTest, StaleConfigInfoSerializationTest) {
const ShardId kShardId("SHARD_ID");
StaleConfigInfo info(kNss, ChunkVersion::UNSHARDED(), ChunkVersion::UNSHARDED(), kShardId);
// Serialize
Reported by Cppcheck.
src/mongo/s/transaction_router_test.cpp
1 issues
Line: 228
boost::optional<RouterOperationContextSession> _routerOpCtxSession;
};
TEST_F(TransactionRouterTestWithDefaultSession,
StartTxnShouldBeAttachedOnlyOnFirstStatementToParticipant) {
TxnNumber txnNum{3};
auto txnRouter = TransactionRouter::get(operationContext());
txnRouter.beginOrContinueTxn(
Reported by Cppcheck.