diff options
author | Mike Grundy <michael.grundy@10gen.com> | 2016-02-04 12:29:45 -0500 |
---|---|---|
committer | Mike Grundy <michael.grundy@10gen.com> | 2016-02-05 15:00:50 -0500 |
commit | 2689df80fa1a476b26d02937456d34191feb1087 (patch) | |
tree | a02e346460db6852e452d2aa74aa8fac2af9cfb8 /jstests/multiVersion | |
parent | a3be230c5af98b8ca149cb89544345654a2ca7d1 (diff) | |
download | mongo-2689df80fa1a476b26d02937456d34191feb1087.tar.gz |
SERVER-22341 fix jslint errors in jstests/multiVersion with eslint --fix
Diffstat (limited to 'jstests/multiVersion')
-rw-r--r-- | jstests/multiVersion/1_test_launching_replset.js | 26 | ||||
-rw-r--r-- | jstests/multiVersion/3_upgrade_replset.js | 64 | ||||
-rw-r--r-- | jstests/multiVersion/balancer_multiVersion_detect.js | 2 | ||||
-rw-r--r-- | jstests/multiVersion/downgrade_replset.js | 4 | ||||
-rw-r--r-- | jstests/multiVersion/dumprestore.js | 2 | ||||
-rw-r--r-- | jstests/multiVersion/dumprestore_sharded.js | 2 | ||||
-rw-r--r-- | jstests/multiVersion/geo_2dsphere_v2_to_v3.js | 2 | ||||
-rw-r--r-- | jstests/multiVersion/libs/auth_helpers.js | 8 | ||||
-rw-r--r-- | jstests/multiVersion/libs/data_generators.js | 32 | ||||
-rw-r--r-- | jstests/multiVersion/libs/dumprestore_helpers.js | 10 | ||||
-rw-r--r-- | jstests/multiVersion/libs/multi_cluster.js | 10 | ||||
-rw-r--r-- | jstests/multiVersion/libs/verify_collection_data.js | 12 | ||||
-rw-r--r-- | jstests/multiVersion/libs/verify_versions.js | 10 |
13 files changed, 92 insertions, 92 deletions
diff --git a/jstests/multiVersion/1_test_launching_replset.js b/jstests/multiVersion/1_test_launching_replset.js index b2a7dce68f4..af1bdf6b330 100644 --- a/jstests/multiVersion/1_test_launching_replset.js +++ b/jstests/multiVersion/1_test_launching_replset.js @@ -8,46 +8,46 @@ var versionsToCheck = [ "last-stable", load('./jstests/multiVersion/libs/verify_versions.js'); -jsTest.log( "Testing legacy versions..." ) +jsTest.log( "Testing legacy versions..." ); for( var i = 0; i < versionsToCheck.length; i++ ){ - var version = versionsToCheck[ i ] + var version = versionsToCheck[ i ]; // Set up a replica set - var rst = new ReplSetTest({ nodes : 2 }) + var rst = new ReplSetTest({ nodes : 2 }); - rst.startSet({ binVersion : version }) + rst.startSet({ binVersion : version }); - var nodes = rst.nodes + var nodes = rst.nodes; // Make sure the started versions are actually the correct versions for( var j = 0; j < nodes.length; j++ ) assert.binVersion(nodes[j], version); - rst.stopSet() + rst.stopSet(); } -jsTest.log( "Testing mixed versions..." ) +jsTest.log( "Testing mixed versions..." ); // Set up a multi-version replica set -var rst = new ReplSetTest({ nodes : 2 }) +var rst = new ReplSetTest({ nodes : 2 }); -rst.startSet({ binVersion : versionsToCheck }) +rst.startSet({ binVersion : versionsToCheck }); -var nodes = rst.nodes +var nodes = rst.nodes; //Make sure we have hosts of all the different versions -var versionsFound = [] +var versionsFound = []; for( var j = 0; j < nodes.length; j++ ) versionsFound.push(nodes[j].getBinVersion()); assert.allBinVersions(versionsToCheck, versionsFound); -rst.stopSet() +rst.stopSet(); -jsTest.log( "Done!" ) +jsTest.log( "Done!" ); // // End diff --git a/jstests/multiVersion/3_upgrade_replset.js b/jstests/multiVersion/3_upgrade_replset.js index 6025f11cd33..d713a59bb43 100644 --- a/jstests/multiVersion/3_upgrade_replset.js +++ b/jstests/multiVersion/3_upgrade_replset.js @@ -2,84 +2,84 @@ // Tests upgrading a replica set // -load( './jstests/multiVersion/libs/multi_rs.js' ) -load( './jstests/libs/test_background_ops.js' ) +load( './jstests/multiVersion/libs/multi_rs.js' ); +load( './jstests/libs/test_background_ops.js' ); var oldVersion = "last-stable"; var nodes = { n1 : { binVersion : oldVersion }, n2 : { binVersion : oldVersion }, - a3 : { binVersion : oldVersion } } + a3 : { binVersion : oldVersion } }; -var rst = new ReplSetTest({ nodes : nodes }) +var rst = new ReplSetTest({ nodes : nodes }); -rst.startSet() -rst.initiate() +rst.startSet(); +rst.initiate(); // Wait for a primary node... -var primary = rst.getPrimary() -var otherOpConn = new Mongo( rst.getURL() ) -var insertNS = "test.foo" +var primary = rst.getPrimary(); +var otherOpConn = new Mongo( rst.getURL() ); +var insertNS = "test.foo"; -jsTest.log( "Starting parallel operations during upgrade..." ) +jsTest.log( "Starting parallel operations during upgrade..." ); function findAndInsert( rsURL, coll ){ - var coll = new Mongo( rsURL ).getCollection( coll + "" ) - var count = 0 + var coll = new Mongo( rsURL ).getCollection( coll + "" ); + var count = 0; - jsTest.log( "Starting finds and inserts..." ) + jsTest.log( "Starting finds and inserts..." ); while( ! isFinished() ){ try{ - coll.insert({ _id : count, hello : "world" }) - assert.eq( null, coll.getDB().getLastError() ) - assert.neq( null, coll.findOne({ _id : count }) ) + coll.insert({ _id : count, hello : "world" }); + assert.eq( null, coll.getDB().getLastError() ); + assert.neq( null, coll.findOne({ _id : count }) ); } catch( e ){ - printjson( e ) + printjson( e ); } - count++ + count++; } - jsTest.log( "Finished finds and inserts..." ) - return count + jsTest.log( "Finished finds and inserts..." ); + return count; } var joinFindInsert = startParallelOps( primary, // The connection where the test info is passed and stored findAndInsert, - [ rst.getURL(), insertNS ] ) + [ rst.getURL(), insertNS ] ); -jsTest.log( "Upgrading replica set..." ) +jsTest.log( "Upgrading replica set..." ); rst.upgradeSet({ binVersion: "latest" }); -jsTest.log( "Replica set upgraded." ) +jsTest.log( "Replica set upgraded." ); // Wait for primary -var primary = rst.getPrimary() +var primary = rst.getPrimary(); -printjson( rst.status() ) +printjson( rst.status() ); // Allow more valid writes to go through -sleep( 10 * 1000 ) +sleep( 10 * 1000 ); -joinFindInsert() +joinFindInsert(); -var totalInserts = primary.getCollection( insertNS ).find().sort({ _id : -1 }).next()._id + 1 -var dataFound = primary.getCollection( insertNS ).count() +var totalInserts = primary.getCollection( insertNS ).find().sort({ _id : -1 }).next()._id + 1; +var dataFound = primary.getCollection( insertNS ).count(); -jsTest.log( "Found " + dataFound + " docs out of " + tojson( totalInserts ) + " inserted." ) +jsTest.log( "Found " + dataFound + " docs out of " + tojson( totalInserts ) + " inserted." ); -assert.gt( dataFound / totalInserts, 0.5 ) +assert.gt( dataFound / totalInserts, 0.5 ); -rst.stopSet() +rst.stopSet(); diff --git a/jstests/multiVersion/balancer_multiVersion_detect.js b/jstests/multiVersion/balancer_multiVersion_detect.js index c68072b3e80..c1db3036cfb 100644 --- a/jstests/multiVersion/balancer_multiVersion_detect.js +++ b/jstests/multiVersion/balancer_multiVersion_detect.js @@ -11,7 +11,7 @@ var options = { shardOptions : { binVersion : [ "latest", "last-stable" ] }, sync : false, enableBalancer : true -} +}; var st = new ShardingTest({ shards : 3, mongos : 1, other : options }); diff --git a/jstests/multiVersion/downgrade_replset.js b/jstests/multiVersion/downgrade_replset.js index 6dd492efab3..03c40114b0e 100644 --- a/jstests/multiVersion/downgrade_replset.js +++ b/jstests/multiVersion/downgrade_replset.js @@ -1,8 +1,8 @@ // Test the downgrade of a replica set from latest version // to last-stable version succeeds, while reads and writes continue. -load('./jstests/multiVersion/libs/multi_rs.js') -load('./jstests/libs/test_background_ops.js') +load('./jstests/multiVersion/libs/multi_rs.js'); +load('./jstests/libs/test_background_ops.js'); var newVersion = "latest"; var oldVersion = "last-stable"; diff --git a/jstests/multiVersion/dumprestore.js b/jstests/multiVersion/dumprestore.js index c20acd6fa05..07b7895c07f 100644 --- a/jstests/multiVersion/dumprestore.js +++ b/jstests/multiVersion/dumprestore.js @@ -1,6 +1,6 @@ // dumprestore.js -load( './jstests/multiVersion/libs/dumprestore_helpers.js' ) +load( './jstests/multiVersion/libs/dumprestore_helpers.js' ); // The base name to use for various things in the test, including the dbpath and the database name diff --git a/jstests/multiVersion/dumprestore_sharded.js b/jstests/multiVersion/dumprestore_sharded.js index f1695ad8a6f..5d4a603dd3f 100644 --- a/jstests/multiVersion/dumprestore_sharded.js +++ b/jstests/multiVersion/dumprestore_sharded.js @@ -1,6 +1,6 @@ // dumprestore_sharded.js -load( './jstests/multiVersion/libs/dumprestore_helpers.js' ) +load( './jstests/multiVersion/libs/dumprestore_helpers.js' ); // The base name to use for various things in the test, including the dbpath and the database name diff --git a/jstests/multiVersion/geo_2dsphere_v2_to_v3.js b/jstests/multiVersion/geo_2dsphere_v2_to_v3.js index d223358c3de..3cd0e616c7b 100644 --- a/jstests/multiVersion/geo_2dsphere_v2_to_v3.js +++ b/jstests/multiVersion/geo_2dsphere_v2_to_v3.js @@ -98,7 +98,7 @@ var failed_mongod = MongoRunner.runMongod({binVersion: "3.0", restart: mongod}); assert.eq(failed_mongod, null); // upgrade, reindex, then downgrade to fix -mongod = MongoRunner.runMongod({binVersion: "latest", restart: mongod}) +mongod = MongoRunner.runMongod({binVersion: "latest", restart: mongod}); coll = getCollection(mongod); assert.eq(3, get2dsphereIndexVersion(coll)); res = coll.dropIndex({geometry: "2dsphere"}); diff --git a/jstests/multiVersion/libs/auth_helpers.js b/jstests/multiVersion/libs/auth_helpers.js index cebb2b03e5f..ecbf2047212 100644 --- a/jstests/multiVersion/libs/auth_helpers.js +++ b/jstests/multiVersion/libs/auth_helpers.js @@ -3,8 +3,8 @@ // Get a user document for username in db. var getUserDoc = function(db, username){ return db.runCommand({'usersInfo': {user: username, db: db._name}, - showCredentials: true}).users[0] -} + showCredentials: true}).users[0]; +}; // Verify that the user document for username in db // has MONGODB-CR credentials (or not) and SCRAM-SHA-1 @@ -14,7 +14,7 @@ var verifyUserDoc = function(db, username, hasCR, hasSCRAM, hasExternal = false) assert.eq(hasCR, 'MONGODB-CR' in userDoc.credentials); assert.eq(hasSCRAM, 'SCRAM-SHA-1' in userDoc.credentials); assert.eq(hasExternal, 'external' in userDoc.credentials); -} +}; // Verify that that we can authenticate (or not) using MONGODB-CR // and SCRAM-SHA-1 to db using username and password. @@ -24,4 +24,4 @@ var verifyAuth = function(db, username, password, passCR, passSCRAM){ assert.eq(passSCRAM, db.auth({mechanism: 'SCRAM-SHA-1', user: username, pwd: password})); db.logout(); -} +}; diff --git a/jstests/multiVersion/libs/data_generators.js b/jstests/multiVersion/libs/data_generators.js index 694d3f57514..6f57e3e0060 100644 --- a/jstests/multiVersion/libs/data_generators.js +++ b/jstests/multiVersion/libs/data_generators.js @@ -27,14 +27,14 @@ function DataGenerator() { // Generator functions // BSON Type: -1 function GenMinKey (seed) { - return MinKey() + return MinKey(); } // BSON Type: 0 (EOO) // No Shell Equivalent // BSON Type: 1 function GenNumberDouble (seed) { var seed = seed || 0; - return Number(seed) + return Number(seed); } // BSON Type: 2 function GenString (seed) { @@ -184,11 +184,11 @@ function DataGenerator() { function GenNumberLong (seed) { var seed = seed || 0; - return NumberLong(seed) + return NumberLong(seed); } // BSON Type: 127 function GenMaxKey (seed) { - return MaxKey() + return MaxKey(); } // The DBRef type is not a BSON type but is treated specially in the shell: function GenDBRef (seed) { @@ -243,7 +243,7 @@ function DataGenerator() { "MaxKey" : GenMaxKey(seed), // The DBRef type is not a BSON type but is treated specially in the shell: "DBRef" : GenDBRef(seed), - } + }; } function GenFlatObjectAllTypesHardCoded() { @@ -298,7 +298,7 @@ function DataGenerator() { "MaxKey" : MaxKey(), // The DBRef type is not a BSON type but is treated specially in the shell: "DBRef" : DBRef("bar", 2) - } + }; } // Data we are using as a source for our testing @@ -312,7 +312,7 @@ function DataGenerator() { GenFlatObjectAllTypes(23), GenFlatObjectAllTypes(111), GenFlatObjectAllTypes(11111111), - ] + ]; // Cursor interface var i = 0; @@ -326,7 +326,7 @@ function DataGenerator() { } return testData[i++]; } - } + }; } // @@ -408,7 +408,7 @@ function IndexDataGenerator(options) { // Loop again if we advanced the character past the end of keyChars and wrapped around, // so that we can advance the next character over too. For example, this is the case // where "ab" follows "Za". - } while (keyCharsIndex + 1 >= keyChars.length) + } while (keyCharsIndex + 1 >= keyChars.length); return currentKey; } @@ -536,7 +536,7 @@ function IndexDataGenerator(options) { // When using a text index, the following additional index properties are required when // downgrading from 2.6: // { "textIndexVersion" : 1 } - attributes["textIndexVersion"] = 1 + attributes["textIndexVersion"] = 1; return attributes; } @@ -545,7 +545,7 @@ function IndexDataGenerator(options) { // When using a 2dsphere index, the following additional index properties are required when // downgrading from 2.6: // { "2dsphereIndexVersion" : 1 } - attributes["2dsphereIndexVersion"] = 1 + attributes["2dsphereIndexVersion"] = 1; return attributes; } @@ -584,7 +584,7 @@ function IndexDataGenerator(options) { // Hashed Index { "spec" : GenHashedIndex(10), "options" : GenIndexOptions(14) }, - ] + ]; // Cursor interface var i = 0; @@ -598,7 +598,7 @@ function IndexDataGenerator(options) { } return testIndexes[i++]; } - } + }; } // @@ -646,7 +646,7 @@ function CollectionMetadataGenerator(options) { "max" : 2000, "usePowerOf2Sizes" : true, //"autoIndexId" : false // XXX: this doesn't exist in 2.4 - } + }; // We need to explicitly enable usePowerOf2Sizes, since it's the default in 2.6 but not in 2.4 var normalCollectionMetadata = { "usePowerOf2Sizes" : true @@ -656,7 +656,7 @@ function CollectionMetadataGenerator(options) { "get" : function () { return capped ? cappedCollectionMetadata : normalCollectionMetadata; } - } + }; } // @@ -667,5 +667,5 @@ function CollectionDataGenerator(options) { "data" : new DataGenerator(), "indexes" : new IndexDataGenerator(), "collectionMetadata" : new CollectionMetadataGenerator(options) - } + }; } diff --git a/jstests/multiVersion/libs/dumprestore_helpers.js b/jstests/multiVersion/libs/dumprestore_helpers.js index f4885c1f2d8..ad6ac1949fe 100644 --- a/jstests/multiVersion/libs/dumprestore_helpers.js +++ b/jstests/multiVersion/libs/dumprestore_helpers.js @@ -1,6 +1,6 @@ // dumprestore_helpers.js -load( './jstests/multiVersion/libs/verify_collection_data.js' ) +load( './jstests/multiVersion/libs/verify_collection_data.js' ); // Given a "test spec" object, runs the specified test. // @@ -39,7 +39,7 @@ function multiVersionDumpRestoreTest(configObj) { 'testDbpath', 'dumpType', 'restoreType' - ] + ]; var i; @@ -58,7 +58,7 @@ function multiVersionDumpRestoreTest(configObj) { shards : [{ binVersion : configObj.serverSourceVersion, setParameter : "textSearchEnabled=true" }], config : [{ binVersion : configObj.serverSourceVersion }] - } + }; var shardingTest = new ShardingTest(shardingTestConfig); var serverSource = shardingTest.s; } @@ -118,7 +118,7 @@ function multiVersionDumpRestoreTest(configObj) { shards : [{ binVersion : configObj.serverDestVersion, setParameter : "textSearchEnabled=true" }], config : [{ binVersion : configObj.serverDestVersion }] - } + }; var shardingTest = new ShardingTest(shardingTestConfig); serverDest = shardingTest.s; MongoRunner.runMongoTool("mongorestore", { dir : configObj.dumpDir + "/" + testBaseName, @@ -219,7 +219,7 @@ function getPermutationIterator(permsObj) { "hasNext" : function () { return currentPermutation < allPermutations.length; } - } + }; } // Given a "test spec" object, runs all test combinations. diff --git a/jstests/multiVersion/libs/multi_cluster.js b/jstests/multiVersion/libs/multi_cluster.js index c6fcedfa0ff..cf60f531307 100644 --- a/jstests/multiVersion/libs/multi_cluster.js +++ b/jstests/multiVersion/libs/multi_cluster.js @@ -98,15 +98,15 @@ ShardingTest.prototype.restartMongoses = function() { var mongos = this._mongos[i]; MongoRunner.stopMongos(mongos); - mongos = MongoRunner.runMongos({ restart : mongos }) + mongos = MongoRunner.runMongos({ restart : mongos }); this[ "s" + i ] = this._mongos[i] = mongos; if( i == 0 ) this.s = mongos; } - this.config = this.s.getDB( "config" ) - this.admin = this.s.getDB( "admin" ) -} + this.config = this.s.getDB( "config" ); + this.admin = this.s.getDB( "admin" ); +}; ShardingTest.prototype.getMongosAtVersion = function(binVersion) { var mongoses = this._mongos; @@ -122,4 +122,4 @@ ShardingTest.prototype.getMongosAtVersion = function(binVersion) { print(mongoses[i]); } } -} +}; diff --git a/jstests/multiVersion/libs/verify_collection_data.js b/jstests/multiVersion/libs/verify_collection_data.js index f8d10700cec..73e54f32f48 100644 --- a/jstests/multiVersion/libs/verify_collection_data.js +++ b/jstests/multiVersion/libs/verify_collection_data.js @@ -18,7 +18,7 @@ // 4. Do round trip or other testing // 5. Validate that collection has not changed using the CollectionDataValidator class -load( './jstests/multiVersion/libs/data_generators.js' ) +load( './jstests/multiVersion/libs/data_generators.js' ); // Function to actually add the data generated by the given dataGenerator to a collection createCollectionWithData = function (db, collectionName, dataGenerator) { @@ -62,7 +62,7 @@ createCollectionWithData = function (db, collectionName, dataGenerator) { assert.eq(collection.find().count(), numInserted, "counts not equal after inserts"); return db.getCollection(collectionName); -} +}; // Class to save the state of a collection and later compare the current state of a collection to // the saved state @@ -97,7 +97,7 @@ function CollectionDataValidator() { _initialized = true; return collection; - } + }; this.validateCollectionData = function (collection) { @@ -125,7 +125,7 @@ function CollectionDataValidator() { assert.docEq(_collectionData[i], newCollectionData[i], "data not equal"); } return true; - } + }; } // Tests of the functions and classes in this file @@ -141,7 +141,7 @@ function collectionDataValidatorTests() { collection = createCollectionWithData(db, "test", myGenerator); myValidator = new CollectionDataValidator(); myValidator.recordCollectionData(collection); - db.test.dropIndex(db.test.getIndexKeys().filter(function(key) { return key.a != null })[0]); + db.test.dropIndex(db.test.getIndexKeys().filter(function(key) { return key.a != null; })[0]); assert.throws(myValidator.validateCollectionData, [collection], "Validation function should have thrown since we modified the collection"); @@ -163,7 +163,7 @@ function collectionDataValidatorTests() { collection = createCollectionWithData(db, "test", myGenerator); myValidator = new CollectionDataValidator(); myValidator.recordCollectionData(collection); - db.test.dropIndex(db.test.getIndexKeys().filter(function(key) { return key.a != null })[0]); + db.test.dropIndex(db.test.getIndexKeys().filter(function(key) { return key.a != null; })[0]); assert.throws(myValidator.validateCollectionData, [collection], "Validation function should have thrown since we modified the collection"); diff --git a/jstests/multiVersion/libs/verify_versions.js b/jstests/multiVersion/libs/verify_versions.js index 3ac2de37c29..89641b5c493 100644 --- a/jstests/multiVersion/libs/verify_versions.js +++ b/jstests/multiVersion/libs/verify_versions.js @@ -3,9 +3,9 @@ */ Mongo.prototype.getBinVersion = function() { - var result = this.getDB( "admin" ).runCommand({ serverStatus : 1 }) - return result.version -} + var result = this.getDB( "admin" ).runCommand({ serverStatus : 1 }); + return result.version; +}; // Checks that our mongodb process is of a certain version assert.binVersion = function(mongo, version) { @@ -14,7 +14,7 @@ assert.binVersion = function(mongo, version) { MongoRunner.getBinVersionFor(version)), "version " + version + " (" + MongoRunner.getBinVersionFor(version) + ")" + " is not the same as " + currVersion); -} +}; // Compares an array of desired versions and an array of found versions, @@ -36,4 +36,4 @@ assert.allBinVersions = function(versionsWanted, versionsFound) { version + " (" + MongoRunner.getBinVersionFor(version) + ")" + " in " + versionsFound); } -} +}; |