diff options
author | Antonin Kral <a.kral@bobek.cz> | 2011-03-17 00:05:43 +0100 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2011-03-17 00:05:43 +0100 |
commit | 582fc32574a3b158c81e49cb00e6ae59205e66ba (patch) | |
tree | ac64a3243e0d2121709f685695247052858115c8 /jstests/repl | |
parent | 2761bffa96595ac1698d86bbc2e95ebb0d4d6e93 (diff) | |
download | mongodb-582fc32574a3b158c81e49cb00e6ae59205e66ba.tar.gz |
Imported Upstream version 1.8.0
Diffstat (limited to 'jstests/repl')
-rw-r--r-- | jstests/repl/basic1.js | 4 | ||||
-rw-r--r-- | jstests/repl/block2.js | 15 | ||||
-rw-r--r-- | jstests/repl/mastermaster1.js | 8 | ||||
-rw-r--r-- | jstests/repl/pair1.js | 4 | ||||
-rw-r--r-- | jstests/repl/repl1.js | 2 | ||||
-rw-r--r-- | jstests/repl/repl11.js | 4 | ||||
-rw-r--r-- | jstests/repl/repl2.js | 2 | ||||
-rw-r--r-- | jstests/repl/snapshot3.js | 4 |
8 files changed, 28 insertions, 15 deletions
diff --git a/jstests/repl/basic1.js b/jstests/repl/basic1.js index 701d71e..15fc983 100644 --- a/jstests/repl/basic1.js +++ b/jstests/repl/basic1.js @@ -60,7 +60,7 @@ r = function( key , v ){ correct = { a : 2 , b : 1 }; function checkMR( t ){ - var res = t.mapReduce( m , r ); + var res = t.mapReduce( m , r , "basic1_out" ); assert.eq( correct , res.convertToSingleObject() , "checkMR: " + tojson( t ) ); } @@ -68,7 +68,7 @@ function checkNumCollections( msg , diff ){ if ( ! diff ) diff = 0; var m = am.getCollectionNames(); var s = as.getCollectionNames(); - assert.eq( m.length + diff , s.length , "lengths bad \n" + tojson( m ) + "\n" + tojson( s ) ); + assert.eq( m.length + diff , s.length , msg + " lengths bad \n" + tojson( m ) + "\n" + tojson( s ) ); } checkNumCollections( "MR1" ); diff --git a/jstests/repl/block2.js b/jstests/repl/block2.js index 0e34758..f38a4e3 100644 --- a/jstests/repl/block2.js +++ b/jstests/repl/block2.js @@ -18,25 +18,26 @@ 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 } ); -dbm.getLastError( 2 ); -check( "B" ); +assert( worked( 2 ) , "B" ); tm.save( { x : 2 } ); -dbm.getLastError( 2 , 500 ); -check( "C" ); +assert( worked( 2 , 500 ) , "C" ) rt.stop( false ); tm.save( { x : 3 } ) assert.eq( 3 , tm.count() , "D1" ); -assert.throws( function(){ dbm.getLastError( 2 , 500 ); } , "D2" ) +assert( ! worked( 2 , 500 ) , "D2" ) s = rt.start( false ) setup(); -dbm.getLastError( 2 , 30000 ) -check( "D3" ) +assert( worked( 2 , 30000 ) , "E" ) rt.stop(); diff --git a/jstests/repl/mastermaster1.js b/jstests/repl/mastermaster1.js index 9f9334b..4932d5a 100644 --- a/jstests/repl/mastermaster1.js +++ b/jstests/repl/mastermaster1.js @@ -6,6 +6,8 @@ ports = allocatePorts( 2 ) left = startMongodTest( ports[0] , "mastermaster1left" , false , { master : "" , slave : "" , source : "127.0.0.1:" + ports[1] } ) right = startMongodTest( ports[1] , "mastermaster1left" , false , { master : "" , slave : "" , source : "127.0.0.1:" + ports[0] } ) +print( "check 1" ) + x = left.getDB( "admin" ).runCommand( "ismaster" ) assert( x.ismaster , "left: " + tojson( x ) ) @@ -15,6 +17,8 @@ assert( x.ismaster , "right: " + tojson( x ) ) ldb = left.getDB( "test" ) rdb = right.getDB( "test" ) +print( "check 2" ) + ldb.foo.insert( { _id : 1 , x : "eliot" } ) var result = ldb.runCommand( { getlasterror : 1 , w : 2 , wtimeout : 20000 } ); printjson(result); @@ -27,12 +31,12 @@ print( "check 3" ) assert.eq( 2 , ldb.foo.count() , "B1" ) assert.eq( 2 , rdb.foo.count() , "B2" ) - +print( "going to stop everything" ) for ( var i=0; i<ports.length; i++ ){ stopMongod( ports[i] ); } - +print( "yay" ) diff --git a/jstests/repl/pair1.js b/jstests/repl/pair1.js index b8b7ffd..84dd7b7 100644 --- a/jstests/repl/pair1.js +++ b/jstests/repl/pair1.js @@ -40,8 +40,8 @@ check = function( s ) { // check that slave reads and writes are guarded checkSlaveGuard = function( s ) { var t = s.getDB( baseName + "-temp" ).temp; - assert.throws( t.find().count, {}, "not master" ); - assert.throws( t.find(), {}, "not master", "find did not assert" ); + assert.throws( t.find().count, [], "not master" ); + assert.throws( t.find(), [], "not master", "find did not assert" ); checkError = function() { assert.eq( "not master", s.getDB( "admin" ).getLastError() ); diff --git a/jstests/repl/repl1.js b/jstests/repl/repl1.js index 60f3942..9f46f7a 100644 --- a/jstests/repl/repl1.js +++ b/jstests/repl/repl1.js @@ -48,6 +48,8 @@ doTest = function( signal ) { assert.soon( function() { return as.find().count() == 1020; } ); assert.eq( 1, as.find( { i: 1019 } ).count() ); + assert.automsg( "m.getDB( 'local' ).getCollection( 'oplog.$main' ).stats().size > 0" ); + rt.stop(); } diff --git a/jstests/repl/repl11.js b/jstests/repl/repl11.js index c5c63b3..aef9872 100644 --- a/jstests/repl/repl11.js +++ b/jstests/repl/repl11.js @@ -35,6 +35,10 @@ doTest = function( signal ) { sa = s.getDB( baseName ).a; assert.soon( function() { return 1 == sa.count(); } ); + s.getDB( "local" ).auth( "repl", "foo" ); + assert.commandWorked( s.getDB( "admin" )._adminCommand( {serverStatus:1,repl:1} ) ); + assert.commandWorked( s.getDB( "admin" )._adminCommand( {serverStatus:1,repl:2} ) ); + rt.stop( false, signal ); ma.save( {} ); diff --git a/jstests/repl/repl2.js b/jstests/repl/repl2.js index c9fe6b9..42b0caf 100644 --- a/jstests/repl/repl2.js +++ b/jstests/repl/repl2.js @@ -31,6 +31,8 @@ doTest = function( signal ) { assert.soon( function() { return 1 == s.getDB( "admin" ).runCommand( { "resync" : 1 } ).ok; } ); soonCount( 1001 ); + assert.automsg( "m.getDB( 'local' ).getCollection( 'oplog.$main' ).stats().size > 0" ); + as = s.getDB("foo").a assert.eq( 1, as.find( { i: 0 } ).count() ); assert.eq( 1, as.find( { i: 999 } ).count() ); diff --git a/jstests/repl/snapshot3.js b/jstests/repl/snapshot3.js index d8d268d..02955e5 100644 --- a/jstests/repl/snapshot3.js +++ b/jstests/repl/snapshot3.js @@ -47,7 +47,7 @@ assert.eq( 500, rp.slave().getDB( baseName )[ baseName ].count() ); rp.master().getDB( baseName )[ baseName ].save( {i:500} ); assert.soon( function() { return 501 == rp.slave().getDB( baseName )[ baseName ].count(); } ); -assert( !rawMongoProgramOutput().match( /resync/ ) ); -assert( !rawMongoProgramOutput().match( /SyncException/ ) ); +assert( !rawMongoProgramOutput().match( new RegExp( "resync.*" + baseName + ".*\n" ) ) , "last1" ); +assert( !rawMongoProgramOutput().match( /SyncException/ ) , "last2" ); print("snapshot3.js finishes"); |