From 582fc32574a3b158c81e49cb00e6ae59205e66ba Mon Sep 17 00:00:00 2001 From: Antonin Kral Date: Thu, 17 Mar 2011 00:05:43 +0100 Subject: Imported Upstream version 1.8.0 --- jstests/repl/basic1.js | 4 ++-- jstests/repl/block2.js | 15 ++++++++------- jstests/repl/mastermaster1.js | 8 ++++++-- jstests/repl/pair1.js | 4 ++-- jstests/repl/repl1.js | 2 ++ jstests/repl/repl11.js | 4 ++++ jstests/repl/repl2.js | 2 ++ jstests/repl/snapshot3.js | 4 ++-- 8 files changed, 28 insertions(+), 15 deletions(-) (limited to 'jstests/repl') 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 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"); -- cgit v1.2.3