diff options
88 files changed, 164 insertions, 157 deletions
diff --git a/buildscripts/smoke.py b/buildscripts/smoke.py index d09f1cbde13..97f2ff63565 100755 --- a/buildscripts/smoke.py +++ b/buildscripts/smoke.py @@ -464,6 +464,10 @@ def runTest(test, result): # Blech. if os.path.basename(path) in ["test", "test.exe", "perftest", "perftest.exe"]: argv = [path] + # default data directory for test and perftest is /tmp/unittest + if smoke_db_prefix: + dir_name = smoke_db_prefix + '/unittests' + argv.extend(["--dbpath", dir_name] ) # more blech elif os.path.basename(path) in ['mongos', 'mongos.exe']: argv = [path, "--test"] @@ -508,6 +512,9 @@ def runTest(test, result): '"' + str(authMechanism) + '"', 'null') + ";" + \ 'TestData.useSSL = ' + ternary( use_ssl ) + ";" + \ 'TestData.useX509 = ' + ternary( use_x509 ) + ";" + # this updates the default data directory for mongod processes started through shell (src/mongo/shell/servers.js) + evalString += 'MongoRunner.dataDir = "' + os.path.abspath(smoke_db_prefix + '/data/db') + '";' + evalString += 'MongoRunner.dataPath = MongoRunner.dataDir + "/";' if os.sys.platform == "win32": # double quotes in the evalString on windows; this # prevents the backslashes from being removed when diff --git a/jstests/_lodeRunner.js b/jstests/_lodeRunner.js index 6e23dbb974a..1aceee64987 100644 --- a/jstests/_lodeRunner.js +++ b/jstests/_lodeRunner.js @@ -1,4 +1,4 @@ // Start mongod and run jstests/_runner.js -db = startMongod( "--port", "27018", "--dbpath", "/data/db/jstests" ).getDB( "test" ); +db = startMongod( "--port", "27018", "--dbpath", MongoRunner.dataDir + "/jstests" ).getDB( "test" ); load( "jstests/_runner.js" ); diff --git a/jstests/auth/auth1.js b/jstests/auth/auth1.js index 27d89eca3f0..9419230869d 100644 --- a/jstests/auth/auth1.js +++ b/jstests/auth/auth1.js @@ -5,7 +5,7 @@ print("START auth1.js"); port = allocatePorts( 1 )[ 0 ]; baseName = "jstests_auth_auth1"; -m = startMongod( "--auth", "--port", port, "--dbpath", "/data/db/" + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" ); +m = startMongod( "--auth", "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" ); db = m.getDB( "test" ); t = db[ baseName ]; diff --git a/jstests/auth/auth2.js b/jstests/auth/auth2.js index f63390edf84..9e070e0bb68 100644 --- a/jstests/auth/auth2.js +++ b/jstests/auth/auth2.js @@ -3,7 +3,7 @@ port = allocatePorts( 1 )[ 0 ]; baseName = "jstests_auth_auth2"; -m = startMongod( "--auth", "--port", port, "--dbpath", "/data/db/" + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" , "--nojournal" , "--smallfiles" ); +m = startMongod( "--auth", "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" , "--nojournal" , "--smallfiles" ); db = m.getDB( "admin" ); t = db[ baseName ]; diff --git a/jstests/auth/copyauth.js b/jstests/auth/copyauth.js index cac98fe6608..d82f5b22093 100644 --- a/jstests/auth/copyauth.js +++ b/jstests/auth/copyauth.js @@ -8,8 +8,8 @@ ports = allocatePorts( 2 ); var baseName = "jstests_clone_copyauth"; // test copyDatabase from an auth enabled source, with an unauthed dest. -var source = startMongod( "--auth", "--port", ports[ 0 ], "--dbpath", "/data/db/" + baseName + "_source", "--nohttpinterface", "--bind_ip", "127.0.0.1", "--smallfiles" ); -var target = startMongod( "--port", ports[ 1 ], "--dbpath", "/data/db/" + baseName + "_target", "--nohttpinterface", "--bind_ip", "127.0.0.1", "--smallfiles" ); +var source = startMongod( "--auth", "--port", ports[ 0 ], "--dbpath", MongoRunner.dataPath + baseName + "_source", "--nohttpinterface", "--bind_ip", "127.0.0.1", "--smallfiles" ); +var target = startMongod( "--port", ports[ 1 ], "--dbpath", MongoRunner.dataPath + baseName + "_target", "--nohttpinterface", "--bind_ip", "127.0.0.1", "--smallfiles" ); source.getDB( "admin" ).addUser( "super", "super" ); source.getDB( "admin" ).auth( "super", "super" ); @@ -29,7 +29,7 @@ assert.eq( 1, target.getDB( baseName )[ baseName ].findOne().i ); // Test with auth-enabled source and dest stopMongod( ports[ 1 ] ); -var target = startMongod( "--auth", "--port", ports[ 1 ], "--dbpath", "/data/db/" + baseName + "_target", "--nohttpinterface", "--bind_ip", "127.0.0.1", "--smallfiles" ); +var target = startMongod( "--auth", "--port", ports[ 1 ], "--dbpath", MongoRunner.dataPath + baseName + "_target", "--nohttpinterface", "--bind_ip", "127.0.0.1", "--smallfiles" ); target.getDB( "admin" ).addUser( "super1", "super1" ); assert.throws( function() { source.getDB( baseName )[ baseName ].findOne(); } ); @@ -48,7 +48,7 @@ assert.eq( 1, target.getDB( baseName )[ baseName ].findOne().i ); // Test with auth-enabled dest, but un-authed source stopMongod(ports[0]); var source = startMongod( "--port", ports[ 0 ], - "--dbpath", "/data/db/" + baseName + "_source", + "--dbpath", MongoRunner.dataPath + baseName + "_source", "--nohttpinterface", "--bind_ip", "127.0.0.1", "--smallfiles" ); diff --git a/jstests/auth/localhostAuthBypass.js b/jstests/auth/localhostAuthBypass.js index f5abf7b8398..8d5c140fdc8 100644 --- a/jstests/auth/localhostAuthBypass.js +++ b/jstests/auth/localhostAuthBypass.js @@ -4,7 +4,7 @@ //mongod whether it is hosted with "localhost" or a hostname. var baseName = "auth_server-6591"; -var dbpath = "/data/db/" + baseName; +var dbpath = MongoRunner.dataPath + baseName; var username = "foo"; var password = "bar"; var port = allocatePorts(1)[0]; diff --git a/jstests/auth/mr_auth.js b/jstests/auth/mr_auth.js index 89d08229b7d..a9945b515c5 100644 --- a/jstests/auth/mr_auth.js +++ b/jstests/auth/mr_auth.js @@ -13,7 +13,7 @@ ports = allocatePorts( 2 ); // make sure writing is allowed when started without --auth enabled port = ports[ 0 ]; -dbms = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" ); +dbms = startMongod( "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" ); var d = dbms.getDB( dbName ); var t = d[ baseName ]; @@ -41,7 +41,7 @@ stopMongod( port ); // In --auth mode, read-only user should not be able to write to existing or temporary collection, thus only can execute inline mode port = ports[ 1 ]; -dbms = startMongodNoReset( "--auth", "--port", port, "--dbpath", "/data/db/" + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" ); +dbms = startMongodNoReset( "--auth", "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" ); d = dbms.getDB( dbName ); t = d[ baseName ]; diff --git a/jstests/auth/rename.js b/jstests/auth/rename.js index 99d6a7bd8a3..0cdf191ef26 100644 --- a/jstests/auth/rename.js +++ b/jstests/auth/rename.js @@ -3,7 +3,7 @@ port = allocatePorts( 1 )[ 0 ]; baseName = "jstests_rename_auth"; -m = startMongod( "--auth", "--port", port, "--dbpath", "/data/db/" + baseName, "--nohttpinterface" ); +m = startMongod( "--auth", "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--nohttpinterface" ); db1 = m.getDB( baseName ) db2 = m.getDB( baseName + '_other' ) diff --git a/jstests/auth/server-4892.js b/jstests/auth/server-4892.js index ba8236d3d80..bec2baf7e85 100644 --- a/jstests/auth/server-4892.js +++ b/jstests/auth/server-4892.js @@ -6,7 +6,7 @@ */ var baseName = 'jstests_auth_server4892'; -var dbpath = '/data/db/' + baseName; +var dbpath = MongoRunner.dataPath + baseName; var port = allocatePorts( 1 )[ 0 ]; var mongod_common_args = [ '--port', port, '--dbpath', dbpath, '--bind_ip', '127.0.0.1', '--nohttpinterface' ]; diff --git a/jstests/auth/show_log_auth.js b/jstests/auth/show_log_auth.js index 35847b30489..11c795b7593 100644 --- a/jstests/auth/show_log_auth.js +++ b/jstests/auth/show_log_auth.js @@ -3,7 +3,7 @@ var port = allocatePorts( 1 )[ 0 ]; var baseName = "jstests_show_log_auth"; -var m = startMongod( "--auth", "--port", port, "--dbpath", "/data/db/" + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" , "--nojournal" , "--smallfiles" ); +var m = startMongod( "--auth", "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" , "--nojournal" , "--smallfiles" ); var db = m.getDB( "admin" ); db.addUser({user: "admin" , pwd: "pass", roles: jsTest.adminUserRoles}); diff --git a/jstests/disk/dbNoCreate.js b/jstests/disk/dbNoCreate.js index c93267ba0c3..974f968e7b8 100644 --- a/jstests/disk/dbNoCreate.js +++ b/jstests/disk/dbNoCreate.js @@ -1,6 +1,6 @@ var baseName = "jstests_dbNoCreate"; -var m = startMongod( "--port", "27018", "--dbpath", "/data/db/" + baseName ); +var m = startMongod( "--port", "27018", "--dbpath", MongoRunner.dataPath + baseName ); var t = m.getDB( baseName ).t; @@ -15,5 +15,5 @@ t.drop(); stopMongod( 27018 ); -var m = startMongoProgram( "mongod", "--port", "27018", "--dbpath", "/data/db/" + baseName ); +var m = startMongoProgram( "mongod", "--port", "27018", "--dbpath", MongoRunner.dataPath + baseName ); assert.eq( -1, m.getDBNames().indexOf( baseName ) ); diff --git a/jstests/disk/directoryperdb.js b/jstests/disk/directoryperdb.js index 4c2fac4ece3..db095b3a8fa 100644 --- a/jstests/disk/directoryperdb.js +++ b/jstests/disk/directoryperdb.js @@ -1,7 +1,7 @@ var baseDir = "jstests_disk_directoryper"; var baseName = "directoryperdb" port = allocatePorts( 1 )[ 0 ]; -dbpath = "/data/db/" + baseDir + "/"; +dbpath = MongoRunner.dataPath + baseDir + "/"; var m = startMongodTest(port, baseDir, false, {directoryperdb : "", nohttpinterface : "", bind_ip : "127.0.0.1"}); db = m.getDB( baseName ); @@ -47,7 +47,7 @@ assert.eq( 1, db[ baseName ].count() , "C" ); // tool test stopMongod( port ); -externalPath = "/data/db/" + baseDir + "_external/"; +externalPath = MongoRunner.dataPath + baseDir + "_external/"; runMongoProgram( "mongodump", "--dbpath", dbpath, "--directoryperdb", "--out", externalPath ); resetDbpath( dbpath ); diff --git a/jstests/disk/diskfull.js b/jstests/disk/diskfull.js index 7dd34c09484..deaab67a969 100644 --- a/jstests/disk/diskfull.js +++ b/jstests/disk/diskfull.js @@ -1,7 +1,7 @@ doIt = false; -dbpath = "/data/db/diskfulltest"; +dbpath = MongoRunner.dataDir + "/diskfulltest"; -files = listFiles( "/data/db" ); +files = listFiles( MongoRunner.dataDir ); for ( i in files ) { if ( files[ i ].name == dbpath ) { doIt = true; diff --git a/jstests/disk/filesize.js b/jstests/disk/filesize.js index 68570264dfa..fbab8966fc1 100644 --- a/jstests/disk/filesize.js +++ b/jstests/disk/filesize.js @@ -4,7 +4,7 @@ var baseName = "filesize"; // Start mongod with --smallfiles var m = startMongod( - "--port", port, "--dbpath", "/data/db/" + baseName, "--nohttpinterface", + "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" , "--nojournal" , "--smallfiles" ); var db = m.getDB( baseName ); @@ -16,7 +16,7 @@ if (db.serverBuildInfo().bits == 32) { // Restart mongod without --smallFiles stopMongod( port ); m = startMongodNoReset( - "--port", port, "--dbpath", "/data/db/" + baseName, + "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" , "--nojournal" ); db = m.getDB( baseName ); diff --git a/jstests/disk/killall.js b/jstests/disk/killall.js index 01d9e57e118..a46a3588241 100644 --- a/jstests/disk/killall.js +++ b/jstests/disk/killall.js @@ -15,7 +15,7 @@ port = allocatePorts( 1 )[ 0 ] var baseName = "jstests_disk_killall"; -var dbpath = "/data/db/" + baseName; +var dbpath = MongoRunner.dataPath + baseName; var mongod = startMongod( "--port", port, "--dbpath", dbpath, "--nohttpinterface" ); var db = mongod.getDB( "test" ); diff --git a/jstests/disk/newcollection.js b/jstests/disk/newcollection.js index 71a17373ae0..2c39389a81b 100644 --- a/jstests/disk/newcollection.js +++ b/jstests/disk/newcollection.js @@ -2,7 +2,7 @@ port = allocatePorts( 1 )[ 0 ] var baseName = "jstests_disk_newcollection"; -var m = startMongod( "--noprealloc", "--smallfiles", "--port", port, "--dbpath", "/data/db/" + baseName ); +var m = startMongod( "--noprealloc", "--smallfiles", "--port", port, "--dbpath", MongoRunner.dataPath + baseName ); //var m = db.getMongo(); db = m.getDB( "test" ); diff --git a/jstests/disk/newcollection1.js b/jstests/disk/newcollection1.js index e11e4a93a8a..4b088d66d28 100644 --- a/jstests/disk/newcollection1.js +++ b/jstests/disk/newcollection1.js @@ -2,7 +2,7 @@ port = allocatePorts( 1 )[ 0 ] var baseName = "jstests_disk_newcollection1"; -var m = startMongod( "--noprealloc", "--smallfiles", "--port", port, "--dbpath", "/data/db/" + baseName ); +var m = startMongod( "--noprealloc", "--smallfiles", "--port", port, "--dbpath", MongoRunner.dataPath + baseName ); db = m.getDB( "test" ); diff --git a/jstests/disk/norepeat.js b/jstests/disk/norepeat.js index 985fc3637ab..1379ff1af20 100644 --- a/jstests/disk/norepeat.js +++ b/jstests/disk/norepeat.js @@ -2,7 +2,7 @@ baseName = "jstests_disk_norepeat"; ports = allocatePorts( 1 ); -m = startMongod( "--port", ports[ 0 ], "--deDupMem", "200", "--dbpath", "/data/db/" + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" ); +m = startMongod( "--port", ports[ 0 ], "--deDupMem", "200", "--dbpath", MongoRunner.dataPath + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" ); t = m.getDB( baseName ).getCollection( baseName ); diff --git a/jstests/disk/preallocate.js b/jstests/disk/preallocate.js index f47c4915ab4..e35dda45cfe 100644 --- a/jstests/disk/preallocate.js +++ b/jstests/disk/preallocate.js @@ -4,7 +4,7 @@ port = allocatePorts( 1 )[ 0 ]; var baseName = "jstests_preallocate"; -var m = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName ); +var m = startMongod( "--port", port, "--dbpath", MongoRunner.dataPath + baseName ); var getTotalNonLocalSize = function() { var totalNonLocalDBSize = 0; @@ -35,7 +35,7 @@ assert.soon(function() { return getTotalNonLocalSize() >= expectedMB * 1024 * 10 stopMongod( port ); -var m = startMongoProgram( "mongod", "--port", port, "--dbpath", "/data/db/" + baseName ); +var m = startMongoProgram( "mongod", "--port", port, "--dbpath", MongoRunner.dataPath + baseName ); size = getTotalNonLocalSize(); diff --git a/jstests/disk/preallocate2.js b/jstests/disk/preallocate2.js index 5486fc0c6b6..b7c529078cc 100644 --- a/jstests/disk/preallocate2.js +++ b/jstests/disk/preallocate2.js @@ -4,7 +4,7 @@ port = allocatePorts( 1 )[ 0 ]; var baseName = "jstests_preallocate2"; -var m = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName ); +var m = startMongod( "--port", port, "--dbpath", MongoRunner.dataPath + baseName ); m.getDB( baseName )[ baseName ].save( {i:1} ); diff --git a/jstests/disk/preallocate_directoryperdb.js b/jstests/disk/preallocate_directoryperdb.js index fd92aaf038b..8b3d551b5d4 100644 --- a/jstests/disk/preallocate_directoryperdb.js +++ b/jstests/disk/preallocate_directoryperdb.js @@ -8,7 +8,7 @@ var baseName = "preallocate_directoryperdb" var baseName2 = "preallocate_directoryperdb2" var baseName3 = "preallocate_directoryperdb3" port = allocatePorts( 1 )[ 0 ]; -dbpath = "/data/db/" + baseDir + "/"; +dbpath = MongoRunner.dataPath + baseDir + "/"; function checkDb2DirAbsent() { files = listFiles( dbpath ); diff --git a/jstests/disk/quota.js b/jstests/disk/quota.js index f78a768369b..8d3a6dfcdee 100644 --- a/jstests/disk/quota.js +++ b/jstests/disk/quota.js @@ -3,9 +3,9 @@ port = allocatePorts( 1 )[ 0 ]; baseName = "jstests_disk_quota"; -dbpath = "/data/db/" + baseName; +dbpath = MongoRunner.dataPath + baseName; -m = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName, "--quotaFiles", "2", "--smallfiles" ); +m = startMongod( "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--quotaFiles", "2", "--smallfiles" ); db = m.getDB( baseName ); big = new Array( 10000 ).toString(); diff --git a/jstests/disk/quota2.js b/jstests/disk/quota2.js index a485ae98d27..a5f07abec8a 100644 --- a/jstests/disk/quota2.js +++ b/jstests/disk/quota2.js @@ -5,9 +5,9 @@ if ( 0 ) { // SERVER-3420 port = allocatePorts( 1 )[ 0 ]; baseName = "jstests_disk_quota2"; -dbpath = "/data/db/" + baseName; +dbpath = MongoRunner.dataPath + baseName; -m = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName, "--quotaFiles", "2", "--smallfiles" ); +m = startMongod( "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--quotaFiles", "2", "--smallfiles" ); db = m.getDB( baseName ); big = new Array( 10000 ).toString(); diff --git a/jstests/disk/quota3.js b/jstests/disk/quota3.js index 16830efca74..484231ef610 100644 --- a/jstests/disk/quota3.js +++ b/jstests/disk/quota3.js @@ -5,9 +5,9 @@ if ( 0 ) { // SERVER-3511 port = allocatePorts( 1 )[ 0 ]; baseName = "jstests_disk_quota3"; -dbpath = "/data/db/" + baseName; +dbpath = MongoRunner.dataPath + baseName; -m = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName, "--quotaFiles", "3", "--smallfiles" ); +m = startMongod( "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--quotaFiles", "3", "--smallfiles" ); db = m.getDB( baseName ); db.createCollection( baseName, {size:128*1024*1024} ); diff --git a/jstests/disk/repair.js b/jstests/disk/repair.js index 1308beb210a..f6ac67690e0 100644 --- a/jstests/disk/repair.js +++ b/jstests/disk/repair.js @@ -3,7 +3,7 @@ var baseName = "jstests_disk_repair"; port = allocatePorts( 1 )[ 0 ]; -dbpath = "/data/db/" + baseName + "/"; +dbpath = MongoRunner.dataPath + baseName + "/"; repairpath = dbpath + "repairDir/" resetDbpath( dbpath ); diff --git a/jstests/disk/repair2.js b/jstests/disk/repair2.js index a28ef79310c..000434426dd 100644 --- a/jstests/disk/repair2.js +++ b/jstests/disk/repair2.js @@ -3,7 +3,7 @@ var baseName = "jstests_disk_repair2"; port = allocatePorts( 1 )[ 0 ]; -dbpath = "/data/db/" + baseName + "/"; +dbpath = MongoRunner.dataPath + baseName + "/"; repairpath = dbpath + "repairDir/" resetDbpath( dbpath ); diff --git a/jstests/disk/repair3.js b/jstests/disk/repair3.js index 9e6767c21df..0c5748575b1 100644 --- a/jstests/disk/repair3.js +++ b/jstests/disk/repair3.js @@ -1,11 +1,11 @@ // test --repairpath on another partition var baseName = "jstests_disk_repair3"; -var repairbase = "/data/db/repairpartitiontest" +var repairbase = MongoRunner.dataDir + "/repairpartitiontest" var repairpath = repairbase + "/dir" doIt = false; -files = listFiles( "/data/db" ); +files = listFiles( MongoRunner.dataDir ); for ( i in files ) { if ( files[ i ].name == repairbase ) { doIt = true; @@ -20,7 +20,7 @@ if ( !doIt ) { if ( doIt ) { port = allocatePorts( 1 )[ 0 ]; - dbpath = "/data/db/" + baseName + "/"; + dbpath = MongoRunner.dataPath + baseName + "/"; resetDbpath( dbpath ); resetDbpath( repairpath ); diff --git a/jstests/disk/repair4.js b/jstests/disk/repair4.js index 64c0f37982a..09b1e2cdc87 100644 --- a/jstests/disk/repair4.js +++ b/jstests/disk/repair4.js @@ -1,11 +1,11 @@ // test that disk space check happens on --repairpath partition var baseName = "jstests_disk_repair4"; -var smallbase = "/data/db/repairpartitiontest" +var smallbase = MongoRunner.dataDir + "/repairpartitiontest" var smallpath = smallbase + "/dir" doIt = false; -files = listFiles( "/data/db" ); +files = listFiles( MongoRunner.dataDir ); for ( i in files ) { if ( files[ i ].name == smallbase ) { doIt = true; @@ -20,7 +20,7 @@ if ( !doIt ) { if ( doIt ) { port = allocatePorts( 1 )[ 0 ]; - repairpath = "/data/db/" + baseName + "/"; + repairpath = MongoRunner.dataPath + baseName + "/"; resetDbpath( smallpath ); resetDbpath( repairpath ); diff --git a/jstests/disk/repair5.js b/jstests/disk/repair5.js index de16b0b1a3e..b8dedb3ccf4 100644 --- a/jstests/disk/repair5.js +++ b/jstests/disk/repair5.js @@ -3,7 +3,7 @@ var baseName = "jstests_disk_repair5"; port = allocatePorts( 1 )[ 0 ]; -dbpath = "/data/db/" + baseName + "/"; +dbpath = MongoRunner.dataPath + baseName + "/"; repairpath = dbpath + "repairDir/" resetDbpath( dbpath ); diff --git a/jstests/dur/a_quick.js b/jstests/dur/a_quick.js index f703f3f35c5..cb8a2f2c57a 100755 --- a/jstests/dur/a_quick.js +++ b/jstests/dur/a_quick.js @@ -24,8 +24,8 @@ function checkNoJournalFiles(path, pass) { } // directories -var path1 = "/data/db/quicknodur"; -var path2 = "/data/db/quickdur"; +var path1 = MongoRunner.dataDir + "/quicknodur"; +var path2 = MongoRunner.dataDir + "/quickdur"; // non-durable version tst.log("start mongod without dur"); diff --git a/jstests/dur/closeall.js b/jstests/dur/closeall.js index 540ef39f5ed..3d7119ab134 100644 --- a/jstests/dur/closeall.js +++ b/jstests/dur/closeall.js @@ -2,8 +2,8 @@ // this is also a test of recoverFromYield() as that will get exercised by the update function f(variant, quickCommits, paranoid) { - var path = "/data/db/closeall"; - var path2 = "/data/db/closeall_slave"; + var path = MongoRunner.dataDir + "/closeall"; + var path2 = MongoRunner.dataDir + "/closeall_slave"; var ourdb = "closealltest"; print("closeall.js start mongod variant:" + variant + "." + quickCommits + "." + paranoid); diff --git a/jstests/dur/diskfull.js b/jstests/dur/diskfull.js index db03ad2fce5..a1efba5595d 100644 --- a/jstests/dur/diskfull.js +++ b/jstests/dur/diskfull.js @@ -1,10 +1,10 @@ /** Test running out of disk space with durability enabled */ -startPath = "/data/db/diskfulltest"; -recoverPath = "/data/db/dur_diskfull"; +startPath = MongoRunner.dataDir + "/diskfulltest"; +recoverPath = MongoRunner.dataDir + "/dur_diskfull"; doIt = false; -files = listFiles( "/data/db" ); +files = listFiles( MongoRunner.dataDir ); for ( i in files ) { if ( files[ i ].name == startPath ) { doIt = true; diff --git a/jstests/dur/dropdb.js b/jstests/dur/dropdb.js index 603755ef33b..4fb94cc7d1e 100644 --- a/jstests/dur/dropdb.js +++ b/jstests/dur/dropdb.js @@ -107,8 +107,8 @@ if (debugging) { } // directories -var path1 = "/data/db/" + testname + "nodur"; -var path2 = "/data/db/" + testname + "dur"; +var path1 = MongoRunner.dataPath + testname + "nodur"; +var path2 = MongoRunner.dataPath + testname + "dur"; // non-durable version log("mongod nodur"); diff --git a/jstests/dur/dur1.js b/jstests/dur/dur1.js index 299ac3020ed..cb4495aea52 100755 --- a/jstests/dur/dur1.js +++ b/jstests/dur/dur1.js @@ -95,8 +95,8 @@ if( debugging ) { log(); // directories -var path1 = "/data/db/" + testname+"nodur"; -var path2 = "/data/db/" + testname+"dur"; +var path1 = MongoRunner.dataPath + testname+"nodur"; +var path2 = MongoRunner.dataPath + testname+"dur"; // non-durable version log("run mongod without journaling"); diff --git a/jstests/dur/dur1_tool.js b/jstests/dur/dur1_tool.js index 5090b5b2c72..fdfe05236f4 100755 --- a/jstests/dur/dur1_tool.js +++ b/jstests/dur/dur1_tool.js @@ -95,8 +95,8 @@ if( debugging ) { log(); // directories -var path1 = "/data/db/" + testname+"nodur"; -var path2 = "/data/db/" + testname+"dur"; +var path1 = MongoRunner.dataPath + testname+"nodur"; +var path2 = MongoRunner.dataPath + testname+"dur"; // non-durable version log("run mongod without journaling"); diff --git a/jstests/dur/dur2.js b/jstests/dur/dur2.js index 042e7e1d827..25cf8b1ccb2 100644 --- a/jstests/dur/dur2.js +++ b/jstests/dur/dur2.js @@ -65,7 +65,7 @@ if( debugging ) { } // directories -var path = "/data/db/" + testname+"dur"; +var path = MongoRunner.dataPath + testname+"dur"; log("run mongod with --dur"); conn = startMongodEmpty("--port", 30001, "--dbpath", path, "--dur", "--smallfiles", "--durOptions", /*DurParanoid*/8, "--master", "--oplogSize", 64); diff --git a/jstests/dur/dur_passthrough.js b/jstests/dur/dur_passthrough.js index 994521203a5..f13d4b888bd 100644 --- a/jstests/dur/dur_passthrough.js +++ b/jstests/dur/dur_passthrough.js @@ -3,9 +3,9 @@ // //TODO(mathias) add --master or make another test -//conn = startMongodEmpty("--port", 30200, "--dbpath", "/data/db/dur_passthrough", "--dur", "--smallfiles", "--durOptions", "24"); +//conn = startMongodEmpty("--port", 30200, "--dbpath", MongoRunner.dataDir + "/dur_passthrough", "--dur", "--smallfiles", "--durOptions", "24"); -conn = startMongodEmpty("--port", 30200, "--dbpath", "/data/db/dur_passthrough", "--dur", "--nopreallocj", "--smallfiles", +conn = startMongodEmpty("--port", 30200, "--dbpath", MongoRunner.dataDir + "/dur_passthrough", "--dur", "--nopreallocj", "--smallfiles", "--durOptions", "8"); db = conn.getDB("test"); diff --git a/jstests/dur/indexbg.js b/jstests/dur/indexbg.js index e78ae4a7202..71df92a41f6 100644 --- a/jstests/dur/indexbg.js +++ b/jstests/dur/indexbg.js @@ -1,4 +1,4 @@ -path = '/data/db/indexbg_dur'; +path = MongoRunner.dataDir + '/indexbg_dur'; m = startMongodEmpty( '--port', 30001, '--dbpath', path, '--journal', '--smallfiles', '--journalOptions', 24 ); t = m.getDB( 'test' ).test; diff --git a/jstests/dur/indexbg2.js b/jstests/dur/indexbg2.js index 6a0af247b44..a7484f0a561 100644 --- a/jstests/dur/indexbg2.js +++ b/jstests/dur/indexbg2.js @@ -1,4 +1,4 @@ -path = '/data/db/indexbg2_dur'; +path = MongoRunner.dataDir + '/indexbg2_dur'; m = startMongodEmpty( '--port', 30001, '--dbpath', path, '--journal', '--smallfiles' ); diff --git a/jstests/dur/lsn.js b/jstests/dur/lsn.js index 505d8f5360c..93adf72b42e 100755 --- a/jstests/dur/lsn.js +++ b/jstests/dur/lsn.js @@ -72,33 +72,33 @@ if( debugging ) { } // directories -var path2 = "/data/db/" + testname+"dur"; +var path2 = MongoRunner.dataPath + testname+"dur"; -// run mongod with a short --syncdelay to make LSN writing sooner
+// run mongod with a short --syncdelay to make LSN writing sooner log("run mongod --dur and a short --syncdelay"); conn = startMongodEmpty("--syncdelay", 2, "--port", 30001, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", /*DurParanoid*/8, "--master", "--oplogSize", 64); -work();
-
-log("wait a while for a sync and an lsn write");
-sleep(14); // wait for lsn write
-
-log("kill mongod -9");
+work(); + +log("wait a while for a sync and an lsn write"); +sleep(14); // wait for lsn write + +log("kill mongod -9"); stopMongod(30001, /*signal*/9); -// journal file should be present, and non-empty as we killed hard
-
-// check that there is an lsn file
-{
- var files = listFiles(path2 + "/journal/");
- assert(files.some(function (f) { return f.name.indexOf("lsn") >= 0; }),
- "lsn.js FAIL no lsn file found after kill, yet one is expected");
-}
-/*assert.soon(
- function () {
- var files = listFiles(path2 + "/journal/");
- return files.some(function (f) { return f.name.indexOf("lsn") >= 0; });
- },
- "lsn.js FAIL no lsn file found after kill, yet one is expected"
+// journal file should be present, and non-empty as we killed hard + +// check that there is an lsn file +{ + var files = listFiles(path2 + "/journal/"); + assert(files.some(function (f) { return f.name.indexOf("lsn") >= 0; }), + "lsn.js FAIL no lsn file found after kill, yet one is expected"); +} +/*assert.soon( + function () { + var files = listFiles(path2 + "/journal/"); + return files.some(function (f) { return f.name.indexOf("lsn") >= 0; }); + }, + "lsn.js FAIL no lsn file found after kill, yet one is expected" );*/ // restart and recover diff --git a/jstests/dur/manyRestart.js b/jstests/dur/manyRestart.js index 79f72a43bd1..f434278ca9a 100755 --- a/jstests/dur/manyRestart.js +++ b/jstests/dur/manyRestart.js @@ -107,8 +107,8 @@ if( debugging ) { log(); // directories -var path1 = "/data/db/" + testname+"nodur"; -var path2 = "/data/db/" + testname+"dur"; +var path1 = MongoRunner.dataPath + testname+"nodur"; +var path2 = MongoRunner.dataPath + testname+"dur"; // non-durable version log("starting 30000"); diff --git a/jstests/dur/md5.js b/jstests/dur/md5.js index 107476e9704..1773091186a 100644 --- a/jstests/dur/md5.js +++ b/jstests/dur/md5.js @@ -49,7 +49,7 @@ if( debugging ) { log(); -var path = "/data/db/" + testname+"dur"; +var path = MongoRunner.dataPath + testname+"dur"; log(); conn = startMongodEmpty("--port", 30001, "--dbpath", path, "--dur", "--smallfiles", "--durOptions", 8); diff --git a/jstests/dur/oplog.js b/jstests/dur/oplog.js index 379c1b693fa..cd7d7c5e6ef 100755 --- a/jstests/dur/oplog.js +++ b/jstests/dur/oplog.js @@ -101,8 +101,8 @@ if( debugging ) { log(); // directories -var path1 = "/data/db/" + testname+"nodur"; -var path2 = "/data/db/" + testname+"dur"; +var path1 = MongoRunner.dataPath + testname+"nodur"; +var path2 = MongoRunner.dataPath + testname+"dur"; // non-durable version log(); diff --git a/jstests/libs/grid.js b/jstests/libs/grid.js index 807a745e216..3a1253d83cd 100644 --- a/jstests/libs/grid.js +++ b/jstests/libs/grid.js @@ -36,7 +36,7 @@ Server.prototype.begin = function() { Server.prototype.end = function() { print('Stopping mongod on port ' + this.args.port) stopMongod (this.args.port) - resetDbpath ('/data/db/' + this.dirname) + resetDbpath (MongoRunner.dataPath + this.dirname) } // Cut server from network so it is unreachable (but still alive) diff --git a/jstests/libs/slow_weekly_util.js b/jstests/libs/slow_weekly_util.js index c09a1d2811e..1e2c7391cb1 100644 --- a/jstests/libs/slow_weekly_util.js +++ b/jstests/libs/slow_weekly_util.js @@ -5,7 +5,7 @@ SlowWeeklyMongod = function( name ) { this.start = new Date(); - this.conn = startMongodEmpty("--port", this.port, "--dbpath", "/data/db/" + this.name , "--smallfiles", "--nojournal" ); + this.conn = startMongodEmpty("--port", this.port, "--dbpath", MongoRunner.dataPath + this.name , "--smallfiles", "--nojournal" ); }; SlowWeeklyMongod.prototype.getDB = function( name ) { diff --git a/jstests/replsets/auth1.js b/jstests/replsets/auth1.js index 03d156031e1..513a31b5880 100644 --- a/jstests/replsets/auth1.js +++ b/jstests/replsets/auth1.js @@ -8,7 +8,7 @@ var path = "jstests/libs/"; print("try starting mongod with auth"); -var m = MongoRunner.runMongod({auth : "", port : port[4], dbpath : "/data/db/wrong-auth"}); +var m = MongoRunner.runMongod({auth : "", port : port[4], dbpath : MongoRunner.dataDir + "/wrong-auth"}); assert.eq(m.getDB("local").auth("__system", ""), 0); @@ -21,7 +21,7 @@ run("chmod", "644", path+"key2"); print("try starting mongod"); -m = runMongoProgram( "mongod", "--keyFile", path+"key1", "--port", port[0], "--dbpath", "/data/db/" + name); +m = runMongoProgram( "mongod", "--keyFile", path+"key1", "--port", port[0], "--dbpath", MongoRunner.dataPath + name); print("should fail with wrong permissions"); @@ -158,7 +158,7 @@ master.runCommand({getlasterror:1, w:3, wtimeout:60000}); print("add member with wrong key"); -var conn = new MongodRunner(port[3], "/data/db/"+name+"-3", null, null, ["--replSet","rs_auth1","--rest","--oplogSize","2", "--keyFile", path+"key2"], {no_bind : true}); +var conn = new MongodRunner(port[3], MongoRunner.dataPath+name+"-3", null, null, ["--replSet","rs_auth1","--rest","--oplogSize","2", "--keyFile", path+"key2"], {no_bind : true}); conn.start(); @@ -191,7 +191,7 @@ stopMongod(port[3]); print("start back up with correct key"); -conn = new MongodRunner(port[3], "/data/db/"+name+"-3", null, null, ["--replSet","rs_auth1","--rest","--oplogSize","2", "--keyFile", path+"key1"], {no_bind : true}); +conn = new MongodRunner(port[3], MongoRunner.dataPath+name+"-3", null, null, ["--replSet","rs_auth1","--rest","--oplogSize","2", "--keyFile", path+"key1"], {no_bind : true}); conn.start(); wait(function() { diff --git a/jstests/replsets/fastsync.js b/jstests/replsets/fastsync.js index 06da6a8d82b..9ae04187f37 100644 --- a/jstests/replsets/fastsync.js +++ b/jstests/replsets/fastsync.js @@ -36,7 +36,7 @@ var reconnect = function(a) { ports = allocatePorts( 4 ); var basename = "jstests_fastsync"; -var basePath = "/data/db/" + basename; +var basePath = MongoRunner.dataPath + basename; var hostname = getHostName(); var pargs = new MongodRunner( ports[ 0 ], basePath + "-p", false, false, diff --git a/jstests/replsets/get_last_error.js b/jstests/replsets/get_last_error.js index 4157549cdf4..318e3143756 100644 --- a/jstests/replsets/get_last_error.js +++ b/jstests/replsets/get_last_error.js @@ -75,7 +75,7 @@ replTest.stopSet(); // Need to start a single server manually to keep this test in the jstests/replsets test suite var port = allocatePorts(1)[0]; var baseName = "SERVER-9005"; -var mongod = startMongod("--port", port, "--dbpath", "/data/db/" + baseName); +var mongod = startMongod("--port", port, "--dbpath", MongoRunner.dataPath + baseName); var sdb = new Mongo("localhost:"+port).getDB("test"); sdb.foo.drop(); diff --git a/jstests/replsets/initial_sync1.js b/jstests/replsets/initial_sync1.js index fe04aeefe5a..1728f48573d 100644 --- a/jstests/replsets/initial_sync1.js +++ b/jstests/replsets/initial_sync1.js @@ -51,7 +51,7 @@ admin_s1.runCommand({replSetFreeze:999999}); print("6. Bring up #3"); var ports = allocatePorts( 3 ); -var basePath = "/data/db/" + basename; +var basePath = MongoRunner.dataPath + basename; var hostname = getHostName(); var slave2 = startMongodTest (ports[2], basename, false, {replSet : basename, oplogSize : 2} ) diff --git a/jstests/replsets/initial_sync2.js b/jstests/replsets/initial_sync2.js index cc5237a7fb3..3c510baec60 100644 --- a/jstests/replsets/initial_sync2.js +++ b/jstests/replsets/initial_sync2.js @@ -51,7 +51,7 @@ admin_s1.runCommand({replSetFreeze:999999}); print("6. Bring up #3"); var ports = allocatePorts( 3 ); -var basePath = "/data/db/" + basename; +var basePath = MongoRunner.dataPath + basename; var hostname = getHostName(); var slave2 = startMongodTest (ports[2], basename, false, {replSet : basename, oplogSize : 2} ) diff --git a/jstests/replsets/initial_sync4.js b/jstests/replsets/initial_sync4.js index 4637e2a428c..0b556fe0dfd 100644 --- a/jstests/replsets/initial_sync4.js +++ b/jstests/replsets/initial_sync4.js @@ -25,7 +25,7 @@ replTest.awaitReplication(); print("4. Bring up a new node"); ports = allocatePorts( 3 ); -basePath = "/data/db/" + basename; +basePath = MongoRunner.dataPath + basename; hostname = getHostName(); s = startMongodTest (ports[2], basename, false, {replSet : basename, oplogSize : 2} ); diff --git a/jstests/replsets/rollback5.js b/jstests/replsets/rollback5.js index a299cc90628..a5dcd0f55f7 100644 --- a/jstests/replsets/rollback5.js +++ b/jstests/replsets/rollback5.js @@ -23,8 +23,8 @@ var A = a_conn.getDB("test"); var B = b_conn.getDB("test"); var AID = replTest.getNodeId(a_conn); var BID = replTest.getNodeId(b_conn); -var Apath = "/data/db/rollback5-0/"; -var Bpath = "/data/db/rollback5-1/"; +var Apath = MongoRunner.dataDir + "/rollback5-0/"; +var Bpath = MongoRunner.dataDir + "/rollback5-1/"; assert(master == conns[0], "conns[0] assumed to be master"); assert(a_conn.host == master.host); diff --git a/jstests/replsets/single_server_majority.js b/jstests/replsets/single_server_majority.js index d3417398547..b329bb126af 100644 --- a/jstests/replsets/single_server_majority.js +++ b/jstests/replsets/single_server_majority.js @@ -3,7 +3,7 @@ // set up a mongod and connect a mongo port = allocatePorts(1)[0]; var baseName = "single_server_majority"; -var mongod = startMongod("--port", port, "--dbpath", "/data/db/" + baseName); +var mongod = startMongod("--port", port, "--dbpath", MongoRunner.dataPath + baseName); var mongo = startMongoProgram("mongo", "--port", port); // get db and collection, then preform a trivial insert diff --git a/jstests/sharding/sync6.js b/jstests/sharding/sync6.js index 8520fdfc11a..21911ff3117 100644 --- a/jstests/sharding/sync6.js +++ b/jstests/sharding/sync6.js @@ -12,7 +12,7 @@ test = new SyncCCTest( "sync6", { logpath : bitbucket , logappend : "" } ) // Startup another process to handle our commands to the cluster, mostly so it's // easier to read. var commandConn = startMongodTest( 30000 + 4, "syncCommander", false, {})//{ logpath : bitbucket } )//{verbose : ""} ) -// { logpath : "/data/db/syncCommander/mongod.log" } ); +// { logpath : MongoRunner.dataDir + "/syncCommander/mongod.log" } ); // Up the log level for this test commandConn.getDB( "admin" ).runCommand( { setParameter : 1, logLevel : 1 } ) diff --git a/jstests/slowNightly/clonecollection.js b/jstests/slowNightly/clonecollection.js index cb413ffb5ff..c1f11652ce3 100644 --- a/jstests/slowNightly/clonecollection.js +++ b/jstests/slowNightly/clonecollection.js @@ -6,8 +6,8 @@ var baseName = "jstests_clonecollection"; ports = allocatePorts( 2 ); -f = startMongod( "--port", ports[ 0 ], "--dbpath", "/data/db/" + baseName + "_from", "--nohttpinterface", "--bind_ip", "127.0.0.1" ).getDB( baseName ); -t = startMongod( "--port", ports[ 1 ], "--dbpath", "/data/db/" + baseName + "_to", "--nohttpinterface", "--bind_ip", "127.0.0.1" ).getDB( baseName ); +f = startMongod( "--port", ports[ 0 ], "--dbpath", MongoRunner.dataPath + baseName + "_from", "--nohttpinterface", "--bind_ip", "127.0.0.1" ).getDB( baseName ); +t = startMongod( "--port", ports[ 1 ], "--dbpath", MongoRunner.dataPath + baseName + "_to", "--nohttpinterface", "--bind_ip", "127.0.0.1" ).getDB( baseName ); for( i = 0; i < 1000; ++i ) { f.a.save( { i: i } ); diff --git a/jstests/slowNightly/command_line_parsing.js b/jstests/slowNightly/command_line_parsing.js index dd506c8344b..f145de2d9df 100644 --- a/jstests/slowNightly/command_line_parsing.js +++ b/jstests/slowNightly/command_line_parsing.js @@ -4,17 +4,17 @@ port = allocatePorts( 1 )[ 0 ]; var baseName = "jstests_slowNightly_command_line_parsing"; // test notablescan -var m = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName, "--notablescan" ); +var m = startMongod( "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--notablescan" ); m.getDB( baseName ).getCollection( baseName ).save( {a:1} ); assert.throws( function() { m.getDB( baseName ).getCollection( baseName ).find( {a:1} ).toArray() } ); // test config file -var m2 = startMongod( "--port", port+2, "--dbpath", "/data/db/" + baseName +"2", "--config", "jstests/libs/testconfig"); +var m2 = startMongod( "--port", port+2, "--dbpath", MongoRunner.dataPath + baseName +"2", "--config", "jstests/libs/testconfig"); var m2expected = { "parsed" : { "config" : "jstests/libs/testconfig", - "dbpath" : "/data/db/jstests_slowNightly_command_line_parsing2", + "dbpath" : MongoRunner.dataDir + "/jstests_slowNightly_command_line_parsing2", "fastsync" : true, "port" : 31002, } @@ -26,13 +26,13 @@ delete m2result.parsed.setParameter assert.docEq( m2expected.parsed, m2result.parsed ); // test JSON config file -var m3 = startMongod("--port", port+4, "--dbpath", "/data/db/" + baseName +"4", +var m3 = startMongod("--port", port+4, "--dbpath", MongoRunner.dataPath + baseName +"4", "--config", "jstests/libs/testconfig"); var m3expected = { "parsed" : { "config" : "jstests/libs/testconfig", - "dbpath" : "/data/db/jstests_slowNightly_command_line_parsing4", + "dbpath" : MongoRunner.dataDir + "/jstests_slowNightly_command_line_parsing4", "fastsync" : true, "port" : 31004, } diff --git a/jstests/slowNightly/dur_big_atomic_update.js b/jstests/slowNightly/dur_big_atomic_update.js index 457dbca9a27..18a7c4a68f2 100644 --- a/jstests/slowNightly/dur_big_atomic_update.js +++ b/jstests/slowNightly/dur_big_atomic_update.js @@ -2,7 +2,7 @@ // // this tests writing 1GB in an atomic update to make sure we commit periodically -var path = "/data/db/dur_big_atomic_update"; +var path = MongoRunner.dataDir + "/dur_big_atomic_update"; conn = startMongodEmpty("--port", 30001, "--dbpath", path, "--dur", "--durOptions", 8); d = conn.getDB("test"); diff --git a/jstests/slowNightly/dur_remove_old_journals.js b/jstests/slowNightly/dur_remove_old_journals.js index 1e81bee56ea..59350e3e720 100644 --- a/jstests/slowNightly/dur_remove_old_journals.js +++ b/jstests/slowNightly/dur_remove_old_journals.js @@ -3,7 +3,7 @@ // tunables STRING_SIZE = 1024*1024; NUM_TO_INSERT = 2.5*1024; -PATH = "/data/db/dur_remove_old_journals"; +PATH = MongoRunner.dataDir + "/dur_remove_old_journals"; SYNC_DELAY = 5; // must be a number conn = startMongodEmpty("--port", 30001, "--dbpath", PATH, "--dur", "--smallfiles", "--syncdelay", ''+SYNC_DELAY); diff --git a/jstests/slowNightly/getmore_performance.js b/jstests/slowNightly/getmore_performance.js index caada32027f..b0138213c19 100644 --- a/jstests/slowNightly/getmore_performance.js +++ b/jstests/slowNightly/getmore_performance.js @@ -33,7 +33,7 @@ var doTest = function() { // Create the test collection // var baseName = 'getmore_performance'; - var dbpath = '/data/db/sconsTests/' + baseName + var dbpath = MongoRunner.dataDir + '/sconsTests/' + baseName var port = allocatePorts( 1 )[ 0 ]; var mongod = startMongod( '--port', port, '--dbpath', dbpath ); sleep(50); diff --git a/jstests/slowNightly/index_retry.js b/jstests/slowNightly/index_retry.js index 406b711df35..d0465476144 100644 --- a/jstests/slowNightly/index_retry.js +++ b/jstests/slowNightly/index_retry.js @@ -1,7 +1,7 @@ // Check index rebuild when MongoDB is killed var ports = allocatePorts(1); -mongod = new MongodRunner(ports[0], "/data/db/index_retry", null, null, ["--journal"]); +mongod = new MongodRunner(ports[0], MongoRunner.dataDir + "/index_retry", null, null, ["--journal"]); var conn = mongod.start(); var test = conn.getDB("test"); diff --git a/jstests/slowNightly/ipv6_connection_string_validation.js b/jstests/slowNightly/ipv6_connection_string_validation.js index 597bc1809dd..7c6a9ebdbde 100644 --- a/jstests/slowNightly/ipv6_connection_string_validation.js +++ b/jstests/slowNightly/ipv6_connection_string_validation.js @@ -11,7 +11,7 @@ if ("undefined" == typeof inner_mode) { port = allocatePorts( 1 )[ 0 ]; var baseName = "jstests_slowNightly_ipv6_connection_string_validation"; jsTest.log("Outer mode test starting mongod with --ipv6"); - var mongod = startMongod( "--port", port, "--ipv6", "--dbpath", "/data/db/" + baseName ); + var mongod = startMongod( "--port", port, "--ipv6", "--dbpath", MongoRunner.dataPath + baseName ); var args = [ "mongo", "--nodb", "--ipv6", "--eval", "inner_mode=true;port=" + port + ";", "jstests/slowNightly/ipv6_connection_string_validation.js" ]; diff --git a/jstests/slowNightly/logpath.js b/jstests/slowNightly/logpath.js index 9044aa58d3d..78be510f0a2 100644 --- a/jstests/slowNightly/logpath.js +++ b/jstests/slowNightly/logpath.js @@ -3,8 +3,8 @@ var name = "logpath"; var token = "logpath_token"; -var dbdir = "/data/db/" + name + "/"; // this will work under windows as well as linux -var basedir = "/data/db/" + name + "files" + "/"; +var dbdir = MongoRunner.dataPath + name + "/"; // this will work under windows as well as linux +var basedir = MongoRunner.dataPath + name + "files" + "/"; var logdir = basedir + "logdir/"; var testdir = basedir + "testdir/" var sfile = _isWindows() ? "NUL" : "/dev/null"; diff --git a/jstests/slowNightly/newcollection2.js b/jstests/slowNightly/newcollection2.js index 6bf24952c36..0a2b5148260 100644 --- a/jstests/slowNightly/newcollection2.js +++ b/jstests/slowNightly/newcollection2.js @@ -2,7 +2,7 @@ port = allocatePorts( 1 )[ 0 ] var baseName = "jstests_disk_newcollection2"; -var m = startMongod( "--noprealloc", "--smallfiles", "--port", port, "--dbpath", "/data/db/" + baseName ); +var m = startMongod( "--noprealloc", "--smallfiles", "--port", port, "--dbpath", MongoRunner.dataPath + baseName ); db = m.getDB( "test" ); db.createCollection( baseName, {size:0x1FFC0000-0x10-8192} ); diff --git a/jstests/slowNightly/sharding_migrateBigObject.js b/jstests/slowNightly/sharding_migrateBigObject.js index 9d45e35c253..414b6d57925 100644 --- a/jstests/slowNightly/sharding_migrateBigObject.js +++ b/jstests/slowNightly/sharding_migrateBigObject.js @@ -1,7 +1,7 @@ -var shardA = startMongodEmpty("--shardsvr", "--port", 30001, "--dbpath", "/data/db/migrateBigger0", "--nopreallocj"); -var shardB = startMongodEmpty("--shardsvr", "--port", 30002, "--dbpath", "/data/db/migrateBigger1", "--nopreallocj"); -var config = startMongodEmpty("--configsvr", "--port", 29999, "--dbpath", "/data/db/migrateBiggerC", "--nopreallocj"); +var shardA = startMongodEmpty("--shardsvr", "--port", 30001, "--dbpath", MongoRunner.dataDir + "/migrateBigger0", "--nopreallocj"); +var shardB = startMongodEmpty("--shardsvr", "--port", 30002, "--dbpath", MongoRunner.dataDir + "/migrateBigger1", "--nopreallocj"); +var config = startMongodEmpty("--configsvr", "--port", 29999, "--dbpath", MongoRunner.dataDir + "/migrateBiggerC", "--nopreallocj"); var mongos = startMongos({ port : 30000, configdb : "localhost:29999" }) diff --git a/jstests/slowNightly/sharding_rs_arb1.js b/jstests/slowNightly/sharding_rs_arb1.js index fba9f45f848..0e51180b44d 100644 --- a/jstests/slowNightly/sharding_rs_arb1.js +++ b/jstests/slowNightly/sharding_rs_arb1.js @@ -17,7 +17,7 @@ master = replTest.getMaster(); db = master.getDB( "test" ); printjson( rs.status() ); -var config = startMongodEmpty("--configsvr", "--port", 29999, "--dbpath", "/data/db/" + name + "_config" ); +var config = startMongodEmpty("--configsvr", "--port", 29999, "--dbpath", MongoRunner.dataPath + name + "_config" ); var mongos = startMongos({ port : 30000, configdb : getHostName() + ":29999" }) var admin = mongos.getDB("admin") diff --git a/jstests/slowNightly/sync6_slow.js b/jstests/slowNightly/sync6_slow.js index 6f5fdbca96c..fce886a429f 100644 --- a/jstests/slowNightly/sync6_slow.js +++ b/jstests/slowNightly/sync6_slow.js @@ -11,7 +11,7 @@ test = new SyncCCTest("sync6", {logpath: bitbucket, logappend: ""}); // Startup another process to handle our commands to the cluster, mostly so it's // easier to read. var commandConn = startMongodTest( 30000 + 4, "syncCommander", false, {}); //{ logpath : bitbucket } )//{verbose : ""} ) -// { logpath : "/data/db/syncCommander/mongod.log" } ); +// { logpath : MongoRunner.dataDir + "/syncCommander/mongod.log" } ); if ( !_isWindows() ) { //SERVER-7411 // Up the log level for this test diff --git a/jstests/slowNightly/temp_namespace.js b/jstests/slowNightly/temp_namespace.js index 54ee3bfa4f2..8d3133f1e43 100644 --- a/jstests/slowNightly/temp_namespace.js +++ b/jstests/slowNightly/temp_namespace.js @@ -1,7 +1,7 @@ // this is to make sure that temp collections get cleaned up on restart testname = 'temp_namespace_sw' -path = '/data/db/'+testname +path = MongoRunner.dataPath+testname conn = startMongodEmpty("--port", 30000, "--dbpath", path, "--smallfiles", "--noprealloc", "--nopreallocj"); d = conn.getDB('test') diff --git a/jstests/slowNightly/ttl_repl_maintenance.js b/jstests/slowNightly/ttl_repl_maintenance.js index 97507ea0f19..6b1c38ccf9f 100644 --- a/jstests/slowNightly/ttl_repl_maintenance.js +++ b/jstests/slowNightly/ttl_repl_maintenance.js @@ -10,7 +10,7 @@ var conn; var primeSystemReplset = function() { var port = allocatePorts(1)[0]; - runner = new MongodRunner(port, "/data/db/jstests_slowNightly-ttl"); + runner = new MongodRunner(port, MongoRunner.dataDir + "/jstests_slowNightly-ttl"); conn = runner.start(); var localDB = conn.getDB("local"); localDB.system.replset.insert({x:1}); diff --git a/jstests/slowNightly/unix_socket1.js b/jstests/slowNightly/unix_socket1.js index e651659f888..2ab6ed3c53c 100644 --- a/jstests/slowNightly/unix_socket1.js +++ b/jstests/slowNightly/unix_socket1.js @@ -13,7 +13,7 @@ if ( ! _isWindows() ) { // test unix socket path var ports = allocatePorts(1); - var path = "/data/db/sockpath"; + var path = MongoRunner.dataDir + "/sockpath"; var conn = new MongodRunner(ports[0], path, null, null, ["--unixSocketPrefix", path]); conn.start(); diff --git a/jstests/ssl/ssl_cert_password.js b/jstests/ssl/ssl_cert_password.js index 5ea2b863537..5b3376db53f 100644 --- a/jstests/ssl/ssl_cert_password.js +++ b/jstests/ssl/ssl_cert_password.js @@ -4,8 +4,8 @@ // does not return error statuses to indicate an error. port = allocatePorts( 1 )[ 0 ]; var baseName = "jstests_ssl_ssl_cert_password"; -var dbpath = "/data/db/" + baseName; -var external_scratch_dir = "/data/db/" + baseName + "/external/"; +var dbpath = MongoRunner.dataPath + baseName; +var external_scratch_dir = MongoRunner.dataPath + baseName + "/external/"; resetDbpath(dbpath); mkdir(external_scratch_dir); diff --git a/jstests/ssl/ssl_crl.js b/jstests/ssl/ssl_crl.js index a536aba818f..75a5e0e6c4c 100644 --- a/jstests/ssl/ssl_crl.js +++ b/jstests/ssl/ssl_crl.js @@ -11,7 +11,7 @@ var baseName = "jstests_ssl_ssl_crl"; var md = startMongod("--port", port1, "--dbpath", - "/data/db/" + baseName + "1", + MongoRunner.dataPath + baseName + "1", "--sslMode", "sslOnly", "--sslPEMKeyFile", "jstests/libs/server.pem", "--sslCAFile", "jstests/libs/ca.pem", @@ -27,7 +27,7 @@ assert(mongo==0); port2 = ports[1]; // This test ensures clients cannot connect if the CRL is expired. -md = startMongod("--port", port2, "--dbpath", "/data/db/" + baseName + "2", +md = startMongod("--port", port2, "--dbpath", MongoRunner.dataPath + baseName + "2", "--sslMode", "sslOnly", "--sslPEMKeyFile", "jstests/libs/server.pem", "--sslCAFile", "jstests/libs/ca.pem", diff --git a/jstests/ssl/ssl_crl_revoked.js b/jstests/ssl/ssl_crl_revoked.js index 5c8c448c5a2..190624d26e1 100644 --- a/jstests/ssl/ssl_crl_revoked.js +++ b/jstests/ssl/ssl_crl_revoked.js @@ -6,7 +6,7 @@ port = allocatePorts( 1 )[ 0 ]; var baseName = "jstests_ssl_ssl_crl_revoked"; -var md = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName, +var md = startMongod( "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--sslMode","sslOnly", "--sslPEMKeyFile", "jstests/libs/server.pem", "--sslCAFile", "jstests/libs/ca.pem", diff --git a/jstests/ssl/ssl_fips.js b/jstests/ssl/ssl_fips.js index 76118a7183d..0ac12604311 100644 --- a/jstests/ssl/ssl_fips.js +++ b/jstests/ssl/ssl_fips.js @@ -6,7 +6,7 @@ var baseName = "jstests_ssl_ssl_fips"; var md = startMongod("--port", port1, "--dbpath", - "/data/db/" + baseName, "--sslOnNormalPorts", + MongoRunner.dataPath + baseName, "--sslOnNormalPorts", "--sslPEMKeyFile", "jstests/libs/server.pem", "--sslFIPSMode"); diff --git a/jstests/ssl/ssl_weak.js b/jstests/ssl/ssl_weak.js index 26fb762958c..1e45b3d201f 100644 --- a/jstests/ssl/ssl_weak.js +++ b/jstests/ssl/ssl_weak.js @@ -8,7 +8,7 @@ var baseName = "jstests_ssl_ssl_weak"; // Test that connecting with no client certificate and --sslWeakCertificateValidation connects // successfully. -var md = startMongod( "--port", ports[0], "--dbpath", "/data/db/" + baseName + "1", +var md = startMongod( "--port", ports[0], "--dbpath", MongoRunner.dataPath + baseName + "1", "--sslMode", "sslOnly", "--sslPEMKeyFile", "jstests/libs/server.pem", "--sslCAFile", "jstests/libs/ca.pem", @@ -32,7 +32,7 @@ assert(mongo==0); // Test that connecting with no client certificate and no --sslWeakCertificateValidation fails to // connect. -var md2 = startMongod( "--port", ports[1], "--dbpath", "/data/db/" + baseName + "2", +var md2 = startMongod( "--port", ports[1], "--dbpath", MongoRunner.dataPath + baseName + "2", "--sslMode", "sslOnly", "--sslPEMKeyFile", "jstests/libs/server.pem", "--sslCAFile", "jstests/libs/ca.pem"); diff --git a/jstests/tool/dumpauth.js b/jstests/tool/dumpauth.js index dfb9f8fcc90..c5767015815 100644 --- a/jstests/tool/dumpauth.js +++ b/jstests/tool/dumpauth.js @@ -3,7 +3,7 @@ port = allocatePorts( 1 )[ 0 ]; baseName = "tool_dumpauth"; -m = startMongod( "--auth", "--port", port, "--dbpath", "/data/db/" + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" ); +m = startMongod( "--auth", "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" ); db = m.getDB( "admin" ); t = db[ baseName ]; diff --git a/jstests/tool/dumprestore10.js b/jstests/tool/dumprestore10.js index 4a6b6b4439e..72eff8ed154 100644 --- a/jstests/tool/dumprestore10.js +++ b/jstests/tool/dumprestore10.js @@ -31,7 +31,7 @@ var total = 1000; step("mongodump from replset"); -var data = "/data/db/dumprestore10-dump1/"; +var data = MongoRunner.dataDir + "/dumprestore10-dump1/"; runMongoProgram( "mongodump", "--host", "127.0.0.1:"+replTest.ports[0], "--out", data ); diff --git a/jstests/tool/dumprestore3.js b/jstests/tool/dumprestore3.js index 32e5f351c45..96758219a2a 100644 --- a/jstests/tool/dumprestore3.js +++ b/jstests/tool/dumprestore3.js @@ -39,7 +39,7 @@ var master = replTest.getMaster(); step("try mongorestore to slave"); -var data = "/data/db/dumprestore3-other1/"; +var data = MongoRunner.dataDir + "/dumprestore3-other1/"; resetDbpath(data); runMongoProgram( "mongodump", "--host", "127.0.0.1:"+port, "--out", data ); @@ -48,7 +48,7 @@ assert.eq(x, _isWindows() ? -1 : 255, "mongorestore should exit w/ -1 on slave") step("try mongoimport to slave"); -dataFile = "/data/db/dumprestore3-other2.json"; +dataFile = MongoRunner.dataDir + "/dumprestore3-other2.json"; runMongoProgram( "mongoexport", "--host", "127.0.0.1:"+port, "--out", dataFile, "--db", "foo", "--collection", "bar" ); x = runMongoProgram( "mongoimport", "--host", "127.0.0.1:"+replTest.ports[1], "--file", dataFile ); diff --git a/jstests/tool/dumprestore7.js b/jstests/tool/dumprestore7.js index a860b91f415..e80db4c7d34 100644 --- a/jstests/tool/dumprestore7.js +++ b/jstests/tool/dumprestore7.js @@ -42,7 +42,7 @@ var master = replTest.getMaster(); step("try mongodump with $timestamp"); -var data = "/data/db/dumprestore7-dump1/"; +var data = MongoRunner.dataDir + "/dumprestore7-dump1/"; var query = "{\"ts\":{\"$gt\":{\"$timestamp\" : {\"t\":"+ time.ts.t + ",\"i\":" + time.ts.i +" }}}}"; runMongoProgram( "mongodump", "--host", "127.0.0.1:"+replTest.ports[0], "--db", "local", "--collection", "oplog.rs", "--query", query, "--out", data ); diff --git a/jstests/tool/dumprestore9.js b/jstests/tool/dumprestore9.js index a4a98e8e430..4bbb2fc18b1 100644 --- a/jstests/tool/dumprestore9.js +++ b/jstests/tool/dumprestore9.js @@ -36,7 +36,7 @@ assert.eq(numDocs, coll.count(), "Documents weren't inserted correctly"); step("dump cluster"); -dumpdir = "/data/db/dumprestore9-dump1/"; +dumpdir = MongoRunner.dataDir + "/dumprestore9-dump1/"; resetDbpath(dumpdir); runMongoProgram( "mongodump", "--host", s._mongos[0].host, "--out", dumpdir ); diff --git a/jstests/tool/dumpsecondary.js b/jstests/tool/dumpsecondary.js index 3d80d340935..00f166dcf4c 100644 --- a/jstests/tool/dumpsecondary.js +++ b/jstests/tool/dumpsecondary.js @@ -15,7 +15,7 @@ var slaves = replTest.liveNodes.slaves; assert( slaves.length == 1, "Expected 1 slave but length was " + slaves.length ); slave = slaves[0]; -var args = ['mongodump', '-h', slave.host, '--out', '/data/db/jstests_tool_dumpsecondary_external/']; +var args = ['mongodump', '-h', slave.host, '--out', MongoRunner.dataDir + '/jstests_tool_dumpsecondary_external/']; var authargs = ['--username', jsTest.options().authUser, '--password', jsTest.options().authPassword]; if (jsTest.options().keyFile) { args = args.concat(authargs); @@ -24,7 +24,7 @@ runMongoProgram.apply(null, args); db.foo.drop() assert.eq( 0 , db.foo.count() , "after drop" ); -args = ['mongorestore', '-h', master.host, '/data/db/jstests_tool_dumpsecondary_external/']; +args = ['mongorestore', '-h', master.host, MongoRunner.dataDir + '/jstests_tool_dumpsecondary_external/']; if (jsTest.options().keyFile) { args = args.concat(authargs); } @@ -33,6 +33,6 @@ assert.soon( "db.foo.findOne()" , "no data after sleep" ); assert.eq( 1 , db.foo.count() , "after restore" ); assert.eq( 1000 , db.foo.findOne().a , "after restore 2" ); -resetDbpath('/data/db/jstests_tool_dumpsecondary_external') +resetDbpath(MongoRunner.dataDir + '/jstests_tool_dumpsecondary_external') replTest.stopSet(15) diff --git a/jstests/tool/restorewithauth.js b/jstests/tool/restorewithauth.js index 76d721eefd8..9c7ca96d427 100644 --- a/jstests/tool/restorewithauth.js +++ b/jstests/tool/restorewithauth.js @@ -16,7 +16,7 @@ var port = allocatePorts(1)[0]; baseName = "jstests_restorewithauth"; -var conn = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName, "--nohttpinterface", +var conn = startMongod( "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--nohttpinterface", "--nojournal", "--bind_ip", "127.0.0.1" ); // write to ns foo.bar @@ -36,7 +36,7 @@ foo.bar.createIndex({x:1}); assert.eq(foo.system.indexes.count(), 3); // get data dump -var dumpdir = "/data/db/restorewithauth-dump1/"; +var dumpdir = MongoRunner.dataDir + "/restorewithauth-dump1/"; resetDbpath( dumpdir ); x = runMongoProgram("mongodump", "--db", "foo", "-h", "127.0.0.1:"+port, "--out", dumpdir); @@ -47,7 +47,7 @@ foo.dropDatabase(); stopMongod( port ); // start mongod with --auth -conn = startMongod( "--auth", "--port", port, "--dbpath", "/data/db/" + baseName, "--nohttpinterface", +conn = startMongod( "--auth", "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--nohttpinterface", "--nojournal", "--bind_ip", "127.0.0.1" ); // admin user diff --git a/jstests/tool/stat1.js b/jstests/tool/stat1.js index 289a1a865af..0f894d7e4a9 100644 --- a/jstests/tool/stat1.js +++ b/jstests/tool/stat1.js @@ -3,7 +3,7 @@ port = allocatePorts( 1 )[ 0 ]; baseName = "tool_stat1"; -m = startMongod( "--auth", "--port", port, "--dbpath", "/data/db/" + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" ); +m = startMongod( "--auth", "--port", port, "--dbpath", MongoRunner.dataPath + baseName, "--nohttpinterface", "--bind_ip", "127.0.0.1" ); db = m.getDB( "admin" ); t = db[ baseName ]; diff --git a/jstests/tool/tool1.js b/jstests/tool/tool1.js index ebe82932832..82a5963a8e7 100644 --- a/jstests/tool/tool1.js +++ b/jstests/tool/tool1.js @@ -1,8 +1,8 @@ // mongo tool tests, very basic to start with baseName = "jstests_tool_tool1"; -dbPath = "/data/db/" + baseName + "/"; -externalPath = "/data/db/" + baseName + "_external/"; +dbPath = MongoRunner.dataPath + baseName + "/"; +externalPath = MongoRunner.dataPath + baseName + "_external/"; externalFile = externalPath + "export.json"; function fileSize(){ diff --git a/jstests/tool/tool_replset.js b/jstests/tool/tool_replset.js index ecdb57a8aa8..b38dcb95806 100644 --- a/jstests/tool/tool_replset.js +++ b/jstests/tool/tool_replset.js @@ -33,7 +33,7 @@ var replSetConnString = "tool_replset/127.0.0.1:" + replTest.ports[0] + // Test with mongodump/mongorestore print("dump the db"); -var data = "/data/db/tool_replset-dump1/"; +var data = MongoRunner.dataDir + "/tool_replset-dump1/"; runMongoProgram("mongodump", "--host", replSetConnString, "--out", data); print("db successfully dumped, dropping now"); @@ -51,7 +51,7 @@ replTest.awaitReplication(); // Test with mongoexport/mongoimport print("export the collection"); -var extFile = "/data/db/tool_replset/export"; +var extFile = MongoRunner.dataDir + "/tool_replset/export"; runMongoProgram("mongoexport", "--host", replSetConnString, "--out", extFile, "-d", "foo", "-c", "bar"); diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js index 209e1b42bdb..37da64c27c4 100644 --- a/src/mongo/shell/replsettest.js +++ b/src/mongo/shell/replsettest.js @@ -159,7 +159,7 @@ ReplSetTest.prototype.getPath = function( n ){ if( n.host ) n = this.getNodeId( n ) - var p = "/data/db/" + this.name + "-"+n; + var p = MongoRunner.dataPath + this.name + "-"+n; if ( ! this._alldbpaths ) this._alldbpaths = [ p ]; else diff --git a/src/mongo/shell/servers.js b/src/mongo/shell/servers.js index ab070226746..45c81578cdd 100755 --- a/src/mongo/shell/servers.js +++ b/src/mongo/shell/servers.js @@ -699,7 +699,7 @@ startMongodTest = function (port, dirname, restart, extraOptions ) { var options = { port: port, - dbpath: "/data/db/" + dirname, + dbpath: MongoRunner.dataPath + dirname, noprealloc: "", smallfiles: "", oplogSize: "40", diff --git a/src/mongo/shell/servers_misc.js b/src/mongo/shell/servers_misc.js index 60dd2cb3763..5a09856896a 100644 --- a/src/mongo/shell/servers_misc.js +++ b/src/mongo/shell/servers_misc.js @@ -60,7 +60,7 @@ ToolTest = function( name, extraOptions ){ this.options = extraOptions; this.port = allocatePorts(1)[0]; this.baseName = "jstests_tool_" + name; - this.root = "/data/db/" + this.baseName; + this.root = MongoRunner.dataPath + this.baseName; this.dbpath = this.root + "/"; this.ext = this.root + "_external/"; this.extFile = this.root + "_external/a"; @@ -129,7 +129,7 @@ ReplTest.prototype.getPort = function( master ){ } ReplTest.prototype.getPath = function( master ){ - var p = "/data/db/" + this.name + "-"; + var p = MongoRunner.dataPath + this.name + "-"; if ( master ) p += "master"; else diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js index bfbb44fdcb2..3895689f24a 100644 --- a/src/mongo/shell/shardingtest.js +++ b/src/mongo/shell/shardingtest.js @@ -541,7 +541,7 @@ ShardingTest.prototype.stop = function(){ } if ( this._alldbpaths ){ for( i=0; i<this._alldbpaths.length; i++ ){ - resetDbpath( "/data/db/" + this._alldbpaths[i] ); + resetDbpath( MongoRunner.dataPath + this._alldbpaths[i] ); } } |