The following issues were found
src/mongo/transport/service_executor_test.cpp
1 issues
Line: 142
}
};
TEST_F(ServiceExecutorSynchronousTest, BasicTaskRuns) {
unittest::Barrier barrier(2);
ServiceExecutorSynchronous executor(getGlobalServiceContext());
ASSERT_OK(executor.start());
ASSERT_OK(executor.scheduleTask([&] { barrier.countDownAndWait(); }, {}));
barrier.countDownAndWait();
Reported by Cppcheck.
src/mongo/transport/service_state_machine_test.cpp
1 issues
Line: 782
: ServiceStateMachineTest(ServiceExecutor::ThreadingModel::kBorrowed) {}
};
TEST_F(ServiceStateMachineTest, StartThenEndSession) {
initNewSession();
startSession();
ASSERT_EQ(popIngressState(), IngressState::kSource);
Reported by Cppcheck.
src/mongo/transport/session_asio.h
1 issues
Line: 169
Column: 18
CWE codes:
120
20
Future<Message> sourceMessageImpl(const BatonHandle& baton = nullptr);
template <typename MutableBufferSequence>
Future<void> read(const MutableBufferSequence& buffers, const BatonHandle& baton = nullptr);
template <typename ConstBufferSequence>
Future<void> write(const ConstBufferSequence& buffers, const BatonHandle& baton = nullptr);
template <typename Stream, typename MutableBufferSequence>
Reported by FlawFinder.
src/mongo/transport/transport_layer_asio_test.cpp
1 issues
Line: 136
int _port;
};
TEST(TransportLayerASIO, PortZeroConnect) {
ServiceEntryPointUtil sepu;
auto options = [] {
ServerGlobalParams params;
params.noUnixSocket = true;
Reported by Cppcheck.
src/mongo/unittest/assert_that_test.cpp
1 issues
Line: 69
ASSERT_EQ(failStr, "value: x + 1, actual: 457, expected: Eq(123)");
}
TEST(AssertThat, MatcherDescribe) {
ASSERT_EQ(Eq(123).describe(), "Eq(123)");
ASSERT_EQ(Not(Eq(123)).describe(), "Not(Eq(123))");
}
TEST(AssertThat, AllOf) {
Reported by Cppcheck.
src/mongo/unittest/fixture_test.cpp
1 issues
Line: 74
// vvvvvvvvvvvvvvvvvvvvvvvv Do not add tests below
// This needs to be the very first test. Please, see NOTE above.
TEST_F(TestFixture, SetUpTest) {
ASSERT_EQUALS(_num_set_ups, 1);
ASSERT_EQUALS(_num_tear_downs, 0);
}
// This needs to be the second test. Please, see NOTE above.
Reported by Cppcheck.
src/mongo/unittest/integration_test_main.cpp
1 issues
Line: 110
uassertStatusOK(env.validate());
uassertStatusOK(validateBaseOptions(env));
if (env.count("help")) {
std::cout << opts.helpString() << std::endl;
quickExit(EXIT_SUCCESS);
}
}
Reported by Cppcheck.
src/mongo/unittest/thread_assertion_monitor_test.cpp
1 issues
Line: 45
monitor.notifyDone(); // Somebody always has to call notifyDone or dtor will wait forever.
}
TEST(ThreadAssertionMonitor, ControllerInStdxThread) {
ThreadAssertionMonitor monitor;
stdx::thread{[&] { monitor.notifyDone(); }}.join();
}
TEST(ThreadAssertionMonitor, OnlyControllerInSpawn) {
Reported by Cppcheck.
src/mongo/unittest/unittest_test.cpp
1 issues
Line: 64
mongo::unittest::TestAssertionFailureException, \
([&](const auto& ex) { ASSERT_STRING_CONTAINS(ex.getMessage(), (PATTERN)); }))
TEST(UnitTestSelfTest, DoNothing) {}
void throwSomething() {
throw std::exception();
}
Reported by Cppcheck.
src/mongo/util/alarm_test.cpp
1 issues
Line: 105
ASSERT_EQ(shutdownStatus.code(), ErrorCodes::ShutdownInProgress);
}
TEST(AlarmRunner, BasicTest) {
auto clockSource = std::make_unique<ClockSourceMock>();
auto scheduler = std::make_shared<AlarmSchedulerPrecise>(clockSource.get());
AlarmRunnerBackgroundThread runner({scheduler});
runner.start();
Reported by Cppcheck.