diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2016-05-28 17:55:12 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2016-05-28 17:55:12 -0400 |
commit | 6dcdd23dd37ef12c87e71cf59ef01cd82432efe0 (patch) | |
tree | c8cfb5acb62c80f375bc37e7d4350382deea6a37 /jstests/concurrency/fsm_workloads/yield_text.js | |
parent | d4ac5673ea3f6cef4ce9dbcec90e31813997a528 (diff) | |
download | mongo-6dcdd23dd37ef12c87e71cf59ef01cd82432efe0.tar.gz |
SERVER-23971 Clang-Format code
Diffstat (limited to 'jstests/concurrency/fsm_workloads/yield_text.js')
-rw-r--r-- | jstests/concurrency/fsm_workloads/yield_text.js | 73 |
1 files changed, 34 insertions, 39 deletions
diff --git a/jstests/concurrency/fsm_workloads/yield_text.js b/jstests/concurrency/fsm_workloads/yield_text.js index 9291c25e527..0ccf5b8a7d4 100644 --- a/jstests/concurrency/fsm_workloads/yield_text.js +++ b/jstests/concurrency/fsm_workloads/yield_text.js @@ -9,47 +9,42 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/yield.js'); // for $config -var $config = extendWorkload( - $config, - function($config, $super) { - - /* - * Pick a random word and search for it using full text search. - */ - $config.states.query = function text(db, collName) { - var word = this.words[Random.randInt(this.words.length)]; - - var cursor = db[collName].find({ - $text: {$search: word}, - yield_text: {$exists: true} - }).batchSize(this.batchSize); - - var verifier = function textVerifier(doc, prevDoc) { - return doc.yield_text.indexOf(word) !== -1; - }; - - // If we don't have the right text index, or someone drops our text index, this - // assertion - // is either pointless or won't work. So only verify the results when we know no one - // else - // is messing with our indices. - assertWhenOwnColl(function verifyTextResults() { - this.advanceCursor(cursor, verifier); - }.bind(this)); - }; +var $config = extendWorkload($config, function($config, $super) { - $config.data.genUpdateDoc = function genUpdateDoc() { - var newWord = this.words[Random.randInt(this.words.length)]; - return { - $set: {yield_text: newWord} - }; - }; + /* + * Pick a random word and search for it using full text search. + */ + $config.states.query = function text(db, collName) { + var word = this.words[Random.randInt(this.words.length)]; - $config.setup = function setup(db, collName, cluster) { - $super.setup.apply(this, arguments); + var cursor = db[collName] + .find({$text: {$search: word}, yield_text: {$exists: true}}) + .batchSize(this.batchSize); - assertWhenOwnColl.commandWorked(db[collName].ensureIndex({yield_text: 'text'})); + var verifier = function textVerifier(doc, prevDoc) { + return doc.yield_text.indexOf(word) !== -1; }; - return $config; - }); + // If we don't have the right text index, or someone drops our text index, this + // assertion + // is either pointless or won't work. So only verify the results when we know no one + // else + // is messing with our indices. + assertWhenOwnColl(function verifyTextResults() { + this.advanceCursor(cursor, verifier); + }.bind(this)); + }; + + $config.data.genUpdateDoc = function genUpdateDoc() { + var newWord = this.words[Random.randInt(this.words.length)]; + return {$set: {yield_text: newWord}}; + }; + + $config.setup = function setup(db, collName, cluster) { + $super.setup.apply(this, arguments); + + assertWhenOwnColl.commandWorked(db[collName].ensureIndex({yield_text: 'text'})); + }; + + return $config; +}); |