diff options
author | Aaron <aaron@10gen.com> | 2012-02-12 15:54:42 -0800 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2012-02-12 15:54:42 -0800 |
commit | 8c13962e6878a9dd8de81ca7cebb729e9cc3ac43 (patch) | |
tree | c73461cca0bd0914e3a10787c88f0a265fa5d318 /jstests/repl/repl17.js | |
parent | dffb612e61e7331bcb2b3343faa0bf2fcecd227d (diff) | |
download | mongo-8c13962e6878a9dd8de81ca7cebb729e9cc3ac43.tar.gz |
SERVER-4941 test
Diffstat (limited to 'jstests/repl/repl17.js')
-rw-r--r-- | jstests/repl/repl17.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/jstests/repl/repl17.js b/jstests/repl/repl17.js new file mode 100644 index 00000000000..8011d974328 --- /dev/null +++ b/jstests/repl/repl17.js @@ -0,0 +1,37 @@ +// Test collection rename during initial sync. +// SERVER-4941 + +if ( 0 ) { // SERVER-4941 + +rt = new ReplTest( "repl17tests" ); + +master = rt.start( true ); +md = master.getDB( 'd' ); + +for( i = 0; i < 1000; ++i ) { + md[ ''+i ].save( {} ); +} +md.getLastError(); + +slave = rt.start( false ); +sd = slave.getDB( 'd' ); + +function checkSlaveCount( collection, expectedCount ) { + count = sd[ collection ].count(); + if ( debug = false ) { + print( collection + ': ' + count ); + } + return count == expectedCount; +} + +// Wait for the slave to start cloning +assert.soon( function() { return checkSlaveCount( '0', 1 ); } ); + +assert.commandWorked( md[ '999' ].renameCollection( 'renamed' ) ); + +// Check for renamed collection on slave. +assert.soon( function() { return checkSlaveCount( '999', 0 ) && checkSlaveCount( 'renamed', 1 ); } ); + +rt.stop(); + +} |