summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Marks <gabriel.marks@mongodb.com>2020-08-03 19:38:15 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-08-04 19:50:51 +0000
commit60c08a4a9bb03b6df5bc5fdacb1980cbc4e1741e (patch)
tree8cb2aa758a6fbc50d9ea868d054435e18783dbfd
parent358ac5e5d0cfa2843c016302aa0443b217662346 (diff)
downloadmongo-60c08a4a9bb03b6df5bc5fdacb1980cbc4e1741e.tar.gz
SERVER-50082 Attempt to fix test failure
-rw-r--r--jstests/ssl/client_x509_rotate.js72
1 files changed, 47 insertions, 25 deletions
diff --git a/jstests/ssl/client_x509_rotate.js b/jstests/ssl/client_x509_rotate.js
index 95a170768ee..e96cf2c1527 100644
--- a/jstests/ssl/client_x509_rotate.js
+++ b/jstests/ssl/client_x509_rotate.js
@@ -85,20 +85,31 @@ assert(primary.host in getConnPoolHosts());
assert.commandWorked(mongos.adminCommand({dropConnections: 1, hostAndPort: keys}));
assert(!(primary.host in getConnPoolHosts()));
-output = mongos.adminCommand({multicast: {ping: 0}});
-jsTestLog("Multicast 1 output: " + tojson(output));
-// multicast should fail, because the primary shard isn't hit
-assert.eq(output.ok, 0);
-for (let host in output.hosts) {
- if (host === primary.host) {
- assert.eq(output.hosts[host].ok, 0);
- } else {
- assert.eq(output.hosts[host].ok, 1);
+assert.soon(() => {
+ output = mongos.adminCommand({multicast: {ping: 0}});
+ jsTestLog("Multicast 1 output: " + tojson(output));
+ // multicast should fail, because the primary shard isn't hit
+ if (output.ok !== 0) {
+ return false;
}
-}
-for (let key of keys) {
- assert(key in output.hosts);
-}
+ for (let host in output.hosts) {
+ if (host === primary.host) {
+ if (output.hosts[host].ok !== 0) {
+ return false;
+ }
+ } else {
+ if (output.hosts[host].ok !== 1) {
+ return false;
+ }
+ }
+ }
+ for (let key of keys) {
+ if (!(key in output.hosts)) {
+ return false;
+ }
+ }
+ return true;
+});
// rotate, drop all connections, re-multicast and see what we now hit
assert.commandWorked(mongos.adminCommand({rotateCertificates: 1}));
@@ -106,19 +117,30 @@ assert.commandWorked(mongos.adminCommand({rotateCertificates: 1}));
mongos.adminCommand({dropConnections: 1, hostAndPort: keys});
assert(!(primary.host in getConnPoolHosts()));
-output = mongos.adminCommand({multicast: {ping: 0}});
-jsTestLog("Multicast 2 output: " + tojson(output));
-assert.eq(output.ok, 0);
-for (let host in output.hosts) {
- if (host === primary.host) {
- assert.eq(output.hosts[host].ok, 1);
- } else {
- assert.eq(output.hosts[host].ok, 0);
+assert.soon(() => {
+ output = mongos.adminCommand({multicast: {ping: 0}});
+ jsTestLog("Multicast 2 output: " + tojson(output));
+ if (output.ok !== 0) {
+ return false;
}
-}
-for (let key of keys) {
- assert(key in output.hosts);
-}
+ for (let host in output.hosts) {
+ if (host === primary.host) {
+ if (output.hosts[host].ok !== 1) {
+ return false;
+ }
+ } else {
+ if (output.hosts[host].ok !== 0) {
+ return false;
+ }
+ }
+ }
+ for (let key of keys) {
+ if (!(key in output.hosts)) {
+ return false;
+ }
+ }
+ return true;
+});
// Don't call st.stop() -- breaks because cluster is only partially rotated (this is hard to fix)
return;
}());