File: diskfull.js

package info (click to toggle)
mongodb 1%3A1.4.4-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 6,816 kB
  • ctags: 11,368
  • sloc: cpp: 58,805; ansic: 18,160; python: 1,255; sh: 238; makefile: 82
file content (23 lines) | stat: -rw-r--r-- 912 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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" );
    m.getDB( "diskfulltest" ).getCollection( "diskfulltest" ).save( { a: 6 } );
    assert.soon( function() { return rawMongoProgramOutput().match( /file allocation failure/ ); }, "didn't see 'file allocation failure'" );
    assert.soon( function() { return rawMongoProgramOutput().match( /Caught Assertion in insert , continuing/ ); }, "didn't see 'Caught Assertion...'" );
    sleep( 3000 );
    m2 = new Mongo( m.host );
    printjson( m2.getDBs() );
}