summaryrefslogtreecommitdiff
path: root/src/mongo/shell/assert.js
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2017-04-17 10:02:12 -0400
committerJudah Schvimer <judah@mongodb.com>2017-04-17 10:02:12 -0400
commit148c0031f517117a39e0c260051169b2831d5e64 (patch)
tree5507b2f73cf6c6f4d683ff9470ec0b77dcca087a /src/mongo/shell/assert.js
parent932c2f345598d8e1d283e8c2bb54fd8d0e11c853 (diff)
downloadmongo-148c0031f517117a39e0c260051169b2831d5e64.tar.gz
SERVER-28053 allow network errors when turning off rollbackHangBeforeStart failpoint
Diffstat (limited to 'src/mongo/shell/assert.js')
-rw-r--r--src/mongo/shell/assert.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/shell/assert.js b/src/mongo/shell/assert.js
index b26380fdb18..f3d984628b5 100644
--- a/src/mongo/shell/assert.js
+++ b/src/mongo/shell/assert.js
@@ -267,6 +267,22 @@ assert.retryNoExcept = function(func, msg, num_attempts, intervalMS) {
assert.retry(safeFunc, msg, num_attempts, intervalMS);
};
+/**
+ * Runs the given command on the 'admin' database of the provided node. Asserts that the command
+ * worked but allows network errors to occur.
+ */
+assert.adminCommandWorkedAllowingNetworkError = function(node, commandObj) {
+ try {
+ assert.commandWorked(node.adminCommand(commandObj));
+ } catch (e) {
+ // Ignore errors due to connection failures.
+ if (!isNetworkError(e)) {
+ throw e;
+ }
+ print("Caught network error: " + tojson(e));
+ }
+};
+
assert.time = function(f, msg, timeout /*ms*/) {
if (assert._debug && msg)
print("in assert for: " + msg);