summaryrefslogtreecommitdiff
path: root/jstests/libs
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/libs')
-rw-r--r--jstests/libs/chunk_manipulation_util.js4
-rw-r--r--jstests/libs/cleanup_orphaned_util.js8
-rw-r--r--jstests/libs/csrs_upgrade_util.js8
-rw-r--r--jstests/libs/election_timing_test.js5
-rw-r--r--jstests/libs/fts.js12
-rw-r--r--jstests/libs/geo_near_random.js11
-rw-r--r--jstests/libs/override_methods/implicitly_shard_accessed_collections.js6
-rw-r--r--jstests/libs/override_methods/set_majority_read_and_write_concerns.js18
-rw-r--r--jstests/libs/override_methods/sharding_continuous_config_stepdown.js22
-rw-r--r--jstests/libs/test_background_ops.js4
-rw-r--r--jstests/libs/trace_missing_docs.js12
11 files changed, 41 insertions, 69 deletions
diff --git a/jstests/libs/chunk_manipulation_util.js b/jstests/libs/chunk_manipulation_util.js
index a334cbe8aec..dcf46fe4529 100644
--- a/jstests/libs/chunk_manipulation_util.js
+++ b/jstests/libs/chunk_manipulation_util.js
@@ -28,9 +28,7 @@ function moveChunkParallel(staticMongod, mongosURL, findCriteria, bounds, ns, to
assert((findCriteria || bounds) && !(findCriteria && bounds),
'Specify either findCriteria or bounds, but not both.');
- var mongos = new Mongo(mongosURL), admin = mongos.getDB('admin'), cmd = {
- moveChunk: ns
- };
+ var mongos = new Mongo(mongosURL), admin = mongos.getDB('admin'), cmd = {moveChunk: ns};
if (findCriteria) {
cmd.find = findCriteria;
diff --git a/jstests/libs/cleanup_orphaned_util.js b/jstests/libs/cleanup_orphaned_util.js
index cfd69ab128f..3990c148df4 100644
--- a/jstests/libs/cleanup_orphaned_util.js
+++ b/jstests/libs/cleanup_orphaned_util.js
@@ -94,12 +94,8 @@ function testCleanupOrphaned(options) {
assert.commandWorked(admin.runCommand({split: coll.getFullName(), middle: oneQuarter}));
- assert.commandWorked(admin.runCommand({
- moveChunk: coll.getFullName(),
- find: beginning,
- to: shards[1]._id,
- _waitForDelete: true
- }));
+ assert.commandWorked(admin.runCommand(
+ {moveChunk: coll.getFullName(), find: beginning, to: shards[1]._id, _waitForDelete: true}));
// 1/4 of the data is on the first shard.
// shard 0: [threeQuarters, middle)
diff --git a/jstests/libs/csrs_upgrade_util.js b/jstests/libs/csrs_upgrade_util.js
index 7dccccc3e7c..8d43507beee 100644
--- a/jstests/libs/csrs_upgrade_util.js
+++ b/jstests/libs/csrs_upgrade_util.js
@@ -127,12 +127,8 @@ var CSRSUpgradeCoordinator = function() {
*/
this.restartFirstConfigAsReplSet = function() {
jsTest.log("Restarting " + st.c0.name + " as a standalone replica set");
- csrsConfig = {
- _id: csrsName,
- version: 1,
- configsvr: true,
- members: [{_id: 0, host: st.c0.name}]
- };
+ csrsConfig =
+ {_id: csrsName, version: 1, configsvr: true, members: [{_id: 0, host: st.c0.name}]};
assert.commandWorked(st.c0.adminCommand({replSetInitiate: csrsConfig}));
csrs = [];
csrs0Opts = Object.extend({}, st.c0.fullOptions, /* deep */ true);
diff --git a/jstests/libs/election_timing_test.js b/jstests/libs/election_timing_test.js
index f40ad5f931b..16634530abf 100644
--- a/jstests/libs/election_timing_test.js
+++ b/jstests/libs/election_timing_test.js
@@ -48,10 +48,7 @@ var ElectionTimingTest = function(opts) {
ElectionTimingTest.prototype._runTimingTest = function() {
for (var run = 0; run < this.testRuns; run++) {
var collectionName = "test." + this.name;
- var cycleData = {
- testRun: run,
- results: []
- };
+ var cycleData = {testRun: run, results: []};
jsTestLog("Starting ReplSetTest for test " + this.name + " run: " + run);
this.rst =
diff --git a/jstests/libs/fts.js b/jstests/libs/fts.js
index eb5baec8a5a..e46b492564a 100644
--- a/jstests/libs/fts.js
+++ b/jstests/libs/fts.js
@@ -1,13 +1,9 @@
// Utility functions for FTS tests
//
function queryIDS(coll, search, filter, extra, limit) {
- var query = {
- "$text": {"$search": search}
- };
+ var query = {"$text": {"$search": search}};
if (extra)
- query = {
- "$text": Object.extend({"$search": search}, extra)
- };
+ query = {"$text": Object.extend({"$search": search}, extra)};
if (filter)
Object.extend(query, filter);
@@ -17,8 +13,8 @@ function queryIDS(coll, search, filter, extra, limit) {
.sort({score: {"$meta": "textScore"}})
.limit(limit);
else
- result = coll.find(query, {score: {"$meta": "textScore"}})
- .sort({score: {"$meta": "textScore"}});
+ result =
+ coll.find(query, {score: {"$meta": "textScore"}}).sort({score: {"$meta": "textScore"}});
return getIDS(result);
}
diff --git a/jstests/libs/geo_near_random.js b/jstests/libs/geo_near_random.js
index 2af13814173..91f0167ea31 100644
--- a/jstests/libs/geo_near_random.js
+++ b/jstests/libs/geo_near_random.js
@@ -65,12 +65,7 @@ GeoNearRandomTest.prototype.testPt = function(pt, opts) {
print("testing point: " + tojson(pt) + " opts: " + tojson(opts));
- var cmd = {
- geoNear: this.t.getName(),
- near: pt,
- num: 1,
- spherical: opts.sphere
- };
+ var cmd = {geoNear: this.t.getName(), near: pt, num: 1, spherical: opts.sphere};
var last = db.runCommand(cmd).results;
for (var i = 2; i <= opts.nToTest; i++) {
@@ -97,9 +92,7 @@ GeoNearRandomTest.prototype.testPt = function(pt, opts) {
return x.obj;
});
- var query = {
- loc: {}
- };
+ var query = {loc: {}};
query.loc[opts.sphere ? '$nearSphere' : '$near'] = pt;
var near = this.t.find(query).limit(opts.nToTest).toArray();
diff --git a/jstests/libs/override_methods/implicitly_shard_accessed_collections.js b/jstests/libs/override_methods/implicitly_shard_accessed_collections.js
index 313bd7faf7c..65e32bd8a53 100644
--- a/jstests/libs/override_methods/implicitly_shard_accessed_collections.js
+++ b/jstests/libs/override_methods/implicitly_shard_accessed_collections.js
@@ -14,7 +14,11 @@
var originalGetCollection = DB.prototype.getCollection;
// Blacklisted namespaces that should not be sharded.
- var blacklistedNamespaces = [/\$cmd/, /^admin\./, /\.system\./, ];
+ var blacklistedNamespaces = [
+ /\$cmd/,
+ /^admin\./,
+ /\.system\./,
+ ];
DB.prototype.getCollection = function() {
var dbName = this.getName();
diff --git a/jstests/libs/override_methods/set_majority_read_and_write_concerns.js b/jstests/libs/override_methods/set_majority_read_and_write_concerns.js
index 767134d43a4..232d97e6562 100644
--- a/jstests/libs/override_methods/set_majority_read_and_write_concerns.js
+++ b/jstests/libs/override_methods/set_majority_read_and_write_concerns.js
@@ -9,9 +9,7 @@
// Use a "signature" value that won't typically match a value assigned in normal use.
wtimeout: 60321
};
- var defaultReadConcern = {
- level: "majority"
- };
+ var defaultReadConcern = {level: "majority"};
var originalDBQuery = DBQuery;
@@ -82,11 +80,19 @@
// These commands do writes but do not support a writeConcern argument. Emulate it with a
// getLastError command.
- var commandsToEmulateWriteConcern = ["createIndexes", ];
+ var commandsToEmulateWriteConcern = [
+ "createIndexes",
+ ];
// These are reading commands that support majority readConcern.
- var commandsToForceReadConcern =
- ["count", "distinct", "find", "geoNear", "geoSearch", "group", ];
+ var commandsToForceReadConcern = [
+ "count",
+ "distinct",
+ "find",
+ "geoNear",
+ "geoSearch",
+ "group",
+ ];
var forceWriteConcern = Array.contains(commandsToForceWriteConcern, cmdName);
var emulateWriteConcern = Array.contains(commandsToEmulateWriteConcern, cmdName);
diff --git a/jstests/libs/override_methods/sharding_continuous_config_stepdown.js b/jstests/libs/override_methods/sharding_continuous_config_stepdown.js
index aea3e482961..d0d2814fc90 100644
--- a/jstests/libs/override_methods/sharding_continuous_config_stepdown.js
+++ b/jstests/libs/override_methods/sharding_continuous_config_stepdown.js
@@ -106,16 +106,10 @@ function retryOnNetworkError(func) {
}
print('*** Continuous stepdown thread completed successfully');
- return {
- ok: 1
- };
+ return {ok: 1};
} catch (e) {
print('*** Continuous stepdown thread caught exception: ' + tojson(e));
- return {
- ok: 0,
- error: e.toString(),
- stack: e.stack
- };
+ return {ok: 0, error: e.toString(), stack: e.stack};
}
}
@@ -209,12 +203,12 @@ function retryOnNetworkError(func) {
// Set electionTimeoutMillis to 5 seconds, from 10, so that chunk migrations don't
// time out because of the CSRS primary being down so often for so long.
- arguments[0].configReplSetTestOptions = Object.merge(arguments[0].configReplSetTestOptions,
- {
- settings: {
- electionTimeoutMillis: 5000,
- },
- });
+ arguments[0].configReplSetTestOptions =
+ Object.merge(arguments[0].configReplSetTestOptions, {
+ settings: {
+ electionTimeoutMillis: 5000,
+ },
+ });
// Construct the original object
originalShardingTest.apply(this, arguments);
diff --git a/jstests/libs/test_background_ops.js b/jstests/libs/test_background_ops.js
index 384e0bd5b64..db2361d67c8 100644
--- a/jstests/libs/test_background_ops.js
+++ b/jstests/libs/test_background_ops.js
@@ -43,9 +43,7 @@ var waitForLock = function(mongo, name) {
};
// Return an object we can invoke unlock on
- return {
- unlock: unlock
- };
+ return {unlock: unlock};
};
/**
diff --git a/jstests/libs/trace_missing_docs.js b/jstests/libs/trace_missing_docs.js
index 3bc9ef75333..d0052f55f6f 100644
--- a/jstests/libs/trace_missing_docs.js
+++ b/jstests/libs/trace_missing_docs.js
@@ -23,12 +23,8 @@ function traceMissingDoc(coll, doc, mongos) {
if (doc[k] == undefined) {
jsTest.log("Shard key " + tojson(shardKey) + " not found in doc " + tojson(doc) +
", falling back to _id search...");
- shardKeyPatt = {
- _id: 1
- };
- shardKey = {
- _id: doc['_id']
- };
+ shardKeyPatt = {_id: 1};
+ shardKey = {_id: doc['_id']};
break;
}
shardKey[k] = doc[k];
@@ -70,9 +66,7 @@ function traceMissingDoc(coll, doc, mongos) {
// Find ops
addToOps(oplog.find(addKeyQuery({op: 'i'}, 'o')));
- var updateQuery = {
- $or: [addKeyQuery({op: 'u'}, 'o2'), {op: 'u', 'o2._id': doc['_id']}]
- };
+ var updateQuery = {$or: [addKeyQuery({op: 'u'}, 'o2'), {op: 'u', 'o2._id': doc['_id']}]};
addToOps(oplog.find(updateQuery));
addToOps(oplog.find({op: 'd', 'o._id': doc['_id']}));
}