diff --git a/jstests/disk/diskfull.js b/jstests/disk/diskfull.js index fd3ba6a4a6d..37b0f0f506a 100644 --- a/jstests/disk/diskfull.js +++ b/jstests/disk/diskfull.js @@ -1,13 +1,12 @@ -port = allocatePorts( 1 )[ 0 ]; doIt = true; -try { - m = startMongoProgram( "mongod", "--port", port, "--dbpath", "/data/db/diskfulltest", "--nohttpinterface", "--bind_ip", "127.0.0.1" ); -} catch ( e ) { +if ( !( "diskfulltest" in listFiles( "/data/db" ) ) ) { print( "path /data/db/diskfulltest/ missing, skipping diskfull test" ); doIt = false; } if ( doIt ) { + port = allocatePorts( 1 )[ 0 ]; + m = startMongoProgram( "mongod", "--port", port, "--dbpath", "/data/db/diskfulltest", "--nohttpinterface", "--bind_ip", "127.0.0.1" ); m.getDB( "diskfulltest" ).getCollection( "diskfulltest" ).save( { a: 6 } ); assert.soon( function() { return rawMongoProgramOutput().match( /dbexit: really exiting now/ ); }, "didn't see 'really exiting now'" ); assert( !rawMongoProgramOutput().match( /Got signal/ ), "saw 'Got signal', not expected. Output: " + rawMongoProgramOutput() ); diff --git a/shell/utils.cpp b/shell/utils.cpp index 39527cb3b21..c4735ee6636 100644 --- a/shell/utils.cpp +++ b/shell/utils.cpp @@ -80,6 +80,7 @@ namespace mongo { string rootname = args.firstElement().valuestrsafe(); path root( rootname ); + uassert( 12581, "listFiles: no such directory", boost::filesystem::exists( root ) ); directory_iterator end; directory_iterator i( root);