summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorGeert Bosch <geert@mongodb.com>2014-12-11 14:35:13 -0500
committerGeert Bosch <geert@mongodb.com>2014-12-11 18:29:47 -0500
commita6ac4e68c240e99ada7dddb333bb2b5e5220c49c (patch)
treeffd63e4220e6dd26b63ba356db35d757191c2e4c /jstests
parent0279923636be460e3027152d83ed1c790cd536fc (diff)
downloadmongo-a6ac4e68c240e99ada7dddb333bb2b5e5220c49c.tar.gz
SERVER-16497: Allow suppressing KeyTooLong errors in foreground index build
Diffstat (limited to 'jstests')
-rw-r--r--jstests/core/index_bigkeys_nofail.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/jstests/core/index_bigkeys_nofail.js b/jstests/core/index_bigkeys_nofail.js
new file mode 100644
index 00000000000..ccad3fe0352
--- /dev/null
+++ b/jstests/core/index_bigkeys_nofail.js
@@ -0,0 +1,22 @@
+// SERVER-16497
+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 } );
+assert.writeOK(t.insert({name:x}));
+assert.commandWorked(t.ensureIndex({name:1}));
+assert.writeOK(t.insert({name:x}));
+
+db.getSiblingDB('admin').runCommand( { setParameter: 1, failIndexKeyTooLong: was } );