Skip to content

Commit 126abd9

Browse files
committed
test: fix tests
1 parent a421e3d commit 126abd9

File tree

7 files changed

+33
-40
lines changed

7 files changed

+33
-40
lines changed

test/integration/transactions/transactions.spec.test.js

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,18 @@ const path = require('path');
66
const { runUnifiedSuite } = require('../../tools/unified-spec-runner/runner');
77
const { loadSpecTests } = require('../../spec');
88

9-
const LATEST_UNIFIED_SKIP_TESTS = [
10-
'unpin after TransientTransactionError error on commit',
11-
'unpin on successful abort',
12-
'unpin after non-transient error on abort',
13-
'unpin after TransientTransactionError error on abort',
14-
'unpin when a new transaction is started',
15-
'unpin when a non-transaction write operation uses a session',
16-
'unpin when a non-transaction read operation uses a session',
17-
'abortTransaction only performs a single retry',
18-
'abortTransaction does not retry after Interrupted',
19-
'abortTransaction does not retry after WriteConcernError Interrupted',
20-
'commitTransaction does not retry error without RetryableWriteError label',
21-
'commitTransaction is not retried after UnsatisfiableWriteConcern error',
22-
'commitTransaction fails after Interrupted'
23-
];
9+
// const LATEST_UNIFIED_SKIP_TESTS = [
10+
// 'unpin after TransientTransactionError error on commit',
11+
// 'unpin on successful abort',
12+
// 'unpin after non-transient error on abort',
13+
// 'unpin after TransientTransactionError error on abort',
14+
// 'unpin when a new transaction is started',
15+
// 'unpin when a non-transaction write operation uses a session',
16+
// 'unpin when a non-transaction read operation uses a session'
17+
// ];
2418

25-
describe('Transactions Spec Unified Tests', function () {
26-
runUnifiedSuite(loadSpecTests(path.join('transactions', 'unified')), (test, ctx) =>
27-
gte(ctx.version, '8.0.0') && LATEST_UNIFIED_SKIP_TESTS.includes(test.description)
28-
? 'TODO(NODE-5855): Unskip Transactions Spec Unified Tests mongos-unpin.unpin'
29-
: false
30-
);
19+
describe.only('Transactions Spec Unified Tests', function () {
20+
runUnifiedSuite(loadSpecTests(path.join('transactions', 'unified')));
3121
});
3222

3323
// const LEGACY_SKIP_TESTS = [

test/spec/transactions/unified/read-pref.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217
"name": "startTransaction",
218218
"arguments": {
219219
"readPreference": {
220-
"mode": "Primary"
220+
"mode": "primary"
221221
}
222222
}
223223
},
@@ -362,7 +362,7 @@
362362
"name": "startTransaction",
363363
"arguments": {
364364
"readPreference": {
365-
"mode": "Secondary"
365+
"mode": "secondary"
366366
}
367367
}
368368
},
@@ -470,7 +470,7 @@
470470
"name": "startTransaction",
471471
"arguments": {
472472
"readPreference": {
473-
"mode": "PrimaryPreferred"
473+
"mode": "primaryPreferred"
474474
}
475475
}
476476
},
@@ -578,7 +578,7 @@
578578
"name": "startTransaction",
579579
"arguments": {
580580
"readPreference": {
581-
"mode": "Nearest"
581+
"mode": "nearest"
582582
}
583583
}
584584
},
@@ -686,7 +686,7 @@
686686
"name": "startTransaction",
687687
"arguments": {
688688
"readPreference": {
689-
"mode": "Secondary"
689+
"mode": "secondary"
690690
}
691691
}
692692
},

test/spec/transactions/unified/read-pref.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ tests:
120120
name: startTransaction
121121
arguments:
122122
readPreference:
123-
mode: Primary
123+
mode: primary
124124
-
125125
object: *collection0
126126
name: insertMany
@@ -182,7 +182,7 @@ tests:
182182
name: startTransaction
183183
arguments:
184184
readPreference:
185-
mode: Secondary
185+
mode: secondary
186186
-
187187
object: *collection0
188188
name: insertMany
@@ -246,7 +246,7 @@ tests:
246246
name: startTransaction
247247
arguments:
248248
readPreference:
249-
mode: PrimaryPreferred
249+
mode: primaryPreferred
250250
-
251251
object: *collection0
252252
name: insertMany
@@ -374,7 +374,7 @@ tests:
374374
name: startTransaction
375375
arguments:
376376
readPreference:
377-
mode: Secondary
377+
mode: secondary
378378
-
379379
object: *collection0
380380
name: insertOne

test/spec/transactions/unified/run-command.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
"name": "startTransaction",
186186
"arguments": {
187187
"readPreference": {
188-
"mode": "Primary"
188+
"mode": "primary"
189189
}
190190
}
191191
},
@@ -292,7 +292,7 @@
292292
]
293293
},
294294
"readPreference": {
295-
"mode": "Primary"
295+
"mode": "primary"
296296
},
297297
"commandName": "insert"
298298
},
@@ -379,7 +379,7 @@
379379
"find": "test"
380380
},
381381
"readPreference": {
382-
"mode": "Secondary"
382+
"mode": "secondary"
383383
},
384384
"commandName": "find"
385385
},
@@ -397,7 +397,7 @@
397397
"name": "startTransaction",
398398
"arguments": {
399399
"readPreference": {
400-
"mode": "Secondary"
400+
"mode": "secondary"
401401
}
402402
}
403403
},

test/spec/transactions/unified/run-command.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ tests:
118118
name: startTransaction
119119
arguments:
120120
readPreference:
121-
mode: Primary
121+
mode: primary
122122
-
123123
object: *database1
124124
name: runCommand
@@ -179,7 +179,7 @@ tests:
179179
documents:
180180
- { _id: 1 }
181181
readPreference:
182-
mode: Primary
182+
mode: primary
183183
commandName: insert
184184
expectResult:
185185
'n': 1
@@ -229,7 +229,7 @@ tests:
229229
command:
230230
find: *collection_name
231231
readPreference:
232-
mode: Secondary
232+
mode: secondary
233233
commandName: find
234234
expectError:
235235
errorContains: 'read preference in a transaction must be primary'
@@ -241,7 +241,7 @@ tests:
241241
name: startTransaction
242242
arguments:
243243
readPreference:
244-
mode: Secondary
244+
mode: secondary
245245
-
246246
object: *database0
247247
name: runCommand

test/tools/unified-spec-runner/match.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,9 @@ export function expectErrorCheck(
735735
}
736736

737737
if (expected.errorContains != null) {
738-
expect(error.message, expectMessage).to.include(expected.errorContains);
738+
expect(error.message.toLowerCase(), expectMessage.toLowerCase()).to.include(
739+
expected.errorContains.toLowerCase()
740+
);
739741
}
740742

741743
if (expected.errorCode != null) {

test/tools/unified-spec-runner/operations.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,8 @@ operations.set('replaceOne', async ({ entities, operation }) => {
497497

498498
operations.set('startTransaction', async ({ entities, operation }) => {
499499
const session = entities.getEntity('session', operation.object);
500-
session.startTransaction();
500+
// TODO: Legacy tests use Secondary, unified secondary.
501+
session.startTransaction(operation.arguments);
501502
});
502503

503504
operations.set('targetedFailPoint', async ({ entities, operation }) => {

0 commit comments

Comments
 (0)