summaryrefslogtreecommitdiff
path: root/jstests/disk
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/disk')
-rw-r--r--jstests/disk/filesize.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/jstests/disk/filesize.js b/jstests/disk/filesize.js
new file mode 100644
index 00000000000..ce0df4682c8
--- /dev/null
+++ b/jstests/disk/filesize.js
@@ -0,0 +1,35 @@
+// test for SERVER-7430: Warning about smallfiles should include filename
+
+var port = allocatePorts( 1 )[ 0 ];
+var baseName = "filesize";
+
+// Start mongod with --smallfiles
+var m = startMongod(
+ "--port", port, "--dbpath", "/data/db/" + baseName, "--nohttpinterface",
+ "--bind_ip", "127.0.0.1" , "--nojournal" , "--smallfiles" );
+
+var db = m.getDB( baseName );
+db.collection.insert( { x : 1 } );
+
+// Restart mongod without --smallFiles
+stopMongod( port );
+m = startMongodNoReset(
+ "--port", port, "--dbpath", "/data/db/" + baseName,
+ "--nohttpinterface", "--bind_ip", "127.0.0.1" , "--nojournal" );
+
+db = m.getDB( baseName );
+var log = db.adminCommand( { getLog : "global" } ).log
+
+// Find log message like:
+// "openExisting file size 16777216 but cmdLine.smallfiles=false: /data/db/filesize/local.0"
+var found = false, logline = '';
+for ( i=log.length - 1; i>= 0; i-- ) {
+ logline = log[i];
+ if ( logline.indexOf( "openExisting file" ) >= 0
+ && logline.indexOf( baseName + ".0" ) >= 0 ) {
+ found = true;
+ break;
+ }
+}
+
+assert( found );