diff options
author | Sam Helman <sam.helman@10gen.com> | 2014-12-10 15:23:12 -0500 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2014-12-10 16:18:57 -0500 |
commit | bf834456c3e5a02fbe6fed340563a3c5fa548e4c (patch) | |
tree | 36da7f4d11008463c82cac11935895e739bfcd5e /jstests/tool/dumprestore8.js | |
parent | 344df1a62e8efc748f7feded04ab2a20fdc3619f (diff) | |
download | mongo-bf834456c3e5a02fbe6fed340563a3c5fa548e4c.tar.gz |
TOOLS-450 some dumprestore js tests query system.indexes or system.namespaces directly
Closes #875
Signed-off-by: Benety Goh <benety@mongodb.com>
Diffstat (limited to 'jstests/tool/dumprestore8.js')
-rw-r--r-- | jstests/tool/dumprestore8.js | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/jstests/tool/dumprestore8.js b/jstests/tool/dumprestore8.js index aed8072eb28..88b501cc0f2 100644 --- a/jstests/tool/dumprestore8.js +++ b/jstests/tool/dumprestore8.js @@ -1,5 +1,6 @@ // dumprestore8.js + // This file tests that indexes and capped collection options get properly dumped and restored. // It checks that this works both when doing a full database dump/restore and when doing it just for a single db or collection @@ -31,8 +32,7 @@ db.bar.ensureIndex({x:1}); barDocCount = db.bar.count(); assert.gt( barDocCount, 0 , "No documents inserted" ); assert.lt( db.bar.count(), 1000 , "Capped collection didn't evict documents" ); -assert.eq( 3 , db.foo.getIndexes().length , "Indexes on foo weren't created right" ); -assert.eq( 2 , db.bar.getIndexes().length , "Indexes on bar weren't created right" ); +assert.eq( 5 , db.foo.getIndexes().length + db.bar.getIndexes().length, "Indexes weren't created right" ); // Full dump/restore @@ -42,8 +42,8 @@ t.runTool( "dump" , "--out" , t.ext ); db.dropDatabase(); assert.eq( 0 , db.foo.count() , "foo not dropped" ); assert.eq( 0 , db.bar.count() , "bar not dropped" ); -assert.eq( 0 , db.foo.getIndexes().length , "indexes on foo not dropped" ); assert.eq( 0 , db.bar.getIndexes().length , "indexes on bar not dropped" ); +assert.eq( 0 , db.foo.getIndexes().length , "indexes on foo not dropped" ); t.runTool( "restore" , "--dir" , t.ext ); @@ -54,9 +54,7 @@ for (var i = 0; i < 10; i++) { db.bar.save({x:i}); } assert.eq( barDocCount, db.bar.count(), "Capped collection didn't evict documents after restore." ); -assert.eq( 3 , db.foo.getIndexes().length , "Indexes on foo weren't created correctly by restore" ); -assert.eq( 2 , db.bar.getIndexes().length , "Indexes on bar weren't created correctly by restore" ); - +assert.eq( 5 , db.foo.getIndexes().length + db.bar.getIndexes().length, "Indexes weren't created correctly by restore"); // Dump/restore single DB @@ -81,8 +79,7 @@ for (var i = 0; i < 10; i++) { db.bar.save({x:i}); } assert.eq( barDocCount, db.bar.count(), "Capped collection didn't evict documents after restore 2." ); -assert.eq( 3 , db.foo.getIndexes().length , "Indexes on foo weren't created correctly by restore 2" ); -assert.eq( 2 , db.bar.getIndexes().length , "Indexes on bar weren't created correctly by restore 2" ); +assert.eq( 5 , db.foo.getIndexes().length + db.bar.getIndexes().length, "Indexes weren't created correctly by restore 2"); // Dump/restore single collection @@ -93,8 +90,7 @@ t.runTool( "dump" , "-d", dbname2, "-c", "bar", "--out" , dumppath ); db.dropDatabase(); assert.eq( 0 , db.bar.count() , "bar not dropped3" ); -assert.eq( 0 , db.foo.getIndexes().length , "indexes on foo not dropped3" ); -assert.eq( 0 , db.bar.getIndexes().length , "indexes on bar not dropped3" ); +assert.eq( 0 , db.bar.getIndexes().length , "indexes not dropped3" ); t.runTool( "restore" , "-d", dbname, "-c", "baz", "--dir" , dumppath + dbname2 + "/bar.bson" ); @@ -106,6 +102,6 @@ for (var i = 0; i < 10; i++) { db.baz.save({x:i}); } assert.eq( barDocCount, db.baz.count(), "Capped collection didn't evict documents after restore 3." ); -assert.eq( 2 , db.baz.getIndexes().length , "Indexes on baz weren't created correctly by restore 3" ); +assert.eq( 2 , db.baz.getIndexes().length , "Indexes weren't created correctly by restore 3" ); t.stop(); |