Skip to content

Commit 05e6450

Browse files
remove skips
1 parent 1003a7f commit 05e6450

File tree

2 files changed

+10
-36
lines changed

2 files changed

+10
-36
lines changed

src/error.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,10 +1240,8 @@ export function needsRetryableWriteLabel(
12401240
}
12411241
}
12421242

1243-
if (error instanceof MongoWriteConcernError) {
1244-
return isSharded && maxWireVersion < 9
1245-
? false
1246-
: RETRYABLE_WRITE_ERROR_CODES.has(error.result?.code ?? error.code ?? 0);
1243+
if (error instanceof MongoWriteConcernError && !isSharded && maxWireVersion >= 9) {
1244+
return RETRYABLE_WRITE_ERROR_CODES.has(error.result?.code ?? error.code ?? 0);
12471245
}
12481246

12491247
if (error instanceof MongoError && typeof error.code === 'number') {

test/integration/retryable-writes/retryable_writes.spec.test.ts

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { expect } from 'chai';
22
import * as path from 'path';
3-
import { lt } from 'semver';
43

54
import type { Collection, Db, MongoClient } from '../../mongodb';
65
import { 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

Comments
 (0)