diff options
Diffstat (limited to 'jstests/replsets/replset1.js')
| -rw-r--r-- | jstests/replsets/replset1.js | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/jstests/replsets/replset1.js b/jstests/replsets/replset1.js index 6387c5d8624..4b48f980cef 100644 --- a/jstests/replsets/replset1.js +++ b/jstests/replsets/replset1.js @@ -1,3 +1,5 @@ +load("jstests/replsets/rslib.js") + doTest = function( signal ) { // Test basic replica set functionality. @@ -43,7 +45,7 @@ doTest = function( signal ) { var temp = replTest.getURL(); temp = temp.substring( 0 , temp.lastIndexOf( "," ) ); temp = new Mongo( temp ).getDB( "foo" ); - assert.eq( 1000 , temp.foo.findOne().a , "cppconn 1" ); + assert.eq( 1000 , temp.foo.findOne().a , "cppconn 1" ); } @@ -59,16 +61,8 @@ doTest = function( signal ) { assert( master_id != new_master_id, "Old master shouldn't be equal to new master." ); - { - // this may fail since it has to reconnect - try { - cppconn.foo.findOne() - } - catch ( e ){ - } - assert.eq( 1000 , cppconn.foo.findOne().a , "cppconn 2" ); - - } + reconnect(cppconn); + assert.eq( 1000 , cppconn.foo.findOne().a , "cppconn 2" ); // Now let's write some documents to the new master for(var i=0; i<1000; i++) { @@ -121,7 +115,11 @@ doTest = function( signal ) { t.save({a: 1000}); t.ensureIndex( { a : 1 } ) - db.getLastError( 3 , 30000 ) + result = db.runCommand({getLastError : 1, w: 3 , wtimeout :30000 }) + printjson(result); + lastOp = result.lastOp; + lastOplogOp = master.getDB("local").oplog.rs.find().sort({$natural : -1}).limit(1).next(); + assert.eq(lastOplogOp['ts'], lastOp); ts.forEach( function(z){ assert.eq( 2 , z.getIndexKeys().length , "A " + z.getMongo() ); } ) @@ -134,5 +132,5 @@ doTest = function( signal ) { replTest.stopSet( signal ); } -doTest( 15 );
-print("replset1.js SUCCESS");
+doTest( 15 ); +print("replset1.js SUCCESS"); |
