summaryrefslogtreecommitdiff
path: root/jstests/tool/dumprestore3.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/tool/dumprestore3.js')
-rw-r--r--jstests/tool/dumprestore3.js104
1 files changed, 52 insertions, 52 deletions
diff --git a/jstests/tool/dumprestore3.js b/jstests/tool/dumprestore3.js
index 18817bb20ea..13efe2696c0 100644
--- a/jstests/tool/dumprestore3.js
+++ b/jstests/tool/dumprestore3.js
@@ -2,65 +2,65 @@
// secondary node should fail.
(function() {
- // Skip this test if running with --nojournal and WiredTiger.
- if (jsTest.options().noJournal &&
- (!jsTest.options().storageEngine || jsTest.options().storageEngine === "wiredTiger")) {
- print("Skipping test because running WiredTiger without journaling isn't a valid" +
- " replica set configuration");
- return;
- }
+// Skip this test if running with --nojournal and WiredTiger.
+if (jsTest.options().noJournal &&
+ (!jsTest.options().storageEngine || jsTest.options().storageEngine === "wiredTiger")) {
+ print("Skipping test because running WiredTiger without journaling isn't a valid" +
+ " replica set configuration");
+ return;
+}
- var name = "dumprestore3";
+var name = "dumprestore3";
- var replTest = new ReplSetTest({name: name, nodes: 2});
- var nodes = replTest.startSet();
- replTest.initiate();
- var primary = replTest.getPrimary();
- var secondary = replTest.getSecondary();
+var replTest = new ReplSetTest({name: name, nodes: 2});
+var nodes = replTest.startSet();
+replTest.initiate();
+var primary = replTest.getPrimary();
+var secondary = replTest.getSecondary();
- jsTestLog("populate primary");
- var foo = primary.getDB("foo");
- for (i = 0; i < 20; i++) {
- foo.bar.insert({x: i, y: "abc"});
- }
+jsTestLog("populate primary");
+var foo = primary.getDB("foo");
+for (i = 0; i < 20; i++) {
+ foo.bar.insert({x: i, y: "abc"});
+}
- jsTestLog("wait for secondary");
- replTest.awaitReplication();
+jsTestLog("wait for secondary");
+replTest.awaitReplication();
- jsTestLog("mongodump from primary");
- var data = MongoRunner.dataDir + "/dumprestore3-other1/";
- resetDbpath(data);
- var ret = MongoRunner.runMongoTool("mongodump", {
- host: primary.host,
- out: data,
- });
- assert.eq(ret, 0, "mongodump should exit w/ 0 on primary");
+jsTestLog("mongodump from primary");
+var data = MongoRunner.dataDir + "/dumprestore3-other1/";
+resetDbpath(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 = MongoRunner.runMongoTool("mongorestore", {
- host: secondary.host,
- dir: data,
- });
- assert.neq(ret, 0, "mongorestore should exit w/ 1 on secondary");
+jsTestLog("try mongorestore to secondary");
+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 = MongoRunner.runMongoTool("mongoexport", {
- host: primary.host,
- out: dataFile,
- db: "foo",
- collection: "bar",
- });
- assert.eq(ret, 0, "mongoexport should exit w/ 0 on primary");
+jsTestLog("mongoexport from primary");
+dataFile = MongoRunner.dataDir + "/dumprestore3-other2.json";
+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 = MongoRunner.runMongoTool("mongoimport", {
- host: secondary.host,
- file: dataFile,
- });
- assert.neq(ret, 0, "mongoimport should exit w/ 1 on secondary");
+jsTestLog("mongoimport from 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();
- jsTestLog("SUCCESS");
+jsTestLog("stopSet");
+replTest.stopSet();
+jsTestLog("SUCCESS");
}());