1
1
import { expect } from 'chai' ;
2
2
import * as path from 'path' ;
3
+ import { lt } from 'semver' ;
3
4
4
5
import type { Collection , Db , MongoClient } from '../../mongodb' ;
5
6
import { loadSpecTests } from '../../spec' ;
@@ -37,6 +38,8 @@ describe('Legacy Retryable Writes Specs', function () {
37
38
38
39
for ( const suite of retryableWrites ) {
39
40
describe ( suite . name , function ( ) {
41
+ let isShardedAndBefore4_4 = false ;
42
+
40
43
beforeEach ( async function ( ) {
41
44
let utilClient : MongoClient ;
42
45
if ( this . configuration . isLoadBalanced ) {
@@ -54,6 +57,9 @@ describe('Legacy Retryable Writes Specs', function () {
54
57
! allRequirements . length ||
55
58
( await isAnyRequirementSatisfied ( this . currentTest . ctx , allRequirements , utilClient ) ) ;
56
59
60
+ isShardedAndBefore4_4 =
61
+ this . configuration . topologyType === 'Sharded' && lt ( this . configuration . version , '4.4.0' ) ;
62
+
57
63
await utilClient . close ( ) ;
58
64
59
65
if ( ! someRequirementMet ) this . skip ( ) ;
@@ -80,7 +86,7 @@ describe('Legacy Retryable Writes Specs', function () {
80
86
ctx = { } ; // reset context
81
87
} ) ;
82
88
for ( const spec of suite . tests ) {
83
- if ( ! LEGACY_SKIP_TESTS_4_4_SHARDED . includes ( spec . description ) ) {
89
+ if ( ! LEGACY_SKIP_TESTS_4_4_SHARDED . includes ( spec . description ) && ! isShardedAndBefore4_4 ) {
84
90
// Step 2: Run the test
85
91
const mochaTest = it ( spec . description , async ( ) => await executeScenarioTest ( spec , ctx ) ) ;
86
92
0 commit comments