diff options
author | Randolph Tan <randolph@10gen.com> | 2014-03-03 11:27:18 -0500 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2014-03-14 12:05:05 -0400 |
commit | eb41492c6f1228077b92239524e4a607b70cd8e3 (patch) | |
tree | c90485d43753aa756063d0a6e8f67b8843931bba /jstests/replsets/replset5.js | |
parent | e44682821c37fdf3d4fd8cb58dcf5c34181ddbde (diff) | |
download | mongo-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.js | 24 |
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;
}
|