blob: 152a9a35f32a1d69379e2ac501ecdde49883c7c2 (
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
25
26
27
28
29
30
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 dbpath = MongoRunner.dataPath + baseName + '/';
// Test framework will append --storageEngine command line option if provided to smoke.py.
var mongod = MongoRunner.runMongod({dbpath: dbpath, smallfiles: ""});
assert.neq(0,
getMongodLockFileSize(dbpath),
'mongod.lock should not be empty while server is running');
MongoRunner.stopMongod(mongod);
// mongod.lock must be empty after shutting server down.
assert.eq(
0, getMongodLockFileSize(dbpath), 'mongod.lock not truncated after shutting server down');
}());
|