diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2022-01-19 07:13:37 +0100 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-19 06:59:33 +0000 |
commit | 1983b3633c95ec71dc8070b8a864411374221d40 (patch) | |
tree | 1473b54bef6b28e2a306ca3c3b7ce659e27f737b /jstests/replsets/dont_set_invalid_rwconcern.js | |
parent | 6f1bb29c277b702f4b7e09fc6d90e7c246ce174c (diff) | |
download | mongo-1983b3633c95ec71dc8070b8a864411374221d40.tar.gz |
Revert "SERVER-60817 Check write concern string for validity"
This reverts commit 4c96930ccb001d91fd188380f80756c19f1ad3c1.
Diffstat (limited to 'jstests/replsets/dont_set_invalid_rwconcern.js')
-rw-r--r-- | jstests/replsets/dont_set_invalid_rwconcern.js | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/jstests/replsets/dont_set_invalid_rwconcern.js b/jstests/replsets/dont_set_invalid_rwconcern.js deleted file mode 100644 index 5e553f77c1d..00000000000 --- a/jstests/replsets/dont_set_invalid_rwconcern.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Tests valid and invalid writeConcern settings, and that both setDefaultRWConcern and inserting - * with a writeConcern set will succeed and fail on the same values of writeConcern. - */ - -(function() { -"use strict"; -// Define repl set with custom write concern multiRegion which assures that writes are propagated to -// two different regions (specified in node tags). -const rst = new ReplSetTest({ - name: 'testSet', - nodes: [ - {rsConfig: {tags: {region: "us"}}}, - {rsConfig: {tags: {region: "us"}}}, - {rsConfig: {tags: {region: "eu"}}} - ], - settings: {getLastErrorModes: {multiRegion: {region: 2}}} -}); -rst.startSet(); -rst.initiate(); -const primary = rst.getPrimary(); - -// Test setDefaultRWConcern succeeds for "majority" and numbers. -assert.commandWorked( - primary.adminCommand({setDefaultRWConcern: 1, defaultWriteConcern: {w: "majority"}})); -assert.commandWorked(primary.adminCommand({setDefaultRWConcern: 1, defaultWriteConcern: {w: 1}})); - -// Test setDefaultRWConcern will fail for anything besides integers and strings. -assert.commandFailedWithCode( - primary.adminCommand({setDefaultRWConcern: 1, defaultWriteConcern: {w: true}}), - ErrorCodes.FailedToParse); - -// Test setDefaultRWConcern will fail for general strings (besides majority). -assert.commandFailedWithCode( - primary.adminCommand({setDefaultRWConcern: 1, defaultWriteConcern: {w: "1"}}), - ErrorCodes.UnknownReplWriteConcern); -assert.commandFailedWithCode( - primary.adminCommand({setDefaultRWConcern: 1, defaultWriteConcern: {w: "bajority"}}), - ErrorCodes.UnknownReplWriteConcern); - -// Test setDefaultRWConcern will succeed for custom RW concerns. -assert.commandWorked( - primary.adminCommand({setDefaultRWConcern: 1, defaultWriteConcern: {w: "multiRegion"}})); - -// Test insert with a writeConcern set succeeds and fails in the same cases that setDefaultRWConcern -// does. -const coll = primary.getDB("db").getCollection("coll"); -assert.commandWorked(coll.insert({a: 1}, {writeConcern: {w: "majority"}})); -assert.commandWorked(coll.insert({a: 1}, {writeConcern: {w: 1}})); -assert.commandFailedWithCode(coll.insert({a: 1}, {writeConcern: {w: true}}), - ErrorCodes.TypeMismatch); -assert.commandFailedWithCode(coll.insert({a: 1}, {writeConcern: {w: "1"}}), - ErrorCodes.UnknownReplWriteConcern); -assert.commandFailedWithCode(coll.insert({a: 1}, {writeConcern: {w: "bajority"}}), - ErrorCodes.UnknownReplWriteConcern); -assert.commandWorked(coll.insert({a: 1}, {writeConcern: {w: "multiRegion"}})); - -rst.stopSet(); -})();
\ No newline at end of file |