@@ -19,6 +19,22 @@ describe('Legacy Retryable Writes Specs', function () {
19
19
20
20
const retryableWrites = loadSpecTests ( 'retryable-writes' , 'legacy' ) ;
21
21
22
+ const LEGACY_SKIP_TESTS_4_4_SHARDED = [
23
+ 'BulkWrite succeeds after WriteConcernError ShutdownInProgress' ,
24
+ 'DeleteOne succeeds after WriteConcernError ShutdownInProgress' ,
25
+ 'FindOneAndDelete succeeds after WriteConcernError ShutdownInProgress' ,
26
+ 'FindOneAndReplace succeeds after WriteConcernError ShutdownInProgress' ,
27
+ 'FindOneAndUpdate succeeds after WriteConcernError ShutdownInProgress' ,
28
+ 'InsertMany succeeds after WriteConcernError ShutdownInProgress' ,
29
+ 'InsertOne succeeds after WriteConcernError InterruptedAtShutdown' ,
30
+ 'InsertOne succeeds after WriteConcernError InterruptedDueToReplStateChange' ,
31
+ 'InsertOne succeeds after WriteConcernError PrimarySteppedDown' ,
32
+ 'InsertOne succeeds after WriteConcernError ShutdownInProgress' ,
33
+ 'InsertOne fails after multiple retryable writeConcernErrors' ,
34
+ 'ReplaceOne succeeds after WriteConcernError ShutdownInProgress' ,
35
+ 'UpdateOne succeeds after WriteConcernError ShutdownInProgress'
36
+ ] ;
37
+
22
38
for ( const suite of retryableWrites ) {
23
39
describe ( suite . name , function ( ) {
24
40
beforeEach ( async function ( ) {
@@ -65,14 +81,24 @@ describe('Legacy Retryable Writes Specs', function () {
65
81
} ) ;
66
82
67
83
for ( const spec of suite . tests ) {
68
- // Step 2: Run the test
69
- const mochaTest = it ( spec . description , async ( ) => await executeScenarioTest ( spec , ctx ) ) ;
70
-
71
- // A pattern we don't need to repeat for unified tests
72
- // In order to give the beforeEach hook access to the
73
- // spec test so it can be responsible for skipping it
74
- // and executeScenarioSetup
75
- mochaTest . spec = spec ;
84
+ if (
85
+ LEGACY_SKIP_TESTS_4_4_SHARDED . includes ( spec . description ) &&
86
+ this . ctx . topologyType === 'Sharded' &&
87
+ Number ( this . ctx . version ) <= 4.4
88
+ ) {
89
+ this . ctx . skipReason =
90
+ 'drivers should not consider the code within the writeConcernError field from a pre-4.4 mongos response' ;
91
+ this . ctx . skip ( ) ;
92
+ } else {
93
+ // Step 2: Run the test
94
+ const mochaTest = it ( spec . description , async ( ) => await executeScenarioTest ( spec , ctx ) ) ;
95
+
96
+ // A pattern we don't need to repeat for unified tests
97
+ // In order to give the beforeEach hook access to the
98
+ // spec test so it can be responsible for skipping it
99
+ // and executeScenarioSetup
100
+ mochaTest . spec = spec ;
101
+ }
76
102
}
77
103
} ) ;
78
104
}
0 commit comments