Compare commits

...

2 Commits

Author SHA1 Message Date
Sergey Galtsev
1985fe94b3 SERVER-61202 remove timing dependency in cluster_ip_allowlist_replset 2021-11-03 07:43:11 -07:00
Sergey Galtsev
9bf0f7587a SERVER-61202 remove timing dependency in cluster_ip_allowlist_replset 2021-11-02 14:24:26 -07:00

View File

@@ -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();