The following issues were found
src/mongo/db/s/sharding_util_refresh_test.cpp
1 issues
Line: 77
}
};
TEST_F(ShardingRefresherTest, refresherTwoShardsSucceed) {
auto opCtx = operationContext();
auto nss = NamespaceString("mydb", "mycoll");
auto future = launchAsync([&] {
sharding_util::tellShardsToRefreshCollection(opCtx, kShardIdList, nss, executor());
});
Reported by Cppcheck.
src/mongo/db/s/split_chunk_test.cpp
1 issues
Line: 194
onFindCommand([&](const RemoteCommandRequest& request) { return std::vector<BSONObj>(); });
}
TEST_F(SplitChunkTest, HashedKeyPatternNumberLongSplitKeys) {
BSONObj keyPatternObj = BSON("foo"
<< "hashed");
_coll.setKeyPattern(BSON("_id"
<< "hashed"));
Reported by Cppcheck.
src/mongo/db/s/split_vector_test.cpp
1 issues
Line: 91
const long long docSizeBytes = BSON(kPattern << 1).objsize();
};
TEST_F(SplitVectorTest, SplitVectorInHalf) {
std::vector<BSONObj> splitKeys = splitVector(operationContext(),
kNss,
BSON(kPattern << 1),
BSON(kPattern << 0),
BSON(kPattern << 100),
Reported by Cppcheck.
src/mongo/db/s/transaction_coordinator_catalog_test.cpp
1 issues
Line: 72
boost::optional<TransactionCoordinatorCatalog> _coordinatorCatalog;
};
TEST_F(TransactionCoordinatorCatalogTest, GetOnSessionThatDoesNotExistReturnsNone) {
LogicalSessionId lsid = makeLogicalSessionIdForTest();
TxnNumber txnNumber = 1;
auto coordinator = _coordinatorCatalog->get(operationContext(), lsid, txnNumber);
ASSERT(coordinator == nullptr);
}
Reported by Cppcheck.
src/mongo/db/s/transaction_coordinator_futures_util.cpp
1 issues
Line: 169
shard->updateReplSetMonitor(hostTargeted, status);
// Only consider actual failures to send the command as errors.
if (status.isOK()) {
auto commandStatus = getStatusFromCommandResult(args.response.data);
shard->updateReplSetMonitor(hostTargeted, commandStatus);
auto writeConcernStatus =
getWriteConcernStatusFromCommandResult(args.response.data);
Reported by Cppcheck.
src/mongo/db/s/transaction_coordinator_futures_util_test.cpp
1 issues
Line: 55
ASSERT_EQ(resultFuture.get(), 0);
}
TEST(TransactionCoordinatorFuturesUtilTest, CollectReturnsOnlyResultWhenOnlyOneFuture) {
std::vector<Future<int>> futures;
auto pf = makePromiseFuture<int>();
futures.push_back(std::move(pf.future));
auto resultFuture = txn::collect(std::move(futures), 0, [](int& result, const int& next) {
result = next;
Reported by Cppcheck.
src/mongo/db/s/transaction_coordinator_service_test.cpp
1 issues
Line: 197
using TransactionCoordinatorServiceStepUpStepDownTest = TransactionCoordinatorServiceTestFixture;
TEST_F(TransactionCoordinatorServiceStepUpStepDownTest, OperationsFailBeforeStepUpStarts) {
ASSERT_THROWS_CODE(service()->createCoordinator(
operationContext(), makeLogicalSessionIdForTest(), 0, kCommitDeadline),
AssertionException,
ErrorCodes::NotWritablePrimary);
Reported by Cppcheck.
src/mongo/db/s/transaction_coordinator_structures_test.cpp
1 issues
Line: 51
obj);
}
TEST(CoordinatorCommitDecisionTest, SerializeAbortHasNoTimestampAndAbortStatus) {
CoordinatorCommitDecision decision(CommitDecision::kAbort);
decision.setAbortStatus(Status(ErrorCodes::InternalError, "Test error"));
auto obj = decision.toBSON();
auto expectedObj = BSON("decision"
Reported by Cppcheck.
src/mongo/db/s/transaction_coordinator_test.cpp
1 issues
Line: 203
return prepareObj;
}
TEST_F(TransactionCoordinatorDriverTest, SendDecisionToParticipantShardReturnsOnImmediateSuccess) {
txn::AsyncWorkScheduler aws(getServiceContext());
Future<void> future = txn::sendDecisionToShard(getServiceContext(),
aws,
_lsid,
_txnNumber,
Reported by Cppcheck.
src/mongo/db/s/type_lockpings_test.cpp
1 issues
Line: 42
using namespace mongo;
TEST(Validity, MissingProcess) {
BSONObj objNoProcess = BSON(LockpingsType::ping(Date_t::now()));
auto lockpingsResult = LockpingsType::fromBSON(objNoProcess);
ASSERT_NOT_OK(lockpingsResult.getStatus());
}
Reported by Cppcheck.