diff options
author | Adam Midvidy <amidvidy@gmail.com> | 2016-01-25 15:57:02 -0500 |
---|---|---|
committer | Adam Midvidy <amidvidy@gmail.com> | 2016-01-29 14:55:42 -0500 |
commit | 3c22b5e073a368dacc2b9fbfa71a4c55ca30129c (patch) | |
tree | 32170cb42952eec2d614df3a41f20d295c7e7d68 /jstests/readonly/lib | |
parent | 314769d890534eb8a6d0b4a9e0befcb1625458c2 (diff) | |
download | mongo-3c22b5e073a368dacc2b9fbfa71a4c55ca30129c.tar.gz |
SERVER-22278 create readOnly suite
Diffstat (limited to 'jstests/readonly/lib')
-rw-r--r-- | jstests/readonly/lib/read_only_test.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/jstests/readonly/lib/read_only_test.js b/jstests/readonly/lib/read_only_test.js new file mode 100644 index 00000000000..6d144d6e0f8 --- /dev/null +++ b/jstests/readonly/lib/read_only_test.js @@ -0,0 +1,35 @@ +'use_strict'; + +function runReadOnlyTest(test) { + + assert.eq(typeof(test.exec), "function"); + assert.eq(typeof(test.load), "function"); + assert.eq(typeof(test.name), "string"); + + // TODO: read storageEngine from testData when read-only mode is supported in WiredTiger. + var options = { + storageEngine: 'mmapv1', + nopreallocj: '' + }; + + var writableMongod = MongoRunner.runMongod(options); + var dbpath = writableMongod.dbpath; + + jsTest.log("starting load phase for test: " + test.name); + test.load(writableMongod.getDB("test")[test.name]); + + MongoRunner.stopMongod(writableMongod); + + // TODO: change directory to read-only permissions when RO is implemented in MMAPv1. + var readOnlyOptions = Object.extend(options, + {readOnly: '', + dbpath: dbpath, + noCleanData: true}); + + var readOnlyMongod = MongoRunner.runMongod(readOnlyOptions); + + jsTest.log("starting execution phase for test: " + test.name); + test.exec(readOnlyMongod.getDB("test")[test.name]); + + MongoRunner.stopMongod(readOnlyMongod); +} |