summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKyle Suarez <kyle.suarez@mongodb.com>2018-05-16 01:14:07 -0400
committerKyle Suarez <kyle.suarez@mongodb.com>2018-05-16 01:14:20 -0400
commit5c722f8e8eea601f37519678b7458dc95befe28d (patch)
tree6a658839ad6f88bf4f7dffb9b1cefda7bf692106 /src
parent63d721812d0d72c31d1144bbe7e46f53041d3733 (diff)
downloadmongo-5c722f8e8eea601f37519678b7458dc95befe28d.tar.gz
SERVER-33091 create a rollback test with 5 nodes
This test suite allows for a controlled rollback where nodes roll back writes performed as a primary or secondary.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/shell/assert.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/shell/assert.js b/src/mongo/shell/assert.js
index ece2a4aed59..653c8da5b21 100644
--- a/src/mongo/shell/assert.js
+++ b/src/mongo/shell/assert.js
@@ -330,10 +330,15 @@ assert = (function() {
/**
* Runs the given command on the 'admin' database of the provided node. Asserts that the command
* worked but allows network errors to occur.
+ *
+ * Returns the response if the command succeeded, or undefined if the command failed, *even* if
+ * the failure was due to a network error.
*/
assert.adminCommandWorkedAllowingNetworkError = function(node, commandObj) {
+ let res;
try {
- assert.commandWorked(node.adminCommand(commandObj));
+ res = node.adminCommand(commandObj);
+ assert.commandWorked(res);
} catch (e) {
// Ignore errors due to connection failures.
if (!isNetworkError(e)) {
@@ -341,6 +346,7 @@ assert = (function() {
}
print("Caught network error: " + tojson(e));
}
+ return res;
};
assert.time = function(f, msg, timeout /*ms*/) {