Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
dalyd committed Jan 3, 2017
2 parents 94fb5bb + 0ff14b3 commit f6a3ccb
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 26 deletions.
61 changes: 49 additions & 12 deletions testcases/pipelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,19 @@ function populatorGenerator(isView, nDocs, indices, docGenerator) {
* @param {function} [options.post=drop] - A function run after the test completes, intended to
* clean up any state on the server it may have created during setup or execution. If 'pipeline'
* uses more than one collection, this will need to drop the other collection(s) involved.
* @param {Boolean} [options.noRegression=false] - If true, do not include this test in the
* regression suite.
*/
function generateTestCase(options) {
var isView = true; // Constant for use when calling populatorGenerator().
var nDocs = options.nDocs || 500;
var pipeline = options.pipeline;
var tags = options.tags || [];
if (options.noRegression !== true) {
tags.push("regression");
}

if (pipeline.length > 0 && !pipeline[pipeline.length - 1].hasOwnProperty("$out")) {
pipeline.push({$skip: 1e9});
}

tests.push({
tags: ["aggregation"].concat(tags),
tags: ["aggregation", "regression"].concat(tags),
name: "Aggregation." + options.name,
pre: (options.pre !== undefined) ? options.pre(!isView) : populatorGenerator(!isView,
nDocs,
Expand All @@ -142,7 +138,7 @@ function generateTestCase(options) {
]
});
tests.push({
tags: ["views", "aggregation_identityview"].concat(tags),
tags: ["views", "aggregation_identityview", "regression"].concat(tags),
name: "Aggregation.IdentityView." + options.name,
pre: (options.pre !== undefined) ? options.pre(isView) : populatorGenerator(isView,
nDocs,
Expand Down Expand Up @@ -759,12 +755,9 @@ generateTestCase({

generateTestCase({
name: "UnwindThenGroup",
// TODO (PERF-805): When the throughput of this test has improved, re-tag it back into the
// regression suite.
noRegression: true,
docGenerator: function simpleUnwindDocGenerator(i) {
docGenerator: function simpleUnwindLargeDocGenerator(i) {
var largeArray = [];
for (var j = 0; j < 1000; j++) {
for (var j = 0; j < 50; j++) {
largeArray.push(getStringOfLength(10) + j);
}
return {
Expand All @@ -775,3 +768,47 @@ generateTestCase({
},
pipeline: [{$unwind: "$array"}, {$group: {_id: "$array", count: {$sum: 1}}}]
});

generateTestCase({
name: "UnwindThenMatch",
docGenerator: function simpleUnwindAndMatchDocGenerator(i) {
var valArray = [];
for (var j = 0; j < 30; j++) {
valArray.push(j%10);
}
return {
_id: i,
array: valArray,
smallString: getStringOfLength(10)
};
},
pipeline: [{$unwind: "$array"}, {$match: {array: 5}}]
});

/**
* Data population function used by 'UnwindThenSort' and 'UnwindThenSkip' tests. Geared towards
* unwind tests that require/benefit from small documents.
*/
function simpleSmallDocUnwindGenerator(i) {
var valArray = [];
for (var j = 0; j < 10; j++) {
valArray.push(getStringOfLength(10) + j);
}
return {
_id: i,
array: valArray,
smallString: getStringOfLength(10)
};
}

generateTestCase({
name: "UnwindThenSort",
docGenerator: simpleSmallDocUnwindGenerator,
pipeline: [{$unwind: "$array"}, {$sort: {array: -1}}]
});

generateTestCase({
name: "UnwindThenSkip",
docGenerator: simpleSmallDocUnwindGenerator,
pipeline: [{$unwind: "$array"}, {$skip: 10}]
});
29 changes: 15 additions & 14 deletions testcases/simple_insert.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,6 @@ var docs = []
for (var i = 0; i < batchSize; i++) {
docs.push(doc)
}
/*
* Setup:
* Test: Insert a vector of large documents. Each document contains a long string
* Notes: Generates the _id field on the client
*
*/
tests.push( { name: "Insert.LargeDocVector",
tags: ['insert','regression'],
pre: function( collection ) { collection.drop(); },
ops: [
{ op: "insert",
doc: docs }
] } );



/*
Expand Down Expand Up @@ -259,3 +245,18 @@ tests.push( { name: "InsertIndexedStringsNonSimpleCollation",
ops: [
{ op: "insert", doc: { a: { "#RAND_STRING": [10] } } }
] } );

/*
* Setup:
* Test: Insert a vector of large documents. Each document contains a long string
* Notes: Generates the _id field on the client
*
*/
tests.push( { name: "Insert.LargeDocVector",
tags: ['insert','regression'],
pre: function( collection ) { collection.drop(); },
ops: [
{ op: "insert",
doc: docs }
] } );

0 comments on commit f6a3ccb

Please sign in to comment.