Files
mongo/jstests/concurrency/fsm_workloads/explain_aggregate.js
alabid f6a65290f2 SERVER-16648 Additional FSM-based concurrency workloads with some cleanup and blacklisting
Includes workloads for:
    explain
    compact
    reindex
    collMod
    count
    distinct
    touch
    $where
Added to blacklists in FSM runners
Fixed the way we check for storage engines
Added two options for arbitrary function execution against cluster:
    - Specified via ClusterOptions as setupFunctions to be run on the
      cluster before workloads are run
    - As part of setup and teardown with the cluster provided as a third
      argument to these workload functions
2015-02-05 16:14:37 -05:00

46 lines
1.6 KiB
JavaScript

'use strict';
/**
* explain_aggregate.js
*
* Runs explain() and aggregate() on a collection.
*
*/
load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload
load('jstests/concurrency/fsm_workloads/explain.js'); // for $config
var $config = extendWorkload($config, function($config, $super) {
function assertCursorStages(num, obj) {
assertAlways(obj.stages, tojson(obj));
assertAlways.eq(num, obj.stages.length, tojson(obj.stages));
assertAlways(obj.stages[0].$cursor, tojson(obj.stages[0]));
assertAlways(obj.stages[0].$cursor.hasOwnProperty('queryPlanner'),
tojson(obj.stages[0].$cursor));
}
$config.states = Object.extend({
explainMatch: function explainMatch(db, collName) {
var res = db[collName].explain().aggregate([{ $match: { i: this.nInserted / 2 } }]);
assertAlways.commandWorked(res);
// stages reported: $cursor
assertCursorStages(1, res);
},
explainMatchProject: function explainMatchProject(db, collName) {
var res = db[collName].explain().aggregate([{ $match: { i: this.nInserted / 3 } },
{ $project: { i: 1 } }]);
assertAlways.commandWorked(res);
// stages reported: $cursor, $project
assertCursorStages(2, res);
}
}, $super.states);
$config.transitions = Object.extend({
explain: $config.data.assignEqualProbsToTransitions($config.states)
}, $super.transitions);
return $config;
});