The following issues were found
src/mongo/db/operation_time_tracker_test.cpp
1 issues
Line: 44
ASSERT_TRUE(opTimeTracker.getMaxOperationTime() == LogicalTime::kUninitialized);
}
TEST(OperationTimeTracker, UpdateOperationTimeStoresTime) {
OperationTimeTracker opTimeTracker;
LogicalTime time(Timestamp(10));
opTimeTracker.updateOperationTime(time);
Reported by Cppcheck.
src/mongo/db/ops/write_ops_parsers_test.cpp
1 issues
Line: 57
}
}
TEST(CommandWriteOpsParsers, CommonFields_Ordered) {
for (bool ordered : {true, false}) {
auto cmd = BSON("insert"
<< "bar"
<< "documents" << BSON_ARRAY(BSONObj()) << "ordered" << ordered);
for (bool seq : {false, true}) {
Reported by Cppcheck.
src/mongo/db/ops/write_ops_retryability_test.cpp
1 issues
Line: 113
return request;
}
TEST_F(WriteOpsRetryability, ParseOplogEntryForUpdate) {
const auto entry = assertGet(repl::OplogEntry::parse(
BSON("ts" << Timestamp(50, 10) << "t" << 1LL << "op"
<< "u"
<< "ns"
<< "a.b"
Reported by Cppcheck.
src/mongo/db/persistent_task_store_test.cpp
1 issues
Line: 82
}
};
TEST_F(PersistentTaskStoreTest, TestAdd) {
auto opCtx = operationContext();
PersistentTaskStore<TestTask> store(kNss);
store.add(opCtx, TestTask{"one", 0, 10});
Reported by Cppcheck.
src/mongo/db/pipeline/accumulator_js_test.cpp
1 issues
Line: 137
}
}
TEST_F(MapReduceFixture, InternalJsReduceProducesExpectedResults) {
// Null value.
assertExpectedResults<AccumulatorInternalJsReduce>(
getExpCtx(),
"function(key, value) { return null; };",
{Value(DOC("k" << 1 << "v" << Value(BSONNULL)))},
Reported by Cppcheck.
src/mongo/db/pipeline/accumulator_test.cpp
1 issues
Line: 120
}
}
TEST(Accumulators, Avg) {
auto expCtx = ExpressionContextForTest{};
assertExpectedResults<AccumulatorAvg>(
&expCtx,
{
// No documents evaluated.
Reported by Cppcheck.
src/mongo/db/pipeline/aggregation_request_test.cpp
1 issues
Line: 59
// Parsing
//
TEST(AggregationRequestTest, ShouldParseAllKnownOptions) {
// Using oplog namespace so that validation of $_requestReshardingResumeToken succeeds.
NamespaceString nss("local.oplog.rs");
BSONObj inputBson = fromjson(
"{aggregate: 'oplog.rs', pipeline: [{$match: {a: 'abc'}}], explain: false, allowDiskUse: "
"true, fromMongos: true, "
Reported by Cppcheck.
src/mongo/db/pipeline/dependencies_test.cpp
1 issues
Line: 55
return out;
}
TEST(DependenciesTest, CheckClassConstants) {
ASSERT_TRUE(DepsTracker::kAllGeoNearData[DocumentMetadataFields::kGeoNearPoint]);
ASSERT_TRUE(DepsTracker::kAllGeoNearData[DocumentMetadataFields::kGeoNearDist]);
ASSERT_EQ(DepsTracker::kAllGeoNearData.count(), 2);
ASSERT_TRUE(DepsTracker::kAllMetadata.all());
ASSERT_EQ(DepsTracker::kOnlyTextScore.count(), 1);
Reported by Cppcheck.
src/mongo/db/pipeline/dispatch_shard_pipeline_test.cpp
1 issues
Line: 75
future.default_timed_get();
}
TEST_F(DispatchShardPipelineTest, DoesSplitPipelineIfMatchSpansTwoShards) {
// Sharded by {_id: 1}, [MinKey, 0) on shard "0", [0, MaxKey) on shard "1".
setupNShards(2);
loadRoutingTableWithTwoChunksAndTwoShards(kTestAggregateNss);
auto stages = std::vector{
fromjson("{$match: {_id: {$gte: -10}}}"),
Reported by Cppcheck.
src/mongo/db/pipeline/document_path_support_test.cpp
1 issues
Line: 53
const ValueComparator kDefaultValueComparator{};
TEST(VisitAllValuesAtPathTest, NestedObjectWithScalarValue) {
auto values = kDefaultValueComparator.makeUnorderedValueSet();
auto callback = [&values](const Value& val) { values.insert(val); };
Document doc{{"a", Document{{"b", 1}}}};
visitAllValuesAtPath(doc, FieldPath("a.b"), callback);
ASSERT_EQ(values.size(), 1UL);
Reported by Cppcheck.