3
3
import { gte } from 'semver' ;
4
4
5
5
const path = require ( 'path' ) ;
6
- const { expect } = require ( 'chai' ) ;
7
- const { TestRunnerContext, generateTopologyTests } = require ( '../../tools/spec-runner' ) ;
8
6
const { runUnifiedSuite } = require ( '../../tools/unified-spec-runner/runner' ) ;
9
7
const { loadSpecTests } = require ( '../../spec' ) ;
10
8
11
- function ignoreNsNotFoundForListIndexes ( err ) {
12
- if ( err . code !== 26 ) {
13
- throw err ;
14
- }
15
-
16
- return [ ] ;
17
- }
18
-
19
- class TransactionsRunnerContext extends TestRunnerContext {
20
- assertCollectionExists ( options ) {
21
- const client = this . sharedClient ;
22
- const db = client . db ( options . database ) ;
23
- const collectionName = options . collection ;
24
-
25
- return db
26
- . listCollections ( )
27
- . toArray ( )
28
- . then ( collections => expect ( collections . some ( coll => coll . name === collectionName ) ) . to . be . ok ) ;
29
- }
30
-
31
- assertCollectionNotExists ( options ) {
32
- const client = this . sharedClient ;
33
- const db = client . db ( options . database ) ;
34
- const collectionName = options . collection ;
35
-
36
- return db
37
- . listCollections ( )
38
- . toArray ( )
39
- . then (
40
- collections => expect ( collections . every ( coll => coll . name !== collectionName ) ) . to . be . ok
41
- ) ;
42
- }
43
-
44
- assertIndexExists ( options ) {
45
- const client = this . sharedClient ;
46
- const collection = client . db ( options . database ) . collection ( options . collection ) ;
47
- const indexName = options . index ;
48
-
49
- return collection
50
- . listIndexes ( )
51
- . toArray ( )
52
- . catch ( ignoreNsNotFoundForListIndexes )
53
- . then ( indexes => expect ( indexes . some ( idx => idx . name === indexName ) ) . to . be . ok ) ;
54
- }
55
-
56
- assertIndexNotExists ( options ) {
57
- const client = this . sharedClient ;
58
- const collection = client . db ( options . database ) . collection ( options . collection ) ;
59
- const indexName = options . index ;
60
-
61
- return collection
62
- . listIndexes ( )
63
- . toArray ( )
64
- . catch ( ignoreNsNotFoundForListIndexes )
65
- . then ( indexes => expect ( indexes . every ( idx => idx . name !== indexName ) ) . to . be . ok ) ;
66
- }
67
-
68
- assertSessionPinned ( options ) {
69
- expect ( options ) . to . have . property ( 'session' ) ;
70
-
71
- const session = options . session ;
72
- expect ( session . isPinned ) . to . be . true ;
73
- }
74
-
75
- assertSessionUnpinned ( options ) {
76
- expect ( options ) . to . have . property ( 'session' ) ;
77
-
78
- const session = options . session ;
79
- expect ( session . isPinned ) . to . be . false ;
80
- }
81
- }
82
-
83
9
const LATEST_UNIFIED_SKIP_TESTS = [
84
10
'unpin after TransientTransactionError error on commit' ,
85
11
'unpin on successful abort' ,
@@ -98,40 +24,36 @@ describe('Transactions Spec Unified Tests', function () {
98
24
) ;
99
25
} ) ;
100
26
101
- const LEGACY_SKIP_TESTS = [
102
- // TODO(NODE-3943): Investigate these commit test failures
103
- // OLD COMMENT: commitTransaction retry seems to be swallowed by mongos in these two cases
104
- 'commitTransaction retry fails on new mongos' ,
105
- 'unpin after transient error within a transaction and commit' ,
106
-
107
- // TODO(NODE-2034): Will be implemented as part of NODE-2034
108
- 'Client side error in command starting transaction' ,
109
- 'Client side error when transaction is in progress'
110
- ] ;
111
-
112
- describe ( 'Transactions Spec Legacy Tests' , function ( ) {
113
- const testContext = new TransactionsRunnerContext ( ) ;
114
- if ( process . env . SERVERLESS ) {
115
- // TODO(NODE-3550): these tests should pass on serverless but currently fail
116
- LEGACY_SKIP_TESTS . push (
117
- 'abortTransaction only performs a single retry' ,
118
- 'abortTransaction does not retry after Interrupted' ,
119
- 'abortTransaction does not retry after WriteConcernError Interrupted' ,
120
- 'commitTransaction does not retry error without RetryableWriteError label' ,
121
- 'commitTransaction is not retried after UnsatisfiableWriteConcern error' ,
122
- 'commitTransaction fails after Interrupted'
123
- ) ;
124
- }
125
-
126
- const testSuites = loadSpecTests ( path . join ( 'transactions' , 'legacy' ) ) ;
127
- after ( ( ) => testContext . teardown ( ) ) ;
128
- before ( function ( ) {
129
- return testContext . setup ( this . configuration ) ;
130
- } ) ;
131
-
132
- function testFilter ( spec ) {
133
- return LEGACY_SKIP_TESTS . indexOf ( spec . description ) === - 1 ;
134
- }
135
-
136
- generateTopologyTests ( testSuites , testContext , testFilter ) ;
137
- } ) ;
27
+ // const LEGACY_SKIP_TESTS = [
28
+ // // TODO(NODE-3943): Investigate these commit test failures
29
+ // // OLD COMMENT: commitTransaction retry seems to be swallowed by mongos in these two cases
30
+ // 'commitTransaction retry fails on new mongos',
31
+ // 'unpin after transient error within a transaction and commit',
32
+ // // TODO(NODE-2034): Will be implemented as part of NODE-2034
33
+ // 'Client side error in command starting transaction',
34
+ // 'Client side error when transaction is in progress'
35
+ // ];
36
+
37
+ // describe('Transactions Spec Legacy Tests', function () {
38
+ // const testContext = new TransactionsRunnerContext();
39
+ // if (process.env.SERVERLESS) {
40
+ // // TODO(NODE-3550): these tests should pass on serverless but currently fail
41
+ // LEGACY_SKIP_TESTS.push(
42
+ // 'abortTransaction only performs a single retry',
43
+ // 'abortTransaction does not retry after Interrupted',
44
+ // 'abortTransaction does not retry after WriteConcernError Interrupted',
45
+ // 'commitTransaction does not retry error without RetryableWriteError label',
46
+ // 'commitTransaction is not retried after UnsatisfiableWriteConcern error',
47
+ // 'commitTransaction fails after Interrupted'
48
+ // );
49
+ // }
50
+ // const testSuites = loadSpecTests(path.join('transactions', 'legacy'));
51
+ // after(() => testContext.teardown());
52
+ // before(function () {
53
+ // return testContext.setup(this.configuration);
54
+ // });
55
+ // function testFilter(spec) {
56
+ // return LEGACY_SKIP_TESTS.indexOf(spec.description) === -1;
57
+ // }
58
+ // generateTopologyTests(testSuites, testContext, testFilter);
59
+ // });
0 commit comments