@@ -239,39 +239,42 @@ function generateTopologyTests(testSuites, testContext) {
239
239
testSuites . forEach ( testSuite => {
240
240
const suiteName = testSuite . name ;
241
241
const topologies = parseTopologies ( testSuite . topology ) ;
242
- const minServerVersion = testSuite . minServerVersion
243
- ? `>=${ testSuite . minServerVersion } `
244
- : '>=3.7.x' ;
245
242
246
243
const tests = testSuite . tests ;
247
- describe ( suiteName , {
248
- metadata : { requires : { topology : topologies , mongodb : minServerVersion } } ,
249
- test : function ( ) {
250
- beforeEach ( ( ) => prepareDatabaseForSuite ( testSuite , testContext ) ) ;
251
- afterEach ( ( ) => testContext . cleanupAfterSuite ( ) ) ;
252
-
253
- tests . forEach ( spec => {
254
- const maybeSkipIt = shouldSkipTest ( spec ) ;
255
- maybeSkipIt ( spec . description , function ( ) {
256
- let testPromise = Promise . resolve ( ) ;
257
-
258
- if ( spec . failPoint ) {
259
- testPromise = testPromise . then ( ( ) => testContext . enableFailPoint ( spec . failPoint ) ) ;
260
- }
261
-
262
- // run the actual test
263
- testPromise = testPromise . then ( ( ) =>
264
- runTestSuiteTest ( this . configuration , spec , testContext )
265
- ) ;
266
-
267
- if ( spec . failPoint ) {
268
- testPromise = testPromise . then ( ( ) => testContext . disableFailPoint ( spec . failPoint ) ) ;
269
- }
270
-
271
- return testPromise . then ( ( ) => validateOutcome ( spec , testContext ) ) ;
244
+ topologies . forEach ( topology => {
245
+ const DEFAULT_MIN_SERVER_VERSION = topology === 'sharded' ? '>=4.1.5' : '>=3.7.x' ;
246
+ const minServerVersion = testSuite . minServerVersion
247
+ ? `>=${ testSuite . minServerVersion } `
248
+ : DEFAULT_MIN_SERVER_VERSION ;
249
+ describe ( `${ suiteName } - ${ topology } ` , {
250
+ metadata : { requires : { topology : [ topology ] , mongodb : minServerVersion } } ,
251
+ test : function ( ) {
252
+ beforeEach ( ( ) => prepareDatabaseForSuite ( testSuite , testContext ) ) ;
253
+ afterEach ( ( ) => testContext . cleanupAfterSuite ( ) ) ;
254
+
255
+ tests . forEach ( spec => {
256
+ const maybeSkipIt = shouldSkipTest ( spec ) ;
257
+ maybeSkipIt ( spec . description , function ( ) {
258
+ let testPromise = Promise . resolve ( ) ;
259
+
260
+ if ( spec . failPoint ) {
261
+ testPromise = testPromise . then ( ( ) => testContext . enableFailPoint ( spec . failPoint ) ) ;
262
+ }
263
+
264
+ // run the actual test
265
+ testPromise = testPromise . then ( ( ) =>
266
+ runTestSuiteTest ( this . configuration , spec , testContext )
267
+ ) ;
268
+
269
+ if ( spec . failPoint ) {
270
+ testPromise = testPromise . then ( ( ) => testContext . disableFailPoint ( spec . failPoint ) ) ;
271
+ }
272
+
273
+ return testPromise . then ( ( ) => validateOutcome ( spec , testContext ) ) ;
274
+ } ) ;
272
275
} ) ;
273
- } ) ;
274
- }
276
+ }
277
+ } ) ;
275
278
} ) ;
276
279
} ) ;
277
280
}
0 commit comments