summaryrefslogtreecommitdiff
path: root/jstests/tool/tool1.js
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:17:50 -0500
committerJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:18:14 -0500
commit4ae691e8edc87d0e3cfb633bb91c328426be007b (patch)
tree52079a593f54382ca13a2e741633eab1b6271893 /jstests/tool/tool1.js
parenta025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff)
downloadmongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/tool/tool1.js')
-rw-r--r--jstests/tool/tool1.js61
1 files changed, 38 insertions, 23 deletions
diff --git a/jstests/tool/tool1.js b/jstests/tool/tool1.js
index 6fb0a1f0f02..ce5e880b4ba 100644
--- a/jstests/tool/tool1.js
+++ b/jstests/tool/tool1.js
@@ -6,37 +6,52 @@ externalPath = MongoRunner.dataPath + baseName + "_external/";
externalBaseName = "export.json";
externalFile = externalPath + externalBaseName;
-function fileSize(){
- var l = listFiles( externalPath );
- for ( var i=0; i<l.length; i++ ){
- if ( l[i].baseName == externalBaseName )
+function fileSize() {
+ var l = listFiles(externalPath);
+ for (var i = 0; i < l.length; i++) {
+ if (l[i].baseName == externalBaseName)
return l[i].size;
}
return -1;
}
-
-resetDbpath( externalPath );
+resetDbpath(externalPath);
var m = MongoRunner.runMongod({dbpath: dbPath, noprealloc: "", bind_ip: "127.0.0.1"});
-c = m.getDB( baseName ).getCollection( baseName );
-c.save( { a: 1 } );
-assert( c.findOne() );
+c = m.getDB(baseName).getCollection(baseName);
+c.save({a: 1});
+assert(c.findOne());
-runMongoProgram( "mongodump", "--host", "127.0.0.1:" + m.port, "--out", externalPath );
+runMongoProgram("mongodump", "--host", "127.0.0.1:" + m.port, "--out", externalPath);
c.drop();
-runMongoProgram( "mongorestore", "--host", "127.0.0.1:" + m.port, "--dir", externalPath );
-assert.soon( "c.findOne()" , "mongodump then restore has no data w/sleep" );
-assert( c.findOne() , "mongodump then restore has no data" );
-assert.eq( 1 , c.findOne().a , "mongodump then restore has no broken data" );
-
-resetDbpath( externalPath );
-
-assert.eq( -1 , fileSize() , "mongoexport prep invalid" );
-runMongoProgram( "mongoexport", "--host", "127.0.0.1:" + m.port, "-d", baseName, "-c", baseName, "--out", externalFile );
-assert.lt( 10 , fileSize() , "file size changed" );
+runMongoProgram("mongorestore", "--host", "127.0.0.1:" + m.port, "--dir", externalPath);
+assert.soon("c.findOne()", "mongodump then restore has no data w/sleep");
+assert(c.findOne(), "mongodump then restore has no data");
+assert.eq(1, c.findOne().a, "mongodump then restore has no broken data");
+
+resetDbpath(externalPath);
+
+assert.eq(-1, fileSize(), "mongoexport prep invalid");
+runMongoProgram("mongoexport",
+ "--host",
+ "127.0.0.1:" + m.port,
+ "-d",
+ baseName,
+ "-c",
+ baseName,
+ "--out",
+ externalFile);
+assert.lt(10, fileSize(), "file size changed");
c.drop();
-runMongoProgram( "mongoimport", "--host", "127.0.0.1:" + m.port, "-d", baseName, "-c", baseName, "--file", externalFile );
-assert.soon( "c.findOne()" , "mongo import json A" );
-assert( c.findOne() && 1 == c.findOne().a , "mongo import json B" );
+runMongoProgram("mongoimport",
+ "--host",
+ "127.0.0.1:" + m.port,
+ "-d",
+ baseName,
+ "-c",
+ baseName,
+ "--file",
+ externalFile);
+assert.soon("c.findOne()", "mongo import json A");
+assert(c.findOne() && 1 == c.findOne().a, "mongo import json B");