summaryrefslogtreecommitdiff
path: root/jstests/tool/dumprestore3.js
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2016-06-07 16:01:44 -0400
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2016-06-07 16:01:44 -0400
commit01dfe61a6c03307f0384406bfbde486f8de15425 (patch)
tree907e50e42f26e987af8b7a792d0b628ef2728264 /jstests/tool/dumprestore3.js
parent032424437d50eceafc5eb7c9b2c24c73da6ff1fc (diff)
downloadmongo-01dfe61a6c03307f0384406bfbde486f8de15425.tar.gz
SERVER-23741 Use MongoRunner.runMongoTool() to run tools from JS tests.
Changes all usages of runMongoProgram(<mongo tool>, ...) to MongoRunner.runMongoTool(<mongo tool>, {...}) to take advantage of the --dialTimeout command line option supported by the mongo tools. Adds support for specifying positional arguments to MongoRunner.runMongoTool() in order to support all invocations of the bsondump and mongofiles tools.
Diffstat (limited to 'jstests/tool/dumprestore3.js')
-rw-r--r--jstests/tool/dumprestore3.js25
1 files changed, 19 insertions, 6 deletions
diff --git a/jstests/tool/dumprestore3.js b/jstests/tool/dumprestore3.js
index 6ac6ae76c3f..f29aa3576c4 100644
--- a/jstests/tool/dumprestore3.js
+++ b/jstests/tool/dumprestore3.js
@@ -21,22 +21,35 @@ replTest.awaitReplication();
jsTestLog("mongodump from primary");
var data = MongoRunner.dataDir + "/dumprestore3-other1/";
resetDbpath(data);
-var ret = runMongoProgram("mongodump", "--host", primary.host, "--out", data);
+var ret = MongoRunner.runMongoTool("mongodump", {
+ host: primary.host,
+ out: data,
+});
assert.eq(ret, 0, "mongodump should exit w/ 0 on primary");
jsTestLog("try mongorestore to secondary");
-ret = runMongoProgram("mongorestore", "--host", secondary.host, "--dir", data);
+ret = MongoRunner.runMongoTool("mongorestore", {
+ host: secondary.host,
+ dir: data,
+});
assert.neq(ret, 0, "mongorestore should exit w/ 1 on secondary");
jsTestLog("mongoexport from primary");
dataFile = MongoRunner.dataDir + "/dumprestore3-other2.json";
-ret = runMongoProgram(
- "mongoexport", "--host", primary.host, "--out", dataFile, "--db", "foo", "--collection", "bar");
+ret = MongoRunner.runMongoTool("mongoexport", {
+ host: primary.host,
+ out: dataFile,
+ db: "foo",
+ collection: "bar",
+});
assert.eq(ret, 0, "mongoexport should exit w/ 0 on primary");
jsTestLog("mongoimport from secondary");
-ret = runMongoProgram("mongoimport", "--host", secondary.host, "--file", dataFile);
-assert.neq(ret, 0, "mongoreimport should exit w/ 1 on secondary");
+ret = MongoRunner.runMongoTool("mongoimport", {
+ host: secondary.host,
+ file: dataFile,
+});
+assert.neq(ret, 0, "mongoimport should exit w/ 1 on secondary");
jsTestLog("stopSet");
replTest.stopSet();