summaryrefslogtreecommitdiff
path: root/jstests/repl/block2.js
blob: f38a4e3fc1d1c9dd0ab3556e803d386172330970 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

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 );
}

function worked( w , wtimeout ){
    return dbm.getLastError( w , wtimeout ) == null;
}

check( "A" );

tm.save( { x : 1 } );
assert( worked( 2 ) , "B" );

tm.save( { x : 2 } );
assert( worked( 2 , 500 ) , "C" ) 

rt.stop( false );
tm.save( { x : 3 } )
assert.eq( 3 , tm.count() , "D1" );
assert( ! worked( 2 , 500 ) , "D2" )

s = rt.start( false )
setup();
assert( worked( 2 , 30000 ) , "E" )

rt.stop();