summaryrefslogtreecommitdiff
path: root/jstests/replsets/replset5.js
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2014-03-03 11:27:18 -0500
committerRandolph Tan <randolph@10gen.com>2014-03-14 12:05:05 -0400
commiteb41492c6f1228077b92239524e4a607b70cd8e3 (patch)
treec90485d43753aa756063d0a6e8f67b8843931bba /jstests/replsets/replset5.js
parente44682821c37fdf3d4fd8cb58dcf5c34181ddbde (diff)
downloadmongo-eb41492c6f1228077b92239524e4a607b70cd8e3.tar.gz
SERVER-13190 migrate replset jstest suite to use write commands api
Diffstat (limited to 'jstests/replsets/replset5.js')
-rw-r--r--jstests/replsets/replset5.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/jstests/replsets/replset5.js b/jstests/replsets/replset5.js
index 3e04c7c9bc5..7f86899d350 100644
--- a/jstests/replsets/replset5.js
+++ b/jstests/replsets/replset5.js
@@ -2,12 +2,12 @@
doTest = function (signal) {
- // Test getLastError defaults
+ // Test write concern defaults
var replTest = new ReplSetTest({ name: 'testSet', nodes: 3 });
var nodes = replTest.startSet();
- // Initiate set with default for getLastError
+ // Initiate set with default for write concern
var config = replTest.getReplSetConfig();
config.settings = {};
config.settings.getLastErrorDefaults = { 'w': 3, 'wtimeout': 20000 };
@@ -26,24 +26,24 @@ doTest = function (signal) {
// These writes should be replicated immediately
var docNum = 5000;
+ var bulk = master.getDB(testDB).foo.initializeUnorderedBulkOp();
for (var n = 0; n < docNum; n++) {
- master.getDB(testDB).foo.insert({ n: n });
+ bulk.insert({ n: n });
}
-
+
// should use the configured last error defaults from above, that's what we're testing.
//
// If you want to test failure, just add values for w and wtimeout (e.g. w=1)
// to the following command. This will override the default set above and
// prevent replication from happening in time for the count tests below.
//
- var result = master.getDB("admin").runCommand({ getlasterror: 1 });
- print("replset5.js getlasterror result:");
- printjson(result);
-
- if (result.err == "timeout") {
- print("\WARNING getLastError timed out and should not have.\nThis machine seems extremely slow. Stopping test without failing it\n")
- replTest.stopSet(signal);
- print("\WARNING getLastError timed out and should not have.\nThis machine seems extremely slow. Stopping test without failing it\n")
+ var result = bulk.execute();
+ var wcError = result.getWriteConcernError();
+
+ if (wcError != null) {
+ print("\WARNING getLastError timed out and should not have: " + result.toString());
+ print("This machine seems extremely slow. Stopping test without failing it\n");
+ replTest.stopSet(signal);
return;
}