diff options
Diffstat (limited to 'jstests/repl/repl17.js')
-rw-r--r-- | jstests/repl/repl17.js | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/jstests/repl/repl17.js b/jstests/repl/repl17.js index 651bebdaa09..cd62e6c7ac6 100644 --- a/jstests/repl/repl17.js +++ b/jstests/repl/repl17.js @@ -1,37 +1,40 @@ // Test collection rename during initial sync. // SERVER-4941 -if ( 0 ) { // SERVER-4941 +if (0) { // SERVER-4941 -rt = new ReplTest( "repl17tests" ); + rt = new ReplTest("repl17tests"); -master = rt.start( true ); -md = master.getDB( 'd' ); + master = rt.start(true); + md = master.getDB('d'); -for( i = 0; i < 1000; ++i ) { - md[ ''+i ].save( {} ); -} + for (i = 0; i < 1000; ++i) { + md['' + i].save({}); + } -slave = rt.start( false ); -sd = slave.getDB( 'd' ); + slave = rt.start(false); + sd = slave.getDB('d'); -function checkSlaveCount( collection, expectedCount ) { - var count = sd[ collection ].count(); - var debug = false; - if ( debug ) { - print( collection + ': ' + count ); + function checkSlaveCount(collection, expectedCount) { + var count = sd[collection].count(); + var debug = false; + if (debug) { + print(collection + ': ' + count); + } + return count == expectedCount; } - return count == expectedCount; -} - -// Wait for the slave to start cloning -assert.soon( function() { return checkSlaveCount( '0', 1 ); } ); -assert.commandWorked( md[ '999' ].renameCollection( 'renamed' ) ); + // Wait for the slave to start cloning + assert.soon(function() { + return checkSlaveCount('0', 1); + }); -// Check for renamed collection on slave. -assert.soon( function() { return checkSlaveCount( '999', 0 ) && checkSlaveCount( 'renamed', 1 ); } ); + assert.commandWorked(md['999'].renameCollection('renamed')); -rt.stop(); + // Check for renamed collection on slave. + assert.soon(function() { + return checkSlaveCount('999', 0) && checkSlaveCount('renamed', 1); + }); + rt.stop(); } |