diff options
author | Dianna Hohensee <dianna.hohensee@10gen.com> | 2018-01-17 10:43:14 -0500 |
---|---|---|
committer | Dianna Hohensee <dianna.hohensee@10gen.com> | 2018-02-16 16:30:44 -0500 |
commit | d1c188b17167f0430f5a8d10e972c0d00a908ba2 (patch) | |
tree | 8ce4510c4ec7507a17a2ad6719cf6695f5149b4b /src/mongo/rpc/protocol_test.cpp | |
parent | 902b8552f11697308604823c19d6dbce661fc3d6 (diff) | |
download | mongo-d1c188b17167f0430f5a8d10e972c0d00a908ba2.tar.gz |
SERVER-32635 an old mongos server communicating with a fully upgraded cluster should crash
Diffstat (limited to 'src/mongo/rpc/protocol_test.cpp')
-rw-r--r-- | src/mongo/rpc/protocol_test.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mongo/rpc/protocol_test.cpp b/src/mongo/rpc/protocol_test.cpp index 1781d9fab2c..ab92e3eeae1 100644 --- a/src/mongo/rpc/protocol_test.cpp +++ b/src/mongo/rpc/protocol_test.cpp @@ -281,4 +281,22 @@ TEST(Protocol, validateWireVersion) { WireVersion::LATEST_WIRE_VERSION - 1); } +// A mongos is unable to communicate with a fully upgraded cluster with a higher wire version. +TEST(Protocol, validateWireVersionFailsForUpgradedServerNode) { + // Server is fully upgraded higher than the latest wire version. + auto msg = + BSON("minWireVersion" << static_cast<int>(WireVersion::FUTURE_WIRE_VERSION_FOR_TESTING) + << "maxWireVersion" + << static_cast<int>(WireVersion::FUTURE_WIRE_VERSION_FOR_TESTING)); + auto swReply = parseProtocolSetFromIsMasterReply(msg); + ASSERT_OK(swReply.getStatus()); + + // The client (this mongos server) only has latest wire version. + ASSERT_EQUALS( + mongo::ErrorCodes::IncompatibleWithUpgradedServer, + validateWireVersion({WireVersion::LATEST_WIRE_VERSION, WireVersion::LATEST_WIRE_VERSION}, + swReply.getValue().version) + .code()); +} + } // namespace |