The following issues were found

src/mongo/db/s/resharding_destined_recipient_test.cpp
1 issues
syntax error
Error

Line: 283

                  CatalogCacheLoaderMock* _mockCatalogCacheLoader;
};

TEST_F(DestinedRecipientTest, TestGetDestinedRecipient) {
    auto opCtx = operationContext();
    auto env = setupReshardingEnv(opCtx, true);

    AutoGetCollection coll(opCtx, kNss, MODE_IX);
    OperationShardingState::get(opCtx).initializeClientRoutingVersions(

            

Reported by Cppcheck.

src/mongo/db/s/session_catalog_migration_destination_test.cpp
1 issues
syntax error
Error

Line: 329

                  boost::optional<MigrationSessionId> _migrationId;
};

TEST_F(SessionCatalogMigrationDestinationTest, ShouldJoinProperlyWhenNothingToTransfer) {
    SessionCatalogMigrationDestination sessionMigration(kNs, kFromShard, migrationId());

    sessionMigration.start(getServiceContext());
    finishSessionExpectSuccess(&sessionMigration);
}

            

Reported by Cppcheck.

src/mongo/db/s/session_catalog_migration_source_test.cpp
1 issues
syntax error
Error

Line: 118

                                        needsRetryImage);
}

TEST_F(SessionCatalogMigrationSourceTest, NoSessionsToTransferShouldNotHaveOplog) {
    SessionCatalogMigrationSource migrationSource(opCtx(), kNs, kChunkRange, kShardKey);
    ASSERT_FALSE(migrationSource.fetchNextOplog(opCtx()));
    ASSERT_FALSE(migrationSource.hasMoreOplog());
}


            

Reported by Cppcheck.

src/mongo/db/s/shard_local_test.cpp
1 issues
syntax error
Error

Line: 166

                                                             limit);
}

TEST_F(ShardLocalTest, RunCommand) {
    NamespaceString nss("admin.bar");
    StatusWith<Shard::CommandResponse> findAndModifyResponse = runFindAndModifyRunCommand(
        nss, BSON("fooItem" << 1), BSON("$set" << BSON("fooRandom" << 254)));

    Shard::CommandResponse commandResponse = unittest::assertGet(findAndModifyResponse);

            

Reported by Cppcheck.

src/mongo/db/s/shard_metadata_util_test.cpp
1 issues
syntax error
Error

Line: 171

                  const UUID uuid = UUID::gen();
};

TEST_F(ShardMetadataUtilTest, UpdateAndReadCollectionsEntry) {
    ShardCollectionType updateShardCollectionType = setUpCollection();
    ShardCollectionType readShardCollectionType =
        assertGet(readShardCollectionsEntry(operationContext(), kNss));

    ASSERT_EQUALS(updateShardCollectionType.getUuid(), readShardCollectionType.getUuid());

            

Reported by Cppcheck.

src/mongo/db/s/shard_server_catalog_cache_loader_test.cpp
1 issues
syntax error
Error

Line: 223

                  return std::pair{collectionType, std::move(chunks)};
}

TEST_F(ShardServerCatalogCacheLoaderTest, PrimaryLoadFromUnshardedToUnsharded) {
    // Return a NamespaceNotFound error that means the collection doesn't exist.

    Status errorStatus = Status(ErrorCodes::NamespaceNotFound, "collection not found");
    _remoteLoaderMock->setCollectionRefreshReturnValue(errorStatus);


            

Reported by Cppcheck.

src/mongo/db/s/sharding_ddl_util_test.cpp
1 issues
syntax error
Error

Line: 107

              
// Test that config.collection document and config.chunks documents are properly updated from source
// to destination collection metadata
TEST_F(ShardingDDLUtilTest, ShardedRenameMetadata) {
    auto opCtx = operationContext();
    DBDirectClient client(opCtx);

    const NamespaceString fromNss("test.from");
    const auto fromCollQuery = Query(BSON(CollectionType::kNssFieldName << fromNss.ns()));

            

Reported by Cppcheck.

src/mongo/db/s/sharding_initialization_mongod_test.cpp
1 issues
syntax error
Error

Line: 159

                  ServiceContext* const _serviceContext;
};

TEST_F(ShardingInitializationMongoDTest, ValidShardIdentitySucceeds) {
    // Must hold a lock to call initializeFromShardIdentity.
    Lock::GlobalWrite lk(operationContext());

    ShardIdentityType shardIdentity;
    shardIdentity.setConfigsvrConnectionString(

            

Reported by Cppcheck.

src/mongo/db/s/sharding_initialization_op_observer_test.cpp
1 issues
syntax error
Error

Line: 88

                  int _initCallCount = 0;
};

TEST_F(ShardingInitializationOpObserverTest, GlobalInitGetsCalledAfterWriteCommits) {
    ShardIdentityType shardIdentity;
    shardIdentity.setConfigsvrConnectionString(
        ConnectionString(ConnectionString::ConnectionType::kReplicaSet, "a:1,b:2", "config"));
    shardIdentity.setShardName(kShardName);
    shardIdentity.setClusterId(OID::gen());

            

Reported by Cppcheck.

src/mongo/db/s/sharding_logging_test.cpp
1 issues
syntax error
Error

Line: 196

                  ChangeLogTest() : InfoLoggingTest(ChangeLog, 200 * 1024 * 1024) {}
};

TEST_F(ActionLogTest, NoRetryAfterSuccessfulCreate) {
    noRetryAfterSuccessfulCreate();
}
TEST_F(ChangeLogTest, NoRetryAfterSuccessfulCreate) {
    noRetryAfterSuccessfulCreate();
}

            

Reported by Cppcheck.