The following issues were found
src/mongo/executor/connection_pool_test.cpp
1 issues
Line: 116
* Verify that we get the same connection if we grab one, return it and grab
* another.
*/
TEST_F(ConnectionPoolTest, SameConn) {
auto pool = makePool();
// Grab and stash an id for the first request
size_t conn1Id = 0;
ConnectionImpl::pushSetup(Status::OK());
Reported by Cppcheck.
src/mongo/executor/mock_network_fixture_test.cpp
1 issues
Line: 115
std::vector<RemoteCommandOnAnyResponse> _responses;
};
TEST_F(MockNetworkTest, MockFixtureBasicTest) {
mock().expect(kExampleCmdName, kExampleResponse);
RemoteCommandRequestOnAny request{kExampleRequest};
ASSERT_OK(startCommand(request));
Reported by Cppcheck.
src/mongo/executor/network_interface_integration_test.cpp
1 issues
Line: 70
return false;
}
TEST_F(NetworkInterfaceIntegrationFixture, Ping) {
startNet();
assertCommandOK("admin", BSON("ping" << 1));
}
TEST_F(NetworkInterfaceIntegrationFixture, PingWithoutStartup) {
Reported by Cppcheck.
src/mongo/executor/network_interface_mock_test.cpp
1 issues
Line: 170
ASSERT(gotCorrectCommandReply);
}
TEST_F(NetworkInterfaceMockTest, ConnectionHookFailedValidation) {
net().setConnectionHook(makeTestHook(
[&](const HostAndPort& remoteHost,
const BSONObj&,
const RemoteCommandResponse& isMasterReply) -> Status {
// We just need some obscure non-OK code.
Reported by Cppcheck.
src/mongo/executor/network_interface_perf_test.cpp
1 issues
Line: 102
return t.millis();
}
TEST(NetworkInterfaceASIO, SerialPerf) {
NetworkInterfaceASIO::Options options{};
options.streamFactory = std::make_unique<AsyncStreamFactory>();
options.timerFactory = std::make_unique<AsyncTimerFactoryASIO>();
NetworkInterfaceASIO netAsio{std::move(options)};
Reported by Cppcheck.
src/mongo/executor/network_interface_tl.cpp
1 issues
Line: 852
returnConnection(status);
const auto commandStatus = getStatusFromCommandResult(response.data);
if (isHedge) {
// Ignore maxTimeMS expiration, StaleDbVersion or any error belonging to
// StaleShardVersionError
// error category for hedged reads without triggering the finish line.
if (commandStatus == ErrorCodes::MaxTimeMSExpired ||
commandStatus == ErrorCodes::StaleDbVersion ||
Reported by Cppcheck.
src/mongo/executor/scoped_task_executor_test.cpp
1 issues
Line: 129
boost::optional<ScopedTaskExecutor> _executor;
};
TEST_F(ScopedTaskExecutorTest, onEvent) {
auto pf = makePromiseFuture<void>();
auto event = uassertStatusOK(getExecutor()->makeEvent());
ASSERT(getExecutor()
Reported by Cppcheck.
src/mongo/executor/task_executor_cursor_integration_test.cpp
1 issues
Line: 71
// Test that we can actually use a TaskExecutorCursor to read multiple batches from a remote host
TEST_F(TaskExecutorCursorFixture, Basic) {
auto client = _serviceCtx->makeClient("TaskExecutorCursorTest");
auto opCtx = client->makeOperationContext();
// Write 100 documents to "test.test" via dbclient
auto swConn = unittest::getFixtureConnectionString().connect("TaskExecutorCursorTest");
Reported by Cppcheck.
src/mongo/executor/task_executor_cursor_test.cpp
1 issues
Line: 120
/**
* Ensure we work for a single simple batch
*/
TEST_F(TaskExecutorCursorFixture, SingleBatchWorks) {
const auto findCmd = BSON("find"
<< "test"
<< "batchSize" << 2);
const CursorId cursorId = 0;
Reported by Cppcheck.
src/mongo/executor/thread_pool_task_executor_integration_test.cpp
1 issues
Line: 128
};
};
TEST_F(TaskExecutorFixture, RunExhaustShouldReceiveMultipleResponses) {
auto client = _serviceCtx->makeClient("TaskExecutorExhaustTest");
auto opCtx = client->makeOperationContext();
RemoteCommandRequest rcr(unittest::getFixtureConnectionString().getServers().front(),
"admin",
Reported by Cppcheck.