diff options
-rw-r--r-- | jstests/auth/cluster_ip_allowlist_replset.js | 18 |
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..9d97bc02f0e 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, {}, 0); replTest.awaitReplication(); |