summaryrefslogtreecommitdiff
path: root/jstests/libs
diff options
context:
space:
mode:
authorMatt Broadstone <mbroadst@mongodb.com>2022-05-04 10:51:58 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-04 12:40:30 +0000
commitcd3a9c9b928fc1e071992863a5478b08336b3c13 (patch)
tree716189566dc9471c26e8e6acac643e073d4ff7e1 /jstests/libs
parent7e7e34fb672286c403ccfc999ac1a66625a31acb (diff)
downloadmongo-cd3a9c9b928fc1e071992863a5478b08336b3c13.tar.gz
SERVER-66141 Remove access blockers on recipientConfig installation
Diffstat (limited to 'jstests/libs')
-rw-r--r--jstests/libs/fail_point_util.js67
1 files changed, 32 insertions, 35 deletions
diff --git a/jstests/libs/fail_point_util.js b/jstests/libs/fail_point_util.js
index 7572a753a81..1c3a698325b 100644
--- a/jstests/libs/fail_point_util.js
+++ b/jstests/libs/fail_point_util.js
@@ -15,44 +15,41 @@ if (configureFailPoint) {
kDefaultWaitForFailPointTimeout = 5 * 60 * 1000;
configureFailPoint = function(conn, failPointName, data = {}, failPointMode = "alwaysOn") {
+ const res = assert.commandWorked(
+ conn.adminCommand({configureFailPoint: failPointName, mode: failPointMode, data: data}));
+
return {
conn: conn,
failPointName: failPointName,
- timesEntered: assert
- .commandWorked(conn.adminCommand(
- {configureFailPoint: failPointName, mode: failPointMode, data: data}))
- .count,
- wait:
- function({maxTimeMS = kDefaultWaitForFailPointTimeout, timesEntered = 1} = {}) {
- // Can only be called once because this function does not keep track of the
- // number of times the fail point is entered between the time it returns
- // and the next time it gets called.
- assert.commandWorked(conn.adminCommand({
- waitForFailPoint: failPointName,
- timesEntered: this.timesEntered + timesEntered,
- maxTimeMS: maxTimeMS
- }));
- },
- waitWithTimeout:
- function(timeoutMS) {
- // This function has three possible outcomes:
- //
- // 1) Returns true when the failpoint was hit.
- // 2) Returns false when the command returned a `MaxTimeMSExpired` response.
- // 3) Otherwise, this throws for an unexpected error.
- let res = assert.commandWorkedOrFailedWithCode(conn.adminCommand({
- waitForFailPoint: failPointName,
- timesEntered: this.timesEntered + 1,
- maxTimeMS: timeoutMS
- }),
- ErrorCodes.MaxTimeMSExpired);
- return res["ok"] === 1;
- },
- off:
- function() {
- assert.commandWorked(
- conn.adminCommand({configureFailPoint: failPointName, mode: "off"}));
- }
+ timesEntered: res.count,
+ wait: function({maxTimeMS = kDefaultWaitForFailPointTimeout, timesEntered = 1} = {}) {
+ // Can only be called once because this function does not keep track of the
+ // number of times the fail point is entered between the time it returns
+ // and the next time it gets called.
+ assert.commandWorked(conn.adminCommand({
+ waitForFailPoint: failPointName,
+ timesEntered: this.timesEntered + timesEntered,
+ maxTimeMS: maxTimeMS
+ }));
+ },
+ waitWithTimeout: function(timeoutMS) {
+ // This function has three possible outcomes:
+ //
+ // 1) Returns true when the failpoint was hit.
+ // 2) Returns false when the command returned a `MaxTimeMSExpired` response.
+ // 3) Otherwise, this throws for an unexpected error.
+ let res = assert.commandWorkedOrFailedWithCode(conn.adminCommand({
+ waitForFailPoint: failPointName,
+ timesEntered: this.timesEntered + 1,
+ maxTimeMS: timeoutMS
+ }),
+ ErrorCodes.MaxTimeMSExpired);
+ return res["ok"] === 1;
+ },
+ off: function() {
+ assert.commandWorked(
+ conn.adminCommand({configureFailPoint: failPointName, mode: "off"}));
+ }
};
};
})();