2010-08-11 19:37:09 -04:00
|
|
|
#!/usr/bin/mongod
|
|
|
|
|
|
2009-05-15 14:55:18 -04:00
|
|
|
baseName = "jstests_shellspawn";
|
|
|
|
|
t = db.getCollection( baseName );
|
|
|
|
|
t.drop();
|
|
|
|
|
|
2009-06-03 14:30:11 -04:00
|
|
|
if ( typeof( _startMongoProgram ) == "undefined" ){
|
|
|
|
|
print( "no fork support" );
|
|
|
|
|
}
|
|
|
|
|
else {
|
2010-02-02 22:46:31 -05:00
|
|
|
spawn = startMongoProgramNoConnect( "mongo", "--port", myPort(), "--eval", "sleep( 2000 ); db.getCollection( '" + baseName + "' ).save( {a:1} );" );
|
2011-03-17 10:51:52 -07:00
|
|
|
|
|
|
|
|
// assert.soon( function() { return 1 == t.count(); } );
|
|
|
|
|
// SERVER-2784 debugging - error message overwritten to indicate last count value.
|
|
|
|
|
assert.soon( "count = t.count(); msg = 'did not reach expected count, last value: ' + t.count(); 1 == count;" );
|
2009-06-03 14:30:11 -04:00
|
|
|
|
|
|
|
|
stopMongoProgramByPid( spawn );
|
|
|
|
|
|
2010-02-02 22:46:31 -05:00
|
|
|
spawn = startMongoProgramNoConnect( "mongo", "--port", myPort(), "--eval", "print( 'I am a shell' );" );
|
2009-06-03 14:30:11 -04:00
|
|
|
|
2010-06-07 10:03:07 -04:00
|
|
|
stopMongoProgramByPid( spawn );
|
|
|
|
|
|
2009-06-03 14:30:11 -04:00
|
|
|
spawn = startMongoProgramNoConnect( "mongo", "--port", myPort() );
|
2010-06-07 10:03:07 -04:00
|
|
|
|
|
|
|
|
stopMongoProgramByPid( spawn );
|
2009-06-03 14:30:11 -04:00
|
|
|
|
|
|
|
|
spawn = startMongoProgramNoConnect( "mongo", "--port", myPort() );
|
|
|
|
|
|
|
|
|
|
stopMongoProgramByPid( spawn );
|
2010-06-07 10:03:07 -04:00
|
|
|
|
2009-06-03 14:30:11 -04:00
|
|
|
// all these shells should be killed
|
2010-02-02 22:46:31 -05:00
|
|
|
}
|