The following issues were found
src/mongo/db/s/migration_destination_manager_test.cpp
1 issues
Line: 70
};
// Tests that documents will ferry from the fetch logic to the insert logic successfully.
TEST_F(MigrationDestinationManagerTest, CloneDocumentsFromDonorWorksCorrectly) {
bool ranOnce = false;
auto fetchBatchFn = [&](OperationContext* opCtx, BSONObj* nextBatch) {
BSONObjBuilder fetchBatchResultBuilder;
Reported by Cppcheck.
src/mongo/db/s/migration_session_id_test.cpp
1 issues
Line: 44
using unittest::assertGet;
TEST(MigrationSessionId, GenerateAndExtract) {
MigrationSessionId origSessionId = MigrationSessionId::generate("Source", "Dest");
BSONObjBuilder builder;
origSessionId.append(&builder);
BSONObj obj = builder.obj();
Reported by Cppcheck.
src/mongo/db/s/migration_util_test.cpp
1 issues
Line: 103
// |---------O [40 50)
// 1 1 2 2 3 3 4 4 5
// 0----5----0----5----0----5----0----5----0----5----0
TEST_F(MigrationUtilsTest, TestOverlappingRangeQueryWithIntegerShardKey) {
auto opCtx = operationContext();
const auto uuid = UUID::gen();
PersistentTaskStore<RangeDeletionTask> store(NamespaceString::kRangeDeletionNamespace);
store.add(opCtx, createDeletionTask(opCtx, NamespaceString{"one"}, uuid, 0, 10));
Reported by Cppcheck.
src/mongo/db/s/namespace_metadata_change_notifications_test.cpp
1 issues
Line: 54
}
};
TEST_F(NamespaceMetadataChangeNotificationsTest, WaitForNotify) {
NamespaceMetadataChangeNotifications notifications;
auto scopedNotif = notifications.createNotification(kNss);
{
Reported by Cppcheck.
src/mongo/db/s/op_observer_sharding_test.cpp
1 issues
Line: 92
}
};
TEST_F(DeleteStateTest, MakeDeleteStateUnsharded) {
setCollectionFilteringMetadata(operationContext(), CollectionMetadata());
AutoGetCollection autoColl(operationContext(), kTestNss, MODE_IX);
auto doc = BSON("key3"
Reported by Cppcheck.
src/mongo/db/s/persistent_task_queue_test.cpp
1 issues
Line: 94
};
// Test that writes to the queue persist across instantiations.
TEST_F(PersistentTaskQueueTest, TestWritesPersistInstances) {
auto opCtx = operationContext();
{
PersistentTaskQueue<TestTask> q(opCtx, kNss);
Reported by Cppcheck.
src/mongo/db/s/range_deletion_util_test.cpp
1 issues
Line: 200
return t;
}
TEST_F(RangeDeleterTest,
RemoveDocumentsInRangeRemovesAllDocumentsInRangeWhenAllDocumentsFitInSingleBatch) {
const ChunkRange range(BSON(kShardKey << 0), BSON(kShardKey << 10));
const int numDocsToRemovePerBatch = 10;
auto queriesComplete = SemiFuture<void>::makeReady();
Reported by Cppcheck.
src/mongo/db/s/rename_collection_participant_service.cpp
1 issues
Line: 71
CWE codes:
587
1,
"Dropped target collection locally on renameCollection participant",
"namespace"_attr = nss,
"collectionExisted"_attr = knownNss);
}
/*
* Rename the collection if exists locally, otherwise simply drop the target collection.
*/
Reported by Cppcheck.
src/mongo/db/s/resharding/resharding_agg_test.cpp
1 issues
Line: 360
const int _term{20};
};
TEST_F(ReshardingAggTest, OplogPipelineBasicCRUDOnly) {
auto insertOplog = makeInsertOplog();
auto updateOplog = makeUpdateOplog();
auto deleteOplog = makeDeleteOplog();
std::deque<DocumentSource::GetNextResult> mockResults;
Reported by Cppcheck.
src/mongo/db/s/resharding/resharding_coordinator_commit_monitor_test.cpp
1 issues
Line: 208
_recipientShards.begin(), _recipientShards.end(), [&](const ShardId&) { onCommand(func); });
}
TEST_F(CoordinatorCommitMonitorTest, ComputesMinAndMaxRemainingTimes) {
auto future = launchAsync([this] {
ThreadClient tc(getServiceContext());
return getCommitMonitor()->queryRemainingOperationTimeForRecipients();
});
Reported by Cppcheck.