summaryrefslogtreecommitdiff
path: root/src/mongo/executor/network_interface_mock_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/executor/network_interface_mock_test.cpp')
-rw-r--r--src/mongo/executor/network_interface_mock_test.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/mongo/executor/network_interface_mock_test.cpp b/src/mongo/executor/network_interface_mock_test.cpp
index 7ab98d5a969..c3f419a391f 100644
--- a/src/mongo/executor/network_interface_mock_test.cpp
+++ b/src/mongo/executor/network_interface_mock_test.cpp
@@ -70,23 +70,23 @@ TEST_F(NetworkInterfaceMockTest, ConnectionHook) {
Milliseconds(30)};
// need to copy as it will be moved
- auto helloReplyData = BSON("iamyour"
- << "father");
+ auto isMasterReplyData = BSON("iamyour"
+ << "father");
- RemoteCommandResponse helloReply{helloReplyData.copy(), Milliseconds(20)};
+ RemoteCommandResponse isMasterReply{isMasterReplyData.copy(), Milliseconds(20)};
- net().setHandshakeReplyForHost(testHost(), std::move(helloReply));
+ net().setHandshakeReplyForHost(testHost(), std::move(isMasterReply));
// Since the contract of these methods is that they do not throw, we run the ASSERTs in
// the test scope.
net().setConnectionHook(makeTestHook(
[&](const HostAndPort& remoteHost,
const BSONObj&,
- const RemoteCommandResponse& helloReply) {
+ const RemoteCommandResponse& isMasterReply) {
validateCalled = true;
hostCorrectForValidate = (remoteHost == testHost());
- replyCorrectForValidate =
- SimpleBSONObjComparator::kInstance.evaluate(helloReply.data == helloReplyData);
+ replyCorrectForValidate = SimpleBSONObjComparator::kInstance.evaluate(
+ isMasterReply.data == isMasterReplyData);
return Status::OK();
},
[&](const HostAndPort& remoteHost) {
@@ -169,8 +169,9 @@ TEST_F(NetworkInterfaceMockTest, ConnectionHook) {
TEST_F(NetworkInterfaceMockTest, ConnectionHookFailedValidation) {
net().setConnectionHook(makeTestHook(
- [&](const HostAndPort& remoteHost, const BSONObj&, const RemoteCommandResponse& helloReply)
- -> Status {
+ [&](const HostAndPort& remoteHost,
+ const BSONObj&,
+ const RemoteCommandResponse& isMasterReply) -> Status {
// We just need some obscure non-OK code.
return {ErrorCodes::ConflictingOperationInProgress, "blah"};
},
@@ -198,7 +199,7 @@ TEST_F(NetworkInterfaceMockTest, ConnectionHookFailedValidation) {
{
net().enterNetwork();
// We should have short-circuited the network and immediately called the callback.
- // If we change "hello" replies to go through the normal network mechanism,
+ // If we change isMaster replies to go through the normal network mechanism,
// this test will need to change.
ASSERT(!net().hasReadyRequests());
net().exitNetwork();
@@ -211,8 +212,9 @@ TEST_F(NetworkInterfaceMockTest, ConnectionHookFailedValidation) {
TEST_F(NetworkInterfaceMockTest, ConnectionHookNoRequest) {
bool makeRequestCalled = false;
net().setConnectionHook(makeTestHook(
- [&](const HostAndPort& remoteHost, const BSONObj&, const RemoteCommandResponse& helloReply)
- -> Status { return Status::OK(); },
+ [&](const HostAndPort& remoteHost,
+ const BSONObj&,
+ const RemoteCommandResponse& isMasterReply) -> Status { return Status::OK(); },
[&](const HostAndPort& remoteHost) -> StatusWith<boost::optional<RemoteCommandRequest>> {
makeRequestCalled = true;
return {boost::none};
@@ -246,8 +248,9 @@ TEST_F(NetworkInterfaceMockTest, ConnectionHookNoRequest) {
TEST_F(NetworkInterfaceMockTest, ConnectionHookMakeRequestFails) {
bool makeRequestCalled = false;
net().setConnectionHook(makeTestHook(
- [&](const HostAndPort& remoteHost, const BSONObj&, const RemoteCommandResponse& helloReply)
- -> Status { return Status::OK(); },
+ [&](const HostAndPort& remoteHost,
+ const BSONObj&,
+ const RemoteCommandResponse& isMasterReply) -> Status { return Status::OK(); },
[&](const HostAndPort& remoteHost) -> StatusWith<boost::optional<RemoteCommandRequest>> {
makeRequestCalled = true;
return {ErrorCodes::InvalidSyncSource, "blah"};
@@ -282,8 +285,9 @@ TEST_F(NetworkInterfaceMockTest, ConnectionHookMakeRequestFails) {
TEST_F(NetworkInterfaceMockTest, ConnectionHookHandleReplyFails) {
bool handleReplyCalled = false;
net().setConnectionHook(makeTestHook(
- [&](const HostAndPort& remoteHost, const BSONObj&, const RemoteCommandResponse& helloReply)
- -> Status { return Status::OK(); },
+ [&](const HostAndPort& remoteHost,
+ const BSONObj&,
+ const RemoteCommandResponse& isMasterReply) -> Status { return Status::OK(); },
[&](const HostAndPort& remoteHost) -> StatusWith<boost::optional<RemoteCommandRequest>> {
return boost::make_optional<RemoteCommandRequest>({});
},