11import { expect } from 'chai' ;
22import * as path from 'path' ;
3- import { lt } from 'semver' ;
43
54import type { Collection , Db , MongoClient } from '../../mongodb' ;
65import { loadSpecTests } from '../../spec' ;
@@ -20,26 +19,8 @@ describe('Legacy Retryable Writes Specs', function () {
2019
2120 const retryableWrites = loadSpecTests ( 'retryable-writes' , 'legacy' ) ;
2221
23- const LEGACY_SKIP_TESTS_4_4_SHARDED = [
24- 'BulkWrite succeeds after WriteConcernError ShutdownInProgress' ,
25- 'DeleteOne succeeds after WriteConcernError ShutdownInProgress' ,
26- 'FindOneAndDelete succeeds after WriteConcernError ShutdownInProgress' ,
27- 'FindOneAndReplace succeeds after WriteConcernError ShutdownInProgress' ,
28- 'FindOneAndUpdate succeeds after WriteConcernError ShutdownInProgress' ,
29- 'InsertMany succeeds after WriteConcernError ShutdownInProgress' ,
30- 'InsertOne succeeds after WriteConcernError InterruptedAtShutdown' ,
31- 'InsertOne succeeds after WriteConcernError InterruptedDueToReplStateChange' ,
32- 'InsertOne succeeds after WriteConcernError PrimarySteppedDown' ,
33- 'InsertOne succeeds after WriteConcernError ShutdownInProgress' ,
34- 'InsertOne fails after multiple retryable writeConcernErrors' ,
35- 'ReplaceOne succeeds after WriteConcernError ShutdownInProgress' ,
36- 'UpdateOne succeeds after WriteConcernError ShutdownInProgress'
37- ] ;
38-
3922 for ( const suite of retryableWrites ) {
4023 describe ( suite . name , function ( ) {
41- let isShardedAndBefore4_4 = false ;
42-
4324 beforeEach ( async function ( ) {
4425 let utilClient : MongoClient ;
4526 if ( this . configuration . isLoadBalanced ) {
@@ -57,9 +38,6 @@ describe('Legacy Retryable Writes Specs', function () {
5738 ! allRequirements . length ||
5839 ( await isAnyRequirementSatisfied ( this . currentTest . ctx , allRequirements , utilClient ) ) ;
5940
60- isShardedAndBefore4_4 =
61- this . configuration . topologyType === 'Sharded' && lt ( this . configuration . version , '4.4.0' ) ;
62-
6341 await utilClient . close ( ) ;
6442
6543 if ( ! someRequirementMet ) this . skip ( ) ;
@@ -86,16 +64,14 @@ describe('Legacy Retryable Writes Specs', function () {
8664 ctx = { } ; // reset context
8765 } ) ;
8866 for ( const spec of suite . tests ) {
89- if ( ! LEGACY_SKIP_TESTS_4_4_SHARDED . includes ( spec . description ) && ! isShardedAndBefore4_4 ) {
90- // Step 2: Run the test
91- const mochaTest = it ( spec . description , async ( ) => await executeScenarioTest ( spec , ctx ) ) ;
92-
93- // A pattern we don't need to repeat for unified tests
94- // In order to give the beforeEach hook access to the
95- // spec test so it can be responsible for skipping it
96- // and executeScenarioSetup
97- mochaTest . spec = spec ;
98- }
67+ // Step 2: Run the test
68+ const mochaTest = it ( spec . description , async ( ) => await executeScenarioTest ( spec , ctx ) ) ;
69+
70+ // A pattern we don't need to repeat for unified tests
71+ // In order to give the beforeEach hook access to the
72+ // spec test so it can be responsible for skipping it
73+ // and executeScenarioSetup
74+ mochaTest . spec = spec ;
9975 }
10076 } ) ;
10177 }
0 commit comments