diff options
author | Amirsaman Memaripour <amirsaman.memaripour@mongodb.com> | 2020-02-24 14:02:16 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-10 04:05:48 +0000 |
commit | f38a5b98a7b13e708265b1487f30a0dec91392b6 (patch) | |
tree | b2222e636284c49079a597562e5aed8397fa4267 | |
parent | 3054d5067c690a158b2b88ac378848fccbb9aa55 (diff) | |
download | mongo-f38a5b98a7b13e708265b1487f30a0dec91392b6.tar.gz |
SERVER-46362 Make set_step_params test tolerate sporadic connections
(cherry picked from commit 183e8c5c04d77ea840468ba8723970fa67258376)
-rw-r--r-- | jstests/noPassthrough/set_step_params.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/jstests/noPassthrough/set_step_params.js b/jstests/noPassthrough/set_step_params.js index f6bd74c3b96..88d1e532c1e 100644 --- a/jstests/noPassthrough/set_step_params.js +++ b/jstests/noPassthrough/set_step_params.js @@ -72,12 +72,15 @@ var currentCheckNum = 0; function hasConnPoolStats(args) { const checkNum = currentCheckNum++; jsTestLog("Check #" + checkNum + ": " + tojson(args)); - var {ready, pending, active, hosts, isAbsent} = args; + var {ready, pending, active, hosts, isAbsent, checkStatsFunc} = args; ready = ready ? ready : 0; pending = pending ? pending : 0; active = active ? active : 0; hosts = hosts ? hosts : allHosts; + checkStatsFunc = checkStatsFunc ? checkStatsFunc : function(stats) { + return stats.available == ready && stats.refreshing == pending && stats.inUse == active; + }; function checkStats(res, host) { var stats = res.hosts[host]; @@ -87,7 +90,7 @@ function hasConnPoolStats(args) { } jsTestLog("Connection stats for " + host + ": " + tojson(stats)); - return stats.available == ready && stats.refreshing == pending && stats.inUse == active; + return checkStatsFunc(stats); } function checkAllStats() { @@ -203,7 +206,12 @@ runSubTest("MaxConnecting", function() { // Release our pending and walk away configureReplSetFailpoint("waitInIsMaster", "off"); - hasConnPoolStats({active: conns}); + hasConnPoolStats({ + // Expects the number of pending connections to be zero. + checkStatsFunc: function(stats) { + return stats.refreshing == 0; + } + }); configureReplSetFailpoint("waitInFindBeforeMakingBatch", "off"); }); |