summaryrefslogtreecommitdiff
path: root/jstests/disk/diskfull.js
blob: 6cbcbb78f27e05854281fa61365a68f8382356cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
doIt = false;
files = listFiles( "/data/db" );
for ( i in files ) {
    if ( files[ i ].name == "/data/db/diskfulltest" ) {
        doIt = true;
    }
}

if ( !doIt ) {
    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" );
    c = m.getDB( "diskfulltest" ).getCollection( "diskfulltest" )
    c.save( { a: 6 } );
    assert.soon( function() { return rawMongoProgramOutput().match( /file allocation failure/ ); }, "didn't see 'file allocation failure'" );
    assert.isnull( c.findOne() , "shouldn't exist" );
    sleep( 3000 );
    m2 = new Mongo( m.host );
    printjson( m2.getDBs() );
}