summaryrefslogtreecommitdiff
path: root/src/mongo/gotools/src/github.com/mongodb/mongo-tools/test/qa-tests/jstests/restore/bad_options.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/gotools/src/github.com/mongodb/mongo-tools/test/qa-tests/jstests/restore/bad_options.js')
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/test/qa-tests/jstests/restore/bad_options.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/test/qa-tests/jstests/restore/bad_options.js b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/test/qa-tests/jstests/restore/bad_options.js
new file mode 100644
index 00000000000..07b6742637d
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/test/qa-tests/jstests/restore/bad_options.js
@@ -0,0 +1,54 @@
+(function() {
+
+ load("jstests/configs/standard_dump_targets.config.js");
+
+ // Tests running mongorestore with bad command line options.
+
+ jsTest.log('Testing running mongorestore with bad'+
+ ' command line options');
+
+ var toolTest = new ToolTest('incompatible_flags');
+ toolTest.startDB('foo');
+
+ // run restore with both --objcheck and --noobjcheck specified
+ var ret = toolTest.runTool.apply(toolTest, ['restore',
+ '--objcheck', '--noobjcheck']
+ .concat(getRestoreTarget('restore/testdata/dump_empty')));
+ assert.neq(0, ret);
+
+ // run restore with --oplogLimit with a bad timestamp
+ ret = toolTest.runTool.apply(toolTest, ['restore',
+ '--oplogReplay', '--oplogLimit',
+ 'xxx']
+ .concat(getRestoreTarget('restore/testdata/dump_with_oplog')));
+ assert.neq(0, ret);
+
+ // run restore with a negative --w value
+ ret = toolTest.runTool.apply(toolTest, ['restore',
+ '--w', '-1']
+ .concat(getRestoreTarget('jstests/restore/testdata/dump_empty')));
+ assert.neq(0, ret);
+
+ // run restore with an invalid db name
+ ret = toolTest.runTool.apply(toolTest, ['restore',
+ '--db', 'billy.crystal']
+ .concat(getRestoreTarget('jstests/restore/testdata/blankdb')));
+ assert.neq(0, ret);
+
+ // run restore with an invalid collection name
+ ret = toolTest.runTool.apply(toolTest, ['restore',
+ '--db', 'test',
+ '--collection', '$money']
+ .concat(getRestoreTarget('jstests/restore/testdata/blankcoll/blank.bson')));
+ assert.neq(0, ret);
+
+ // run restore with an invalid verbosity value
+ ret = toolTest.runTool.apply(toolTest, ['restore',
+ '-v', 'torvalds']
+ .concat(getRestoreTarget('restore/testdata/dump_empty')));
+ assert.neq(0, ret);
+
+ // success
+ toolTest.stop();
+
+}());