summaryrefslogtreecommitdiff
path: root/jstests/slowNightly
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@10gen.com>2013-10-28 19:06:46 -0400
committerSpencer T Brody <spencer@10gen.com>2013-10-28 19:06:46 -0400
commit45178f5933e1104083d790fe6a901db7a3291423 (patch)
tree24dc2c1562c19aa83e24ab9c9f75ad6dc7d7ea9e /jstests/slowNightly
parenta3b2652ec9a042396eefc469a7bea38c9106a678 (diff)
downloadmongo-45178f5933e1104083d790fe6a901db7a3291423.tar.gz
Move jstests that start their own mongod to slowNightly directory
Diffstat (limited to 'jstests/slowNightly')
-rw-r--r--jstests/slowNightly/clonecollection.js50
-rw-r--r--jstests/slowNightly/server7428.js20
2 files changed, 70 insertions, 0 deletions
diff --git a/jstests/slowNightly/clonecollection.js b/jstests/slowNightly/clonecollection.js
new file mode 100644
index 00000000000..cb413ffb5ff
--- /dev/null
+++ b/jstests/slowNightly/clonecollection.js
@@ -0,0 +1,50 @@
+// Test cloneCollection command
+// TODO(spencer): move this test out of slowNightly directory once there is a better place for tests
+// that start their own mongod's but aren't slow
+var baseName = "jstests_clonecollection";
+
+
+ports = allocatePorts( 2 );
+
+f = startMongod( "--port", ports[ 0 ], "--dbpath", "/data/db/" + baseName + "_from", "--nohttpinterface", "--bind_ip", "127.0.0.1" ).getDB( baseName );
+t = startMongod( "--port", ports[ 1 ], "--dbpath", "/data/db/" + baseName + "_to", "--nohttpinterface", "--bind_ip", "127.0.0.1" ).getDB( baseName );
+
+for( i = 0; i < 1000; ++i ) {
+ f.a.save( { i: i } );
+}
+assert.eq( 1000, f.a.find().count() , "A1" );
+
+assert.commandWorked( t.cloneCollection( "localhost:" + ports[ 0 ], "a" ) );
+assert.eq( 1000, t.a.find().count() , "A2" );
+
+t.a.drop();
+
+assert.commandWorked( t.cloneCollection( "localhost:" + ports[ 0 ], "a", { i: { $gte: 10, $lt: 20 } } ) );
+assert.eq( 10, t.a.find().count() , "A3" );
+
+t.a.drop();
+assert.eq( 0, t.system.indexes.find().count() , "prep 2");
+
+f.a.ensureIndex( { i: 1 } );
+assert.eq( 2, f.system.indexes.find().count(), "expected index missing" );
+assert.commandWorked( t.cloneCollection( "localhost:" + ports[ 0 ], "a" ) );
+if ( t.system.indexes.find().count() != 2 ) {
+ printjson( t.system.indexes.find().toArray() );
+}
+assert.eq( 2, t.system.indexes.find().count(), "expected index missing" );
+// Verify index works
+x = t.a.find( { i: 50 } ).hint( { i: 1 } ).explain()
+printjson( x )
+assert.eq( 50, x.indexBounds.i[0][0] , "verify 1" );
+assert.eq( 1, t.a.find( { i: 50 } ).hint( { i: 1 } ).toArray().length, "match length did not match expected" );
+
+// Check that capped-ness is preserved on clone
+f.a.drop();
+t.a.drop();
+
+f.createCollection( "a", {capped:true,size:1000} );
+assert( f.a.isCapped() );
+assert.commandWorked( t.cloneCollection( "localhost:" + ports[ 0 ], "a" ) );
+assert( t.a.isCapped(), "cloned collection not capped" );
+
+
diff --git a/jstests/slowNightly/server7428.js b/jstests/slowNightly/server7428.js
new file mode 100644
index 00000000000..77043c9bc03
--- /dev/null
+++ b/jstests/slowNightly/server7428.js
@@ -0,0 +1,20 @@
+// Regression test for SERVER-7428.
+
+// TODO(spencer): move this test out of slowNightly directory once there is a better place for tests
+// that start their own mongod's but aren't slow
+
+// Verify that the copyDatabase command works appropriately when the
+// target mongo instance has authentication enabled.
+
+
+// Setup fromDb with no auth
+var fromDb = MongoRunner.runMongod({ port: 29000 });
+
+// Setup toDb with auth
+var toDb = MongoRunner.runMongod({auth : "", port : 31001});
+var admin = toDb.getDB("admin");
+admin.addUser({user: "foo", pwd: "bar", roles: jsTest.adminUserRoles});
+admin.auth("foo","bar");
+
+admin.copyDatabase('test', 'test', fromDb.host)
+