summaryrefslogtreecommitdiff
path: root/jstests/slowNightly/server7428.js
blob: 1b28e3fc6204dcc5257de84c0a1a6728e1da7a3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Regression test for SERVER-7428.
//
// 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)