Permalink
Browse files

tests for SERVER-467

  • Loading branch information...
1 parent 7353829 commit 16718fe78555180bf4da08bfa9a966642966a13e @erh erh committed Apr 2, 2010
Showing with 69 additions and 0 deletions.
  1. +24 −0 jstests/repl/block1.js
  2. +45 −0 jstests/repl/block2.js
View
@@ -0,0 +1,24 @@
+
+var rt = new ReplTest( "block1" );
+
+m = rt.start( true );
+s = rt.start( false );
+
+dbm = m.getDB( "foo" );
+dbs = s.getDB( "foo" );
+
+tm = dbm.bar;
+ts = dbs.bar;
+
+for ( var i=0; i<1000; i++ ){
+ tm.insert( { _id : i } );
+ dbm.runCommand( { getlasterror : 1 , w : 2 } )
+ assert.eq( i + 1 , ts.count() , "A" + i );
+ assert.eq( i + 1 , tm.count() , "B" + i );
+}
+
+rt.stop();
+
+
+
+
View
@@ -0,0 +1,45 @@
+
+var rt = new ReplTest( "block1" );
+
+m = rt.start( true );
+s = rt.start( false );
+
+function setup(){
+
+ dbm = m.getDB( "foo" );
+ dbs = s.getDB( "foo" );
+
+ tm = dbm.bar;
+ ts = dbs.bar;
+}
+setup();
+
+function check( msg ){
+ assert.eq( tm.count() , ts.count() , "check: " + msg );
+}
+
+check( "A" );
+
+tm.save( { x : 1 } );
+dbm.getLastError( 2 );
+check( "B" );
+
+tm.save( { x : 2 } );
+dbm.getLastError( 2 , 500 );
+check( "C" );
+
+rt.stop( false );
+tm.save( { x : 3 } )
+assert.eq( 3 , tm.count() , "D1" );
+assert.throws( function(){ dbm.getLastError( 2 , 500 ); } , "D2" )
+
+s = rt.start( false )
+setup();
+dbm.getLastError( 2 , 30000 )
+check( "D3" )
+
+rt.stop();
+
+
+
+

0 comments on commit 16718fe

Please sign in to comment.