diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2020-01-09 14:22:14 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2020-01-09 14:22:14 +0000 |
commit | 2c9bd38f5c9476f470d83c7452fcf8b62f63bf19 (patch) | |
tree | d37b0c9cdf8b1abebb99db1abd99e48059d03224 /jstests | |
parent | bdbbb262ab3b730cde77cce0315014159840bcb7 (diff) | |
download | mongo-2c9bd38f5c9476f470d83c7452fcf8b62f63bf19.tar.gz |
SERVER-45396 Fix the 'me' field in isMaster responses when using splithorizon
(cherry picked from commit a1a1e4f0c14ab71a5fc8bc7913af25571089b65f)
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/ssl/repl_ssl_split_horizon.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/jstests/ssl/repl_ssl_split_horizon.js b/jstests/ssl/repl_ssl_split_horizon.js index a862a425006..44902aaf490 100644 --- a/jstests/ssl/repl_ssl_split_horizon.js +++ b/jstests/ssl/repl_ssl_split_horizon.js @@ -106,6 +106,11 @@ var checkExpectedHorizon = function(url, memberIndex, expectedHostname) { // Run isMaster in the shell and check that we get the expected hostname back + const assertion = (memberIndex === "me") + ? ("assert(db.runCommand({isMaster: 1})['me'] == '" + expectedHostname + "')") + : ("assert(db.runCommand({isMaster: 1})['hosts'][" + memberIndex + "] == '" + + expectedHostname + "')"); + var argv = [ 'env', "HOSTALIASES=" + hostsFile, @@ -113,8 +118,7 @@ './mongo', url, '--eval', - ("assert(db.runCommand({isMaster: 1})['hosts'][" + memberIndex + "] == '" + - expectedHostname + "')") + assertion ]; return runMongoProgram(...argv); }; @@ -125,6 +129,9 @@ assert.eq(checkExpectedHorizon(defaultURL, 0, node0localHostname), 0, "localhost does not return horizon"); + assert.eq(checkExpectedHorizon(defaultURL, "me", node0localHostname), + 0, + "localhost does not return horizon"); assert.eq(checkExpectedHorizon(defaultURL, 1, node1localHostname), 0, "localhost does not return horizon"); @@ -135,6 +142,9 @@ assert.eq(checkExpectedHorizon(horizonURL, 0, node0horizonHostname), 0, "does not return horizon as expected"); + assert.eq(checkExpectedHorizon(horizonURL, "me", node0horizonHostname), + 0, + "does not return horizon as expected"); assert.eq(checkExpectedHorizon(horizonURL, 1, node1horizonHostname), 0, "does not return horizon as expected"); @@ -146,6 +156,9 @@ assert.eq(checkExpectedHorizon(horizonMissingURL, 0, node0localHostname), 0, "does not return localhost as expected"); + assert.eq(checkExpectedHorizon(horizonMissingURL, "me", node0localHostname), + 0, + "does not return localhost as expected"); assert.eq(checkExpectedHorizon(horizonMissingURL, 1, node1localHostname), 0, "does not return localhost as expected"); @@ -164,6 +177,9 @@ assert.eq(checkExpectedHorizon(horizonMissingURL, 0, node0horizonMissingHostname), 0, "does not return horizon as expected"); + assert.eq(checkExpectedHorizon(horizonMissingURL, "me", node0horizonMissingHostname), + 0, + "does not return horizon as expected"); assert.eq(checkExpectedHorizon(horizonMissingURL, 1, node1horizonMissingHostname), 0, "does not return horizon as expected"); @@ -185,6 +201,10 @@ assert.eq(checkExpectedHorizon(horizonDifferentPortURL, 0, node0horizonHostnameDifferentPort), 0, "does not return horizon as expected"); + assert.eq( + checkExpectedHorizon(horizonDifferentPortURL, "me", node0horizonHostnameDifferentPort), + 0, + "does not return horizon as expected"); assert.eq(checkExpectedHorizon(horizonDifferentPortURL, 1, node1horizonHostnameDifferentPort), 0, "does not return horizon as expected"); |