The following issues were found
src/mongo/rpc/protocol_test.cpp
1 issues
Line: 57
ASSERT_TRUE(negotiated.getValue() == proto);
};
TEST(Protocol, SuccessfulNegotiation) {
assert_negotiated(supports::kAll, supports::kAll, Protocol::kOpMsg);
assert_negotiated(supports::kAll, supports::kOpMsgOnly, Protocol::kOpMsg);
assert_negotiated(supports::kAll, supports::kOpQueryOnly, Protocol::kOpQuery);
}
Reported by Cppcheck.
src/mongo/rpc/reply_builder_test.cpp
1 issues
Line: 52
template <typename T>
void testErrors(rpc::ReplyBuilderInterface& replyBuilder);
TEST(LegacyReplyBuilder, RoundTrip) {
rpc::LegacyReplyBuilder r;
testRoundTrip<rpc::LegacyReply>(r, true);
}
TEST(OpMsgReplyBuilder, RoundTrip) {
Reported by Cppcheck.
src/mongo/rpc/rewrite_state_change_errors_test.cpp
1 issues
Line: 101
};
// Rewrite Shutdown errors received from proxied commands.
TEST_F(RewriteStateChangeErrorsTest, Enabled) {
for (auto&& [in, out] : errorCodeScenarios) {
ASSERT_BSONOBJ_EQ(rewriteObj(errorObject(in)), errorObject(out));
}
}
Reported by Cppcheck.
src/mongo/s/append_raw_responses_test.cpp
1 issues
Line: 219
// No errors
//
TEST_F(AppendRawResponsesTest, AllShardsReturnSuccess) {
std::vector<AsyncRequestsSender::Response> shardResponses{
{kShard1, kOkResponse, makeHostAndPort(kShard1)},
{kShard2, kOkResponse, makeHostAndPort(kShard2)},
{kShard3, kOkResponse, makeHostAndPort(kShard3)}};
Reported by Cppcheck.
src/mongo/s/balancer_configuration_test.cpp
1 issues
Line: 103
}
};
TEST_F(BalancerConfigurationTestFixture, NoConfigurationDocuments) {
configTargeter()->setFindHostReturnValue(HostAndPort("TestHost1"));
BalancerConfiguration config;
auto future = launchAsync([&] { ASSERT_OK(config.refreshAndCheck(operationContext())); });
Reported by Cppcheck.
src/mongo/s/build_versioned_requests_for_targeted_shards_test.cpp
1 issues
Line: 110
// Database is not sharded
//
TEST_F(BuildVersionedRequestsForTargetedShardsTest, ReturnPrimaryShardForUnshardedDatabase) {
auto future = scheduleRoutingInfoUnforcedRefresh(kNss);
expectGetDatabaseUnsharded();
expectGetCollectionUnsharded();
Reported by Cppcheck.
src/mongo/s/catalog/sharding_catalog_client_test.cpp
1 issues
Line: 85
using ShardingCatalogClientTest = ShardingTestFixture;
TEST_F(ShardingCatalogClientTest, GetCollectionExisting) {
configTargeter()->setFindHostReturnValue(HostAndPort("TestHost1"));
CollectionType expectedColl(
NamespaceString("TestDB.TestNS"), OID::gen(), Date_t::now(), UUID::gen());
expectedColl.setKeyPattern(BSON("KeyName" << 1));
Reported by Cppcheck.
src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp
1 issues
Line: 83
"Mock duplicate key error"};
}
TEST_F(InsertRetryTest, RetryOnInterruptedAndNetworkErrorSuccess) {
configTargeter()->setFindHostReturnValue({kTestHosts[0]});
BSONObj objToInsert = BSON("_id" << 1 << "Value"
<< "TestValue");
Reported by Cppcheck.
src/mongo/s/catalog/type_changelog_test.cpp
1 issues
Line: 42
using namespace mongo;
TEST(ChangeLogType, Empty) {
auto changeLogResult = ChangeLogType::fromBSON(BSONObj());
ASSERT_NOT_OK(changeLogResult.getStatus());
}
TEST(ChangeLogType, Valid) {
Reported by Cppcheck.
src/mongo/s/catalog/type_chunk_test.cpp
1 issues
Line: 49
const BSONObj kMax = BSON("a" << 20);
const ShardId kShard("shard0000");
TEST(ChunkType, MissingConfigRequiredFields) {
const auto collEpoch = OID::gen();
const auto collTimestamp = boost::none;
ChunkVersion chunkVersion(1, 2, collEpoch, collTimestamp);
Reported by Cppcheck.