The following issues were found
src/mongo/db/repl/tenant_all_database_cloner_test.cpp
1 issues
Line: 84
const std::string _tenantDbB = _tenantId + "_b";
};
TEST_F(TenantAllDatabaseClonerTest, FailsOnListDatabases) {
Status expectedResult{ErrorCodes::BadValue, "foo"};
_mockServer->setCommandReply("listDatabases", expectedResult);
_mockServer->setCommandReply("find", createFindResponse());
auto cloner = makeAllDatabaseCloner();
Reported by Cppcheck.
src/mongo/db/repl/tenant_collection_cloner.cpp
1 issues
Line: 352
CWE codes:
758
auto fieldsToReturn = BSON("_id" << 1);
_lastDocId =
client.findOne(_existingNss->ns(), Query().sort(BSON("_id" << -1)), &fieldsToReturn);
if (!_lastDocId.isEmpty()) {
// The collection is not empty. Skip creating indexes and resume cloning from the last
// document.
skipCreateIndexes = true;
_readyIndexSpecs.clear();
Reported by Cppcheck.
src/mongo/db/repl/tenant_collection_cloner_test.cpp
1 issues
Line: 212
const NamespaceString _nss = {_tenantId + "_testDb", "testcoll"};
};
TEST_F(TenantCollectionClonerTest, CountStage) {
auto cloner = makeCollectionCloner();
cloner->setStopAfterStage_forTest("count");
_mockServer->setCommandReply("count", createCountResponse(100));
ASSERT_OK(cloner->run());
ASSERT_EQ(100, getProgressMeter(cloner.get()).total());
Reported by Cppcheck.
src/mongo/db/repl/tenant_database_cloner_test.cpp
1 issues
Line: 135
};
// A database may have no collections. Nothing to do for the tenant database cloner.
TEST_F(TenantDatabaseClonerTest, ListCollectionsReturnedNoCollections) {
_mockServer->setCommandReply("listCollections", createListCollectionsResponse({}));
_mockServer->setCommandReply("find", createFindResponse());
auto cloner = makeDatabaseCloner();
ASSERT_OK(cloner->run());
Reported by Cppcheck.
src/mongo/db/repl/tenant_migration_access_blocker_util_test.cpp
1 issues
Line: 62
};
TEST_F(TenantMigrationAccessBlockerUtilTest, HasActiveTenantMigrationInitiallyFalse) {
ASSERT_FALSE(tenant_migration_access_blocker::hasActiveTenantMigration(opCtx(), kTenantDB));
}
TEST_F(TenantMigrationAccessBlockerUtilTest, HasActiveTenantMigrationTrueWithDonor) {
auto donorMtab = std::make_shared<TenantMigrationDonorAccessBlocker>(
Reported by Cppcheck.
src/mongo/db/repl/tenant_migration_donor_service_test.cpp
1 issues
Line: 175
#ifdef MONGO_CONFIG_SSL
TEST_F(TenantMigrationDonorServiceTest, CheckSettingMigrationStartDate) {
// Advance the clock by some arbitrary amount of time so we are not starting at 0 seconds.
_clkSource->advance(Milliseconds(10000));
auto taskFp =
globalFailPointRegistry().find("pauseTenantMigrationAfterPersistingInitialDonorStateDoc");
Reported by Cppcheck.
src/mongo/db/repl/tenant_migration_recipient_access_blocker_test.cpp
1 issues
Line: 123
ServiceContext::UniqueOperationContext _opCtx;
};
TEST_F(TenantMigrationRecipientAccessBlockerTest, NoopFunctions) {
TenantMigrationRecipientAccessBlocker mtab(
getServiceContext(), getMigrationId(), getTenantId(), getDonorConnectionString());
// These functions are noop functions and should not throw even in reject state.
ASSERT_OK(mtab.checkIfCanWrite(Timestamp()));
Reported by Cppcheck.
src/mongo/db/repl/tenant_migration_recipient_entry_helpers_test.cpp
1 issues
Line: 110
};
#ifdef MONGO_CONFIG_SSL
TEST_F(TenantMigrationRecipientEntryHelpersTest, AddTenantMigrationRecipientStateDoc) {
auto opCtx = cc().makeOperationContext();
const UUID migrationUUID = UUID::gen();
TenantMigrationRecipientDocument activeTenantAStateDoc(
migrationUUID,
Reported by Cppcheck.
src/mongo/db/repl/tenant_migration_recipient_service_test.cpp
1 issues
Line: 472
};
#ifdef MONGO_CONFIG_SSL
TEST_F(TenantMigrationRecipientServiceTest, BasicTenantMigrationRecipientServiceInstanceCreation) {
stopFailPointEnableBlock fp("fpAfterPersistingTenantMigrationRecipientInstanceStateDoc");
const UUID migrationUUID = UUID::gen();
TenantMigrationRecipientDocument initialStateDocument(
Reported by Cppcheck.
src/mongo/db/repl/tenant_oplog_applier_test.cpp
1 issues
Line: 200
logv2::LogComponent::kTenantMigration, logv2::LogSeverity::Debug(1)};
};
TEST_F(TenantOplogApplierTest, NoOpsForSingleBatch) {
std::vector<OplogEntry> srcOps;
srcOps.push_back(makeInsertOplogEntry(1, NamespaceString(dbName, "foo"), UUID::gen()));
srcOps.push_back(makeInsertOplogEntry(2, NamespaceString(dbName, "bar"), UUID::gen()));
pushOps(srcOps);
Reported by Cppcheck.