@@ -104,23 +104,19 @@ function populatorGenerator(isView, nDocs, indices, docGenerator) {
104
104
* @param {function } [options.post=drop] - A function run after the test completes, intended to
105
105
* clean up any state on the server it may have created during setup or execution. If 'pipeline'
106
106
* uses more than one collection, this will need to drop the other collection(s) involved.
107
- * @param {Boolean } [options.noRegression=false] - If true, do not include this test in the
108
- * regression suite.
109
107
*/
110
108
function generateTestCase ( options ) {
111
109
var isView = true ; // Constant for use when calling populatorGenerator().
112
110
var nDocs = options . nDocs || 500 ;
113
111
var pipeline = options . pipeline ;
114
112
var tags = options . tags || [ ] ;
115
- if ( options . noRegression !== true ) {
116
- tags . push ( "regression" ) ;
117
- }
113
+
118
114
if ( pipeline . length > 0 && ! pipeline [ pipeline . length - 1 ] . hasOwnProperty ( "$out" ) ) {
119
115
pipeline . push ( { $skip : 1e9 } ) ;
120
116
}
121
117
122
118
tests . push ( {
123
- tags : [ "aggregation" ] . concat ( tags ) ,
119
+ tags : [ "aggregation" , "regression" ] . concat ( tags ) ,
124
120
name : "Aggregation." + options . name ,
125
121
pre : ( options . pre !== undefined ) ? options . pre ( ! isView ) : populatorGenerator ( ! isView ,
126
122
nDocs ,
@@ -142,7 +138,7 @@ function generateTestCase(options) {
142
138
]
143
139
} ) ;
144
140
tests . push ( {
145
- tags : [ "views" , "aggregation_identityview" ] . concat ( tags ) ,
141
+ tags : [ "views" , "aggregation_identityview" , "regression" ] . concat ( tags ) ,
146
142
name : "Aggregation.IdentityView." + options . name ,
147
143
pre : ( options . pre !== undefined ) ? options . pre ( isView ) : populatorGenerator ( isView ,
148
144
nDocs ,
@@ -759,12 +755,9 @@ generateTestCase({
759
755
760
756
generateTestCase ( {
761
757
name : "UnwindThenGroup" ,
762
- // TODO (PERF-805): When the throughput of this test has improved, re-tag it back into the
763
- // regression suite.
764
- noRegression : true ,
765
- docGenerator : function simpleUnwindDocGenerator ( i ) {
758
+ docGenerator : function simpleUnwindLargeDocGenerator ( i ) {
766
759
var largeArray = [ ] ;
767
- for ( var j = 0 ; j < 1000 ; j ++ ) {
760
+ for ( var j = 0 ; j < 50 ; j ++ ) {
768
761
largeArray . push ( getStringOfLength ( 10 ) + j ) ;
769
762
}
770
763
return {
@@ -775,3 +768,47 @@ generateTestCase({
775
768
} ,
776
769
pipeline : [ { $unwind : "$array" } , { $group : { _id : "$array" , count : { $sum : 1 } } } ]
777
770
} ) ;
771
+
772
+ generateTestCase ( {
773
+ name : "UnwindThenMatch" ,
774
+ docGenerator : function simpleUnwindAndMatchDocGenerator ( i ) {
775
+ var valArray = [ ] ;
776
+ for ( var j = 0 ; j < 30 ; j ++ ) {
777
+ valArray . push ( j % 10 ) ;
778
+ }
779
+ return {
780
+ _id : i ,
781
+ array : valArray ,
782
+ smallString : getStringOfLength ( 10 )
783
+ } ;
784
+ } ,
785
+ pipeline : [ { $unwind : "$array" } , { $match : { array : 5 } } ]
786
+ } ) ;
787
+
788
+ /**
789
+ * Data population function used by 'UnwindThenSort' and 'UnwindThenSkip' tests. Geared towards
790
+ * unwind tests that require/benefit from small documents.
791
+ */
792
+ function simpleSmallDocUnwindGenerator ( i ) {
793
+ var valArray = [ ] ;
794
+ for ( var j = 0 ; j < 10 ; j ++ ) {
795
+ valArray . push ( getStringOfLength ( 10 ) + j ) ;
796
+ }
797
+ return {
798
+ _id : i ,
799
+ array : valArray ,
800
+ smallString : getStringOfLength ( 10 )
801
+ } ;
802
+ }
803
+
804
+ generateTestCase ( {
805
+ name : "UnwindThenSort" ,
806
+ docGenerator : simpleSmallDocUnwindGenerator ,
807
+ pipeline : [ { $unwind : "$array" } , { $sort : { array : - 1 } } ]
808
+ } ) ;
809
+
810
+ generateTestCase ( {
811
+ name : "UnwindThenSkip" ,
812
+ docGenerator : simpleSmallDocUnwindGenerator ,
813
+ pipeline : [ { $unwind : "$array" } , { $skip : 10 } ]
814
+ } ) ;
0 commit comments