diff options
author | Benety Goh <benety@mongodb.com> | 2014-12-30 18:31:26 -0500 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2015-01-05 15:52:48 -0500 |
commit | d602ceb25e996962298ab45864aad4eb80262485 (patch) | |
tree | 0d8f006a3a6db56cd689a5a87b3805e06cc49d3a /jstests | |
parent | 2f881f7f2a00bb4b5f7af868033b89b1246e8bc8 (diff) | |
download | mongo-d602ceb25e996962298ab45864aad4eb80262485.tar.gz |
SERVER-16677 moved management of mongod.lock from mmapv1 engine to global environment
added test to ensure that mongod.lock is created for all storage engines/platforms.
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/noPassthrough/lock_file.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/jstests/noPassthrough/lock_file.js b/jstests/noPassthrough/lock_file.js new file mode 100644 index 00000000000..68240017c1a --- /dev/null +++ b/jstests/noPassthrough/lock_file.js @@ -0,0 +1,31 @@ +// The mongod process should always create a mongod.lock file in the data directory +// containing the process ID regardless of the storage engine requested. + +(function() { + // Ensures that mongod.lock exists and returns size of file. + function getMongodLockFileSize(dir) { + var files = listFiles(dir); + for (var i in files) { + var file = files[i]; + if (!file.isDirectory && file.baseName == 'mongod.lock') { + return file.size; + } + } + assert(false, 'mongod.lock not found in data directory ' + dir); + } + + var baseName = "jstests_lock_file"; + var port = allocatePorts(1)[0] ; + var dbpath = MongoRunner.dataPath + baseName + '/'; + + // Test framework will append --storageEngine command line option if provided to smoke.py. + startMongodEmpty('--port', port, '--dbpath', dbpath, '--smallfiles'); + assert.neq(0, getMongodLockFileSize(dbpath), + 'mongod.lock should not be empty while server is running'); + + stopMongod(port); + + // mongod.lock must be empty after shutting server down. + assert.eq(0, getMongodLockFileSize(dbpath), + 'mongod.lock not truncated after shutting server down'); +}()); |