The following issues were found
src/mongo/dbtests/mock_replica_set_test.cpp
1 issues
Line: 61
ASSERT_EQUALS("n", replSet.getSetName());
}
TEST(MockReplicaSetTest, ConnectionString) {
MockReplicaSet replSet("n", 3);
ASSERT_EQUALS("n/$n0:27017,$n1:27017,$n2:27017", replSet.getConnectionString());
}
TEST(MockReplicaSetTest, GetNode) {
Reported by Cppcheck.
src/mongo/dbtests/multikey_paths_test.cpp
1 issues
Line: 128
}
};
TEST_F(MultikeyPathsTest, PathsUpdatedOnIndexCreation) {
AutoGetCollection collection(_opCtx.get(), _nss, MODE_X);
invariant(collection);
{
WriteUnitOfWork wuow(_opCtx.get());
Reported by Cppcheck.
src/mongo/dbtests/plan_executor_invalidation_test.cpp
1 issues
Line: 152
}
};
TEST_F(PlanExecutorInvalidationTest, ExecutorToleratesDeletedDocumentsDuringYield) {
auto exec = getCollscan();
BSONObj obj;
// Read some of it.
for (int i = 0; i < 10; ++i) {
Reported by Cppcheck.
src/mongo/dbtests/query_plan_executor.cpp
1 issues
Line: 199
/**
* Test dropping the collection while an agg PlanExecutor is doing an index scan.
*/
TEST_F(PlanExecutorTest, DropIndexScanAgg) {
dbtests::WriteContextForTests ctx(&_opCtx, nss.ns());
insert(BSON("_id" << 1 << "a" << 6));
insert(BSON("_id" << 2 << "a" << 7));
insert(BSON("_id" << 3 << "a" << 8));
Reported by Cppcheck.
src/mongo/dbtests/query_stage_cached_plan.cpp
1 issues
Line: 185
* Test that on a memory limit exceeded failure, the cached plan stage replans the query but does
* not create a new cache entry.
*/
TEST_F(QueryStageCachedPlan, QueryStageCachedPlanFailureMemoryLimitExceeded) {
AutoGetCollectionForReadCommand collection(&_opCtx, nss);
ASSERT(collection);
// Query can be answered by either index on "a" or index on "b".
auto findCommand = std::make_unique<FindCommandRequest>(nss);
Reported by Cppcheck.
src/mongo/dbtests/query_stage_multiplan.cpp
1 issues
Line: 227
// Basic ranking test: collection scan vs. highly selective index scan. Make sure we also get
// all expected results out as well.
TEST_F(QueryStageMultiPlanTest, MPSCollectionScanVsHighlySelectiveIXScan) {
const int N = 5000;
for (int i = 0; i < N; ++i) {
insert(BSON("foo" << (i % 10)));
}
Reported by Cppcheck.
src/mongo/dbtests/query_stage_near.cpp
1 issues
Line: 197
}
}
TEST_F(QueryStageNearTest, Basic) {
vector<BSONObj> mockData;
WorkingSet workingSet;
MockNearStage nearStage(_expCtx.get(), &workingSet, getCollection(), _mockGeoIndex);
Reported by Cppcheck.
src/mongo/dbtests/query_stage_sort_key_generator.cpp
1 issues
Line: 121
return extractKeyFromKeyGenStage(&sortKeyGen, &workingSet);
}
TEST(SortKeyGeneratorStageTest, SortKeyNormal) {
Value actualOut = extractSortKey("{a: 1}", "{_id: 0, a: 5}", nullptr);
Value expectedOut(5);
ASSERT_VALUE_EQ(actualOut, expectedOut);
}
Reported by Cppcheck.
src/mongo/dbtests/query_stage_subplan.cpp
1 issues
Line: 128
* should gracefully fail after finding that no cache data is available, allowing us to fall
* back to regular planning.
*/
TEST_F(QueryStageSubplanTest, QueryStageSubplanGeo2dOr) {
dbtests::WriteContextForTests ctx(opCtx(), nss.ns());
addIndex(BSON("a"
<< "2d"
<< "b" << 1));
addIndex(BSON("a"
Reported by Cppcheck.
src/mongo/dbtests/query_stage_trial.cpp
1 issues
Line: 110
boost::intrusive_ptr<ExpressionContext> _expCtx;
};
TEST_F(TrialStageTest, AdoptsTrialPlanIfTrialSucceeds) {
auto trialPlan = std::make_unique<MockStage>(_expCtx.get(), ws());
auto backupPlan = std::make_unique<MockStage>(_expCtx.get(), ws());
// Seed the trial plan with 20 results and no NEED_TIMEs.
std::vector<BSONObj> trialResults;
Reported by Cppcheck.