The following issues were found
src/mongo/client/sdam/server_description_test.cpp
1 issues
Line: 60
ASSERT_EQUALS(a, b);
}
TEST(ServerDescriptionEqualityTest, ShouldCompareDifferentAddressButSameServerTypeAsEqual) {
// Note: The SDAM specification does not prescribe how to compare server descriptions with
// different addresses for equality. We choose that two descriptions are considered equal if
// their addresses are different.
auto a = *ServerDescriptionBuilder()
.withAddress(HostAndPort("foo:1234"))
Reported by Cppcheck.
src/mongo/client/sdam/server_selector_test.cpp
1 issues
Line: 142
SdamServerSelector selector = SdamServerSelector(sdamConfiguration);
};
TEST_F(ServerSelectorTestFixture, ShouldFilterCorrectlyByLatencyWindow) {
const auto delta = Milliseconds(10);
const auto windowWidth = Milliseconds(100);
const auto lowerBound = Milliseconds(100);
auto window = LatencyWindow(lowerBound, windowWidth);
Reported by Cppcheck.
src/mongo/client/sdam/topology_description_test.cpp
1 issues
Line: 93
ASSERT_EQUALS(boost::none, topologyDescription.getLogicalSessionTimeoutMinutes());
}
TEST_F(TopologyDescriptionTestFixture, ShouldHaveCorrectDefaultValues) {
assertDefaultConfig(TopologyDescription(kDefaultConfig));
assertDefaultConfig(TopologyDescription());
}
// Disable this test since this causes failures in jstests running on
Reported by Cppcheck.
src/mongo/client/sdam/topology_listener_test.cpp
1 issues
Line: 80
executor::NetworkInterfaceMock* _net;
};
TEST_F(TopologyListenerTestFixture, TestListeners) {
std::shared_ptr<sdam::TopologyListenerMock> l1 = std::make_shared<sdam::TopologyListenerMock>();
std::shared_ptr<sdam::TopologyListenerMock> l2 = std::make_shared<sdam::TopologyListenerMock>();
getEventsPublisher()->registerListener(l1);
getEventsPublisher()->registerListener(l2);
Reported by Cppcheck.
src/mongo/client/sdam/topology_manager_test.cpp
1 issues
Line: 75
.obj();
};
TEST_F(TopologyManagerTestFixture, ShouldUpdateTopologyVersionOnSuccess) {
auto config = SdamConfiguration(kOneServer);
TopologyManagerImpl topologyManager(config, clockSource);
auto topologyDescription = topologyManager.getTopologyDescription();
ASSERT_EQUALS(topologyDescription->getServers().size(), 1);
Reported by Cppcheck.
src/mongo/client/sdam/topology_state_machine_test.cpp
1 issues
Line: 132
};
};
TEST_F(TopologyStateMachineTestFixture, ShouldInstallServerDescriptionInSingleTopology) {
TopologyStateMachine stateMachine(kSingleConfig);
auto topologyDescription = std::make_shared<TopologyDescription>(kSingleConfig);
auto updatedMeAddress = HostAndPort("foo:1234");
auto serverDescription = ServerDescriptionBuilder()
Reported by Cppcheck.
src/mongo/client/server_discovery_monitor_expedited_test.cpp
1 issues
Line: 67
static inline const auto kZeroMs = Milliseconds(0);
};
TEST_F(SingleServerDiscoveryMonitorExpeditedFixture, NoPreviousRequest) {
verifyTestCase(TestCase{boost::none, kLongRefreshPeriod, Milliseconds(0)});
verifyTestCase(TestCase{boost::none, kExpeditedRefreshPeriod, Milliseconds(0)});
}
TEST_F(SingleServerDiscoveryMonitorExpeditedFixture,
Reported by Cppcheck.
src/mongo/client/server_discovery_monitor_test.cpp
1 issues
Line: 278
* Checks that a SingleServerDiscoveryMonitor sends isMaster requests at least heartbeatFrequency
* apart.
*/
TEST_F(ServerDiscoveryMonitorTestFixture, heartbeatFrequencyCheck) {
auto replSet = std::make_unique<MockReplicaSet>(
"test", 1, /* hasPrimary = */ false, /* dollarPrefixHosts = */ false);
auto hostAndPort = HostAndPort(replSet->getSecondaries()[0]);
const auto config = SdamConfiguration(std::vector<HostAndPort>{hostAndPort});
Reported by Cppcheck.
src/mongo/client/server_ping_monitor_test.cpp
1 issues
Line: 282
HostAndPort _hostAndPort;
};
TEST_F(SingleServerPingMonitorTest, pingFrequencyCheck) {
auto pingFrequency = Seconds(10);
auto ssPingMonitor = initSingleServerPingMonitor(pingFrequency);
checkSinglePing(pingFrequency);
checkSinglePing(pingFrequency);
Reported by Cppcheck.
src/mongo/client/streamable_replica_set_monitor_error_handler_test.cpp
1 issues
Line: 130
static constexpr int kThreeAttempts = 3;
};
TEST_F(StreamableReplicaSetMonitorErrorHandlerTestFixture, ApplicationNetworkErrorsPreHandshake) {
testScenario(
HandshakeStage::kPreHandshake,
kApplicationOperation,
kNetworkErrors,
StreamableReplicaSetMonitorErrorHandler::ErrorActions{true, false, kErrorHelloOutcome});
Reported by Cppcheck.