summaryrefslogtreecommitdiff
path: root/jstests/core/batch_write_command_wc.js
diff options
context:
space:
mode:
authorGreg Studer <greg@10gen.com>2014-01-13 18:50:02 -0500
committerGreg Studer <greg@10gen.com>2014-01-14 14:41:04 -0500
commit13226efcd6638b707e0f4a64564d655cea9bc9c7 (patch)
tree8f8a80c77f7048116f6d63b9d8d349de36189c73 /jstests/core/batch_write_command_wc.js
parent20a414a4809aa5d20f3a09f129f08c918cddf032 (diff)
downloadmongo-13226efcd6638b707e0f4a64564d655cea9bc9c7.tar.gz
SERVER-12274 refactor validation out of waiting for write concern
Diffstat (limited to 'jstests/core/batch_write_command_wc.js')
-rw-r--r--jstests/core/batch_write_command_wc.js98
1 files changed, 0 insertions, 98 deletions
diff --git a/jstests/core/batch_write_command_wc.js b/jstests/core/batch_write_command_wc.js
deleted file mode 100644
index 2167f7c4fc5..00000000000
--- a/jstests/core/batch_write_command_wc.js
+++ /dev/null
@@ -1,98 +0,0 @@
-//
-// Tests write-concern-related batch write protocol functionality
-//
-
-function resultOK( result ) {
- return result.ok &&
- !( 'code' in result ) &&
- !( 'errmsg' in result ) &&
- !( 'errInfo' in result ) &&
- !( 'writeErrors' in result );
-};
-
-function resultNOK( result ) {
- return !result.ok &&
- typeof( result.code ) == 'number' &&
- typeof( result.errmsg ) == 'string';
-}
-
-
-var request;
-var result;
-
-// NOTE: ALL TESTS BELOW SHOULD BE SELF-CONTAINED, FOR EASIER DEBUGGING
-
-jsTest.log("Starting no journal/repl tests...");
-
-var mongod = MongoRunner.runMongod({nojournal: ""});
-var conn = new Mongo(mongod.host);
-var coll = mongod.getCollection("test.batch_write_command_wc");
-
-//
-//
-// Insert tests
-
-//
-// Basic no journal insert, default WC
-coll.remove({});
-printjson( request = {insert : coll.getName(),
- documents: [{a:1}]});
-printjson( result = coll.runCommand(request) );
-assert(resultOK(result));
-assert.eq(1, result.n);
-assert.eq(1, coll.count());
-
-//
-// Basic no journal insert, error on WC with j set
-coll.remove({});
-printjson( request = {insert : coll.getName(),
- documents: [{a:1}],
- writeConcern: {w:1, j:true}});
-printjson( result = coll.runCommand(request) );
-assert(result.ok);
-assert.eq(1, result.n);
-assert.eq(1, coll.count());
-assert(result.writeConcernError != null);
-assert.eq(2, result.writeConcernError.code);
-assert.eq('string', typeof(result.writeConcernError.errmsg));
-
-//
-// Basic no journal insert, insert error and no write
-coll.remove({});
-printjson( request = {insert : coll.getName(),
- documents: [{a:1, $invalid: true}],
- writeConcern: {w:1, j:true}});
-printjson( result = coll.runCommand(request) );
-assert(result.ok);
-assert.eq(0, result.n);
-assert('writeErrors' in result);
-assert.eq(0, coll.count());
-
-//
-// Basic no journal insert, error on WC with j set and insert error
-coll.remove({});
-printjson( request = {insert : coll.getName(),
- documents: [{a:1}, {a:1, $invalid: true}],
- writeConcern: {w:1, j:true},
- ordered : false});
-printjson( result = coll.runCommand(request) );
-assert(result.ok);
-assert.eq(1, result.n);
-assert.eq(1, result.writeErrors.length);
-
-assert.eq(1, result.writeErrors[0].index);
-assert.eq('number', typeof result.writeErrors[0].code);
-assert.eq('string', typeof result.writeErrors[0].errmsg);
-
-assert('writeConcernError' in result);
-assert.eq('string', typeof(result.writeConcernError.errmsg));
-
-assert.eq(1, coll.count());
-
-//
-// TODO: More tests to come
-//
-
-jsTest.log("DONE no journal/repl tests");
-MongoRunner.stopMongod(mongod);
-