summaryrefslogtreecommitdiff
path: root/jstests/core/index_bigkeys_nofail.js
diff options
context:
space:
mode:
authorXiangyu Yao <xiangyu.yao@mongodb.com>2018-08-01 10:25:26 -0400
committerXiangyu Yao <xiangyu.yao@mongodb.com>2018-08-06 22:31:45 -0400
commit3f08a905c17b6d68201b5ddbdaf5b62e26c99b30 (patch)
tree203509acfa1031666c7f23fc871c0c9bee2ee433 /jstests/core/index_bigkeys_nofail.js
parente444d98f411566bcd983e7ca2eccfda1bc14fe5a (diff)
downloadmongo-3f08a905c17b6d68201b5ddbdaf5b62e26c99b30.tar.gz
SERVER-36329 Deprecate failIndexKeyTooLong server parameter
Diffstat (limited to 'jstests/core/index_bigkeys_nofail.js')
-rw-r--r--jstests/core/index_bigkeys_nofail.js55
1 files changed, 0 insertions, 55 deletions
diff --git a/jstests/core/index_bigkeys_nofail.js b/jstests/core/index_bigkeys_nofail.js
deleted file mode 100644
index be58427ba6d..00000000000
--- a/jstests/core/index_bigkeys_nofail.js
+++ /dev/null
@@ -1,55 +0,0 @@
-// @tags: [does_not_support_stepdowns, requires_non_retryable_writes, requires_fastcount]
-
-// SERVER-16497: Check that failIndexKeyTooLong setting works
-(function() {
- "use strict";
-
- var t = db.index_bigkeys_nofail;
- t.drop();
- var res = db.getSiblingDB('admin').runCommand({setParameter: 1, failIndexKeyTooLong: true});
- var was = res.was;
- assert.commandWorked(res);
-
- var x = new Array(1025).join('x');
- assert.commandWorked(t.ensureIndex({name: 1}));
- assert.writeError(t.insert({name: x}));
- assert.commandWorked(t.dropIndex({name: 1}));
- assert.writeOK(t.insert({name: x}));
- assert.commandFailed(t.ensureIndex({name: 1}));
-
- t.drop();
- db.getSiblingDB('admin').runCommand({setParameter: 1, failIndexKeyTooLong: false});
-
- // inserts
- assert.writeOK(t.insert({_id: 1, name: x}));
- assert.commandWorked(t.ensureIndex({name: 1}));
- assert.writeOK(t.insert({_id: 2, name: x}));
- assert.writeOK(t.insert({_id: 3, name: x}));
- assert.eq(t.count(), 3);
-
- // updates (smaller and larger)
- assert.writeOK(t.update({_id: 1}, {$set: {name: 'short'}}));
- assert.writeOK(t.update({_id: 1}, {$set: {name: x}}));
- assert.writeOK(t.update({_id: 1}, {$set: {name: x + 'even longer'}}));
-
- // remove
- assert.writeOK(t.remove({_id: 1}));
- assert.eq(t.count(), 2);
-
- db.getSiblingDB('admin').runCommand({setParameter: 1, failIndexKeyTooLong: true});
-
- // can still delete even if key is oversized
- assert.writeOK(t.remove({_id: 2}));
- assert.eq(t.count(), 1);
-
- // can still update to shorter, but not longer name.
- assert.writeError(t.update({_id: 3}, {$set: {name: x + 'even longer'}}));
- assert.writeOK(t.update({_id: 3}, {$set: {name: 'short'}}));
- assert.writeError(t.update({_id: 3}, {$set: {name: x}}));
-
- db.getSiblingDB('admin').runCommand({setParameter: 1, failIndexKeyTooLong: was});
-
- // Explicitly drop the collection to avoid failures in post-test hooks that run dbHash and
- // validate commands.
- t.drop();
-}());