summaryrefslogtreecommitdiff
path: root/jstests/repl
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2012-02-12 15:58:35 -0800
committerAaron <aaron@10gen.com>2012-02-12 15:58:35 -0800
commit48c1fe51df8736f12be2954e61d9516f25cb2b46 (patch)
treeaf0952b552df7837b6d43cb85f9384d2b4bed720 /jstests/repl
parent9328dc4472192cccb4bfd8919d09c6b5f19cad95 (diff)
downloadmongo-48c1fe51df8736f12be2954e61d9516f25cb2b46.tar.gz
SERVER-4943 test
Diffstat (limited to 'jstests/repl')
-rw-r--r--jstests/repl/repl19.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/jstests/repl/repl19.js b/jstests/repl/repl19.js
new file mode 100644
index 00000000000..71d4335014a
--- /dev/null
+++ b/jstests/repl/repl19.js
@@ -0,0 +1,39 @@
+// Test initial sync cloning of a $pop operation.
+// SERVER-4943
+
+if ( 0 ) { // SERVER-4943
+
+rt = new ReplTest( "repl19tests" );
+
+master = rt.start( true );
+mc = master.getDB( 'd' )[ 'c' ];
+
+for( i = 0; i < 100000; ++i ) {
+ mc.insert( { _id:i, z:i } );
+}
+
+targetId = 1000*1000;
+mc.insert( { _id:targetId, val:[ 1, 2, 3 ] } );
+master.getDB( 'd' ).getLastError();
+
+slave = rt.start( false );
+sc = slave.getDB( 'd' )[ 'c' ];
+
+// Wait for slave to start cloning.
+assert.soon( function() { c = sc.count(); /*print( c );*/ return c > 0; } );
+
+// $pop first element of val.
+mc.update( { _id:targetId }, { $pop:{ val:-1 } } );
+// $push another element to val.
+mc.update( { _id:targetId }, { $push:{ val:4 } } );
+
+mc.insert( { _id:'sentinel' } );
+
+// Wait for the updates to be applied.
+assert.soon( function() { return sc.count( { _id:'sentinel' } ) > 0; } );
+
+// Check that the val array is as expected.
+assert.eq( [ 2, 3, 4 ], mc.findOne( { _id:targetId } ).val );
+assert.eq( [ 2, 3, 4 ], sc.findOne( { _id:targetId } ).val );
+
+}