This is just a cleanup work to hide some of the private state of ReplSetTest so it is easier to encapsulate and add new logic. Also enables strict mode.
27 lines
771 B
JavaScript
27 lines
771 B
JavaScript
(function() {
|
|
|
|
var st = new ShardingTest({ shards: 1 });
|
|
|
|
var testDB = st.s.getDB('test');
|
|
assert.writeOK(testDB.foo.insert({ a: 1 }));
|
|
|
|
var res = testDB.adminCommand({ copydb: 1,
|
|
fromhost: st.s.host,
|
|
fromdb: 'test',
|
|
todb: 'test_copy' });
|
|
assert.commandWorked(res);
|
|
|
|
var copy = st.s.getDB('test_copy');
|
|
assert.eq(1, copy.foo.count());
|
|
assert.eq(1, copy.foo.findOne().a);
|
|
|
|
// Test invalid todb database name.
|
|
assert.commandFailed(testDB.adminCommand({ copydb: 1,
|
|
fromhost: st.s.host,
|
|
fromdb: 'test_copy',
|
|
todb: 'test/copy' }));
|
|
|
|
st.stop();
|
|
|
|
})();
|