summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Galtsev <sergey.galtsev@mongodb.com>2021-11-03 22:29:15 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-11-03 22:58:18 +0000
commit1c476ebc7139d851d87378f1b90e95bc064362ed (patch)
tree0f80e84bd7f3cdfcc560dafb350d8ce17cdc1983
parent45c2f1f18f5704872a65d395d8085fb9385d59d8 (diff)
downloadmongo-1c476ebc7139d851d87378f1b90e95bc064362ed.tar.gz
SERVER-61202 remove timing dependency in cluster_ip_allowlist_replset
-rw-r--r--jstests/auth/cluster_ip_allowlist_replset.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/jstests/auth/cluster_ip_allowlist_replset.js b/jstests/auth/cluster_ip_allowlist_replset.js
index 527d32b0e38..2fbfeb4f5b3 100644
--- a/jstests/auth/cluster_ip_allowlist_replset.js
+++ b/jstests/auth/cluster_ip_allowlist_replset.js
@@ -25,17 +25,16 @@ admin.auth('admin', 'admin');
assert.commandWorked(primary.adminCommand(
{setDefaultRWConcern: 1, defaultWriteConcern: {w: "majority"}, writeConcern: {w: "majority"}}));
-jsTest.log("ReplSet started, will block __system connections and expect error");
-
-assert.commandWorked(
- primary.adminCommand({setParameter: 1, "clusterIpSourceAllowlist": ["192.0.2.1"]}));
-
function resetClusterIpSourceAllowlist(host) {
jsTest.log("resetClusterIpSourceAllowlist: started");
- sleep(15000);
const mongo = new Mongo(host);
const admin = mongo.getDB("admin");
admin.auth('admin', 'admin');
+
+ jsTest.log("Check log for denied connections");
+ checkLog.containsJson(admin, 20240, {});
+ jsTest.log("Found denied connection(s)");
+
assert.commandWorked(admin.adminCommand({setParameter: 1, "clusterIpSourceAllowlist": null}));
jsTest.log("Successfully reset clusterIpSourceAllowlist");
}
@@ -43,8 +42,6 @@ function resetClusterIpSourceAllowlist(host) {
let thread = new Thread(resetClusterIpSourceAllowlist, primary.host);
thread.start();
-jsTest.log("Attempt to add host. This should be failing, then succeed");
-
const arbiterConn = replTest.add();
const conf = replTest.getReplSetConfigFromNode();
conf.members.push({_id: 2, host: arbiterConn.host, arbiterOnly: true});
@@ -52,11 +49,14 @@ conf.version++;
// Following function will succeed after resetClusterIpSourceAllowlist()
// successfully resets IP for connection
+jsTest.log("ReplSet started, will block __system connections and expect error");
+assert.commandWorked(
+ primary.adminCommand({setParameter: 1, "clusterIpSourceAllowlist": ["192.0.2.1"]}));
assert.commandWorked(admin.runCommand({replSetReconfig: conf}));
thread.join();
jsTest.log("Verify that connections were denied");
-checkLog.containsJson(admin, 20240, {}, 15000);
+checkLog.containsJson(admin, 20240, {}, 1);
replTest.awaitReplication();