0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/jstests/dbadmin.js

31 lines
1016 B
JavaScript
Raw Normal View History

t = db.dbadmin;
t.save( { x : 1 } );
2010-01-02 14:41:12 +01:00
before = db._adminCommand( "serverStatus" )
2010-01-11 02:22:17 +01:00
if ( before.mem.supported ){
2010-02-04 16:52:59 +01:00
cmdres = db._adminCommand( "closeAllDatabases" );
2010-01-02 16:10:40 +01:00
after = db._adminCommand( "serverStatus" );
2010-02-05 18:45:05 +01:00
assert( before.mem.mapped > after.mem.mapped , "closeAllDatabases does something before:" + tojson( before.mem ) + " after:" + tojson( after.mem ) + " cmd res:" + tojson( cmdres ) );
2010-02-04 18:12:01 +01:00
print( before.mem.mapped + " -->> " + after.mem.mapped );
2010-01-02 16:10:40 +01:00
}
else {
print( "can't test serverStatus on this machine" );
}
t.save( { x : 1 } );
res = db._adminCommand( "listDatabases" );
2010-06-21 19:17:05 +02:00
assert( res.databases && res.databases.length > 0 , "listDatabases 1 " + tojson(res) );
2010-01-11 02:22:17 +01:00
2010-07-14 20:06:08 +02:00
x = db._adminCommand( "ismaster" );
assert( x.ismaster , "ismaster failed: " + tojson( x ) )
before = db.runCommand( "serverStatus" )
sleep( 5000 )
after = db.runCommand( "serverStatus" )
assert.lt( 3 , after.uptimeEstimate , "up1" )
2010-08-12 20:22:01 +02:00
assert.gt( after.uptimeEstimate , before.uptimeEstimate , "up2" )
2010-01-02 14:41:12 +01:00
// TODO: add more tests here