diff options
author | Sergey Galtsev <sergey.galtsev@mongodb.com> | 2021-11-02 14:24:26 -0700 |
---|---|---|
committer | Sergey Galtsev <sergey.galtsev@mongodb.com> | 2021-11-02 14:24:26 -0700 |
commit | 9bf0f7587aafc575b7f86345cb67990fbaca11f8 (patch) | |
tree | 9a1f3e39e7e819e06fa78a88d18cec305ac6ebf2 /jstests/auth/cluster_ip_allowlist_replset.js | |
parent | a1cb263e951d6a56332e2c8e074330669b80d9a9 (diff) | |
download | mongo-9bf0f7587aafc575b7f86345cb67990fbaca11f8.tar.gz |
SERVER-61202 remove timing dependency in cluster_ip_allowlist_replset
Diffstat (limited to 'jstests/auth/cluster_ip_allowlist_replset.js')
-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(); |