summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Percy <david.percy@mongodb.com>2014-10-06 14:37:07 -0400
committerDavid Percy <david.percy@mongodb.com>2014-10-17 17:33:48 -0400
commit7aadbc29c07ee73c62ccfa3696fbd6262fb3d70e (patch)
tree63a356f689f87df0de816fa66c797af95188a3cd
parentd62da3295a35725e7552638b55b09d802881d110 (diff)
downloadmongo-7aadbc29c07ee73c62ccfa3696fbd6262fb3d70e.tar.gz
SERVER-13635 No system.indexes in jstests/replsets
-rw-r--r--jstests/replsets/index_delete.js12
-rw-r--r--jstests/replsets/index_restart_secondary.js8
-rw-r--r--jstests/replsets/reindex_secondary.js10
-rw-r--r--jstests/replsets/replset7.js8
4 files changed, 21 insertions, 17 deletions
diff --git a/jstests/replsets/index_delete.js b/jstests/replsets/index_delete.js
index 018387d99c6..c2e871fe6f1 100644
--- a/jstests/replsets/index_delete.js
+++ b/jstests/replsets/index_delete.js
@@ -55,22 +55,22 @@ assert.writeOK(bulk.execute());
jsTest.log("Creating index");
masterDB.jstests_fgsec.ensureIndex( {i:1} );
-assert.eq(2, masterDB.system.indexes.count( {ns:"fgIndexSec.jstests_fgsec"}, {background:true} ) );
+assert.eq(2, masterDB.jstests_fgsec.getIndexes().length );
// Wait for the secondary to get the index entry
assert.soon( function() {
- return 2 == secondDB.system.indexes.count( {ns:"fgIndexSec.jstests_fgsec"} ); },
+ return 2 == secondDB.jstests_fgsec.getIndexes().length; },
"index not created on secondary", 1000*60*10, 50 );
-jsTest.log("Index created and system.indexes entry exists on secondary");
+jsTest.log("Index created on secondary");
masterDB.runCommand( {dropIndexes: "jstests_fgsec", index: "i_1"} );
jsTest.log("Waiting on replication");
replTest.awaitReplication();
assert.soon( function() {return !checkOp(secondDB)}, "index not cancelled on secondary", 30000, 50);
-masterDB.system.indexes.find().forEach(printjson);
-secondDB.system.indexes.find().forEach(printjson);
+masterDB.jstests_fgsec.getIndexes().forEach(printjson);
+secondDB.jstests_fgsec.getIndexes().forEach(printjson);
assert.soon( function() {
- return 1 == secondDB.system.indexes.count( { ns: "fgIndexSec.jstests_fgsec"} ); },
+ return 1 == secondDB.jstests_fgsec.getIndexes().length; },
"Index not dropped on secondary", 30000, 50 );
jsTest.log("index-restart-secondary.js complete");
diff --git a/jstests/replsets/index_restart_secondary.js b/jstests/replsets/index_restart_secondary.js
index 15205fa2e50..e40aa5664a8 100644
--- a/jstests/replsets/index_restart_secondary.js
+++ b/jstests/replsets/index_restart_secondary.js
@@ -39,14 +39,14 @@ assert.writeOK(bulk.execute());
jsTest.log("Creating index");
masterDB.jstests_fgsec.ensureIndex( {i:1} );
-assert.eq(2, masterDB.system.indexes.count( {ns:"fgIndexSec.jstests_fgsec"} ) );
+assert.eq(2, masterDB.jstests_fgsec.getIndexes().length);
// Wait for the secondary to get the index entry
assert.soon( function() {
- return 2 == secondDB.system.indexes.count( {ns:"fgIndexSec.jstests_fgsec"} ); },
+ return 2 == secondDB.jstests_fgsec.getIndexes().length; },
"index not created on secondary (prior to restart)", 800000, 50 );
-jsTest.log("Index created and system.indexes entry exists on secondary");
+jsTest.log("Index created on secondary");
// restart secondary and reconnect
jsTest.log("Restarting secondary");
@@ -63,7 +63,7 @@ assert.soon( function() {
} , "secondary didn't restart", 30000, 1000);
assert.soon( function() {
- return 2 == secondDB.system.indexes.count( {ns:"fgIndexSec.jstests_fgsec"} ); },
+ return 2 == secondDB.jstests_fgsec.getIndexes().length; },
"Index build not resumed after restart", 30000, 50 );
jsTest.log("index-restart-secondary.js complete");
diff --git a/jstests/replsets/reindex_secondary.js b/jstests/replsets/reindex_secondary.js
index d0fd5d71123..af08dd4cec8 100644
--- a/jstests/replsets/reindex_secondary.js
+++ b/jstests/replsets/reindex_secondary.js
@@ -21,14 +21,14 @@ db.foo.ensureIndex({a:1});
replTest.awaitReplication();
-assert.eq(2, db.system.indexes.count(), "Master didn't have proper indexes before reindex");
-assert.eq(2, slaveDb.system.indexes.count(), "Slave didn't have proper indexes before reindex");
+assert.eq(2, db.foo.getIndexes().length, "Master didn't have proper indexes before reindex");
+assert.eq(2, slaveDb.foo.getIndexes().length, "Slave didn't have proper indexes before reindex");
// Try to reindex secondary
slaveDb.foo.reIndex();
-assert.eq(2, db.system.indexes.count(), "Master didn't have proper indexes after reindex");
-assert.eq(2, slaveDb.system.indexes.count(), "Slave didn't have proper indexes after reindex");
+assert.eq(2, db.foo.getIndexes().length, "Master didn't have proper indexes after reindex");
+assert.eq(2, slaveDb.foo.getIndexes().length, "Slave didn't have proper indexes after reindex");
-replTest.stopSet(15); \ No newline at end of file
+replTest.stopSet(15);
diff --git a/jstests/replsets/replset7.js b/jstests/replsets/replset7.js
index dec1832ad58..0714a23e962 100644
--- a/jstests/replsets/replset7.js
+++ b/jstests/replsets/replset7.js
@@ -45,5 +45,9 @@ assert.writeOK(bulk.execute());
rt.awaitSecondaryNodes();
// Do we have an index?
-assert.eq (1, slave.getDB( 'd' )['system.indexes']
- .find({"v" : 1,"key" : {"x" : 1},"unique" : true,"ns" : "d.c","name" : "x_1"}).count());
+assert.eq(1, slave.getDB( 'd' )['c'].getIndexes().filter(function (doc) {
+ return (doc.v === 1
+ && JSON.stringify(doc.key) === JSON.stringify({x: 1})
+ && doc.ns === 'd.c'
+ && doc.name === 'x_1');
+}).length);