The following issues were found

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

Line: 95

                  const ShardKeyPattern kShardKeyPattern{BSON("x" << 1)};
};

TEST_F(CreateFirstChunksTest, Split_Disallowed_With_Both_SplitPoints_And_Zones) {
    CreateCollectionRequest request;
    std::vector<BSONObj> splitPoints = {BSONObj()};
    request.setNumInitialChunks(0);
    request.setPresplitHashedZones(false);
    request.setInitialSplitPoints(splitPoints);

            

Reported by Cppcheck.

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

Line: 59

                  const KeyPattern _keyPattern{BSON("a" << 1)};
};

TEST_F(SplitChunkTest, SplitExistingChunkCorrectlyShouldSucceed) {
    auto test = [&](const NamespaceString& nss, const boost::optional<Timestamp>& collTimestamp) {
        const auto collEpoch = OID::gen();
        const auto collUuid = UUID::gen();

        ChunkType chunk;

            

Reported by Cppcheck.

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

Line: 56

                  OID _clusterId;
};

TEST_F(ConfigServerOpObserverTest, NodeClearsCatalogManagerOnConfigVersionRollBack) {
    ConfigServerOpObserver opObserver;
    OpObserver::RollbackObserverInfo rbInfo;
    rbInfo.configServerConfigVersionRolledBack = true;

    opObserver.onReplicationRollback(operationContext(), rbInfo);

            

Reported by Cppcheck.

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

Line: 130

                  CatalogCacheLoaderMock* _mockCatalogCacheLoader;
};

TEST_F(DatabaseShardingStateTestWithMockedLoader, OnDbVersionMismatch) {
    const auto oldDb = createDatabase(UUID::gen(), Timestamp(1));
    const auto newDb = createDatabase(UUID::gen(), Timestamp(2));

    auto checkOnDbVersionMismatch = [&](const auto& newDb, bool expectRefresh) {
        const auto newDbVersion = newDb.getVersion();

            

Reported by Cppcheck.

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

Line: 97

                  ASSERT(repl::ReadConcernLevel::kMajorityReadConcern == readConcernArgs.getLevel());
}

TEST_F(DistLockCatalogReplSetTest, BasicPing) {
    auto future = launchOnSeparateThread([this](OperationContext* opCtx) {
        Date_t ping(dateFromISOString("2014-03-11T09:17:18.098Z").getValue());
        auto status = _distLockCatalog.ping(opCtx, "abcd", ping);
        ASSERT_OK(status);
    });

            

Reported by Cppcheck.

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

Line: 141

               * 2. Unlock (on destructor of ScopedDistLock).
 * 3. Check lock id used in lock and unlock are the same.
 */
TEST_F(DistLockManagerReplSetTest, BasicLockLifeCycle) {
    std::string lockName("test");
    Date_t now(Date_t::now());
    std::string whyMsg("because");

    LocksType retLockDoc;

            

Reported by Cppcheck.

src/mongo/db/s/drop_collection_coordinator.cpp
1 issues
Boolean value assigned to pointer.
Error

Line: 183 CWE codes: 587

                                          2,
                            "Dropping collection",
                            "namespace"_attr = nss(),
                            "sharded"_attr = collIsSharded);

                if (collIsSharded) {
                    invariant(_doc.getCollInfo());
                    const auto& coll = _doc.getCollInfo().get();
                    sharding_ddl_util::removeCollAndChunksMetadataFromConfig(

            

Reported by Cppcheck.

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

Line: 44

              
class ImplicitCollectionCreationTest : public ShardServerTestFixture {};

TEST_F(ImplicitCollectionCreationTest, ImplicitCreateDisallowedByDefault) {
    NamespaceString nss("ImplicitCreateDisallowedByDefaultDB.TestColl");
    AutoGetCollection autoColl(operationContext(), nss, MODE_IX);
    auto db = autoColl.ensureDbExists();
    WriteUnitOfWork wuow(operationContext());
    ASSERT_THROWS_CODE(

            

Reported by Cppcheck.

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

Line: 181

                  std::shared_ptr<MetadataManager> _manager;
};

TEST_F(MetadataManagerTest, TrackOrphanedDataCleanupBlocksOnScheduledRangeDeletions) {
    ChunkRange cr1(BSON("key" << 0), BSON("key" << 10));

    // Enable fail point to suspendRangeDeletion.
    globalFailPointRegistry().find("suspendRangeDeletion")->setMode(FailPoint::alwaysOn);


            

Reported by Cppcheck.

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

Line: 274

                  boost::optional<DBDirectClient> _client;
};

TEST_F(MigrationChunkClonerSourceLegacyTest, CorrectDocumentsFetched) {
    const std::vector<BSONObj> contents = {createCollectionDocument(99),
                                           createCollectionDocument(100),
                                           createCollectionDocument(199),
                                           createCollectionDocument(200)};


            

Reported by Cppcheck.