summaryrefslogtreecommitdiff
path: root/jstests/tool/dumprestore3.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-01-03 01:02:25 -0500
committerEliot Horowitz <eliot@10gen.com>2011-01-03 01:02:25 -0500
commit0b190bfed4ed96c1046ec240c235928d295431f2 (patch)
tree026edf28dc6d3c89f3ae3cff99fe215dcc72c242 /jstests/tool/dumprestore3.js
parent5bf4a6be167f1b0b6f059bed51ef4eadc12cfe40 (diff)
downloadmongo-0b190bfed4ed96c1046ec240c235928d295431f2.tar.gz
fix line endings
Diffstat (limited to 'jstests/tool/dumprestore3.js')
-rw-r--r--jstests/tool/dumprestore3.js80
1 files changed, 40 insertions, 40 deletions
diff --git a/jstests/tool/dumprestore3.js b/jstests/tool/dumprestore3.js
index 1f59339c4c1..1fa48da1427 100644
--- a/jstests/tool/dumprestore3.js
+++ b/jstests/tool/dumprestore3.js
@@ -1,42 +1,42 @@
// dumprestore3.js
-var name = "dumprestore3";
-
-function step(msg) {
- msg = msg || "";
- this.x = (this.x || 0) + 1;
- print('\n' + name + ".js step " + this.x + ' ' + msg);
-}
-
-step();
+var name = "dumprestore3";
+
+function step(msg) {
+ msg = msg || "";
+ this.x = (this.x || 0) + 1;
+ print('\n' + name + ".js step " + this.x + ' ' + msg);
+}
+
+step();
var replTest = new ReplSetTest( {name: name, nodes: 2} );
var nodes = replTest.startSet();
replTest.initiate();
-var master = replTest.getMaster();
-
-{
- step("populate master");
- var foo = master.getDB("foo");
- for (i = 0; i < 20; i++) {
- foo.bar.insert({ x: i, y: "abc" });
- }
-}
-
-{
- step("wait for slaves");
- replTest.awaitReplication();
-}
-
-{
- step("dump & restore a db into a slave");
- var port = 30020;
- var conn = startMongodTest(port, name + "-other");
- var c = conn.getDB("foo").bar;
- c.save({ a: 22 });
- assert.eq(1, c.count(), "setup2");
-}
-
+var master = replTest.getMaster();
+
+{
+ step("populate master");
+ var foo = master.getDB("foo");
+ for (i = 0; i < 20; i++) {
+ foo.bar.insert({ x: i, y: "abc" });
+ }
+}
+
+{
+ step("wait for slaves");
+ replTest.awaitReplication();
+}
+
+{
+ step("dump & restore a db into a slave");
+ var port = 30020;
+ var conn = startMongodTest(port, name + "-other");
+ var c = conn.getDB("foo").bar;
+ c.save({ a: 22 });
+ assert.eq(1, c.count(), "setup2");
+}
+
step("try mongorestore to slave");
var data = "/data/db/dumprestore3-other1/";
@@ -44,17 +44,17 @@ resetDbpath(data);
runMongoProgram( "mongodump", "--host", "127.0.0.1:"+port, "--out", data );
var x = runMongoProgram( "mongorestore", "--host", "127.0.0.1:"+replTest.ports[1], "--dir", data );
-assert.eq(x, 255, "mongorestore should exit w/ -1 on slave");
-
+assert.eq(x, 255, "mongorestore should exit w/ -1 on slave");
+
step("try mongoimport to slave");
dataFile = "/data/db/dumprestore3-other2.json";
runMongoProgram( "mongoexport", "--host", "127.0.0.1:"+port, "--out", dataFile, "--db", "foo", "--collection", "bar" );
x = runMongoProgram( "mongoimport", "--host", "127.0.0.1:"+replTest.ports[1], "--file", dataFile );
-assert.eq(x, 255, "mongoreimport should exit w/ -1 on slave");
-
+assert.eq(x, 255, "mongoreimport should exit w/ -1 on slave");
+
step("stopSet");
-replTest.stopSet();
-
-step("SUCCESS");
+replTest.stopSet();
+
+step("SUCCESS");