summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod/dup_bgindex.js
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2014-03-27 16:15:09 -0400
committerMathias Stearn <mathias@10gen.com>2014-03-27 17:35:16 -0400
commitd0a1e84ab2fa1b6aa699721b5cb9a4f8d0bf3692 (patch)
tree7a1ffc91cb6cb176c1e367ea7641ab05032c862c /jstests/noPassthroughWithMongod/dup_bgindex.js
parent719134aa7985c0a697f199fc78e323d04e3a65ad (diff)
downloadmongo-d0a1e84ab2fa1b6aa699721b5cb9a4f8d0bf3692.tar.gz
SERVER-13391 Rename slowNightly -> noPassthroughWithMongod and slowWeekly -> noPassthrough
This better represents their purpose and the difference between them.
Diffstat (limited to 'jstests/noPassthroughWithMongod/dup_bgindex.js')
-rw-r--r--jstests/noPassthroughWithMongod/dup_bgindex.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/jstests/noPassthroughWithMongod/dup_bgindex.js b/jstests/noPassthroughWithMongod/dup_bgindex.js
new file mode 100644
index 00000000000..fbfb8a8a322
--- /dev/null
+++ b/jstests/noPassthroughWithMongod/dup_bgindex.js
@@ -0,0 +1,16 @@
+// Try to create two identical indexes, via background. Shouldn't be allowed by the server.
+// This test runs fairly quickly but cannot be in /jstests/. So it lives in slowNightly for now.
+var t = db.duplIndexTest;
+t.drop();
+for (var i=0; i<10000; i++) {
+ t.insert( { name : "foo" , z : { a : 17 , b : 4}, i: i } );
+}
+var cmd = "db.duplIndexTest.ensureIndex( { i : 1 }, {background:true} );"
+var join1 = startParallelShell(cmd);
+var join2 = startParallelShell(cmd);
+t.ensureIndex( { i : 1 }, {background:true} );
+assert.eq(1, t.find({i:1}).count(), "Should find only one doc");
+t.dropIndex({ i : 1 });
+assert.eq(1, t.find({i:1}).count(), "Should find only one doc");
+join1();
+join2();