@@ -115,8 +115,22 @@ describe('Transactions (spec)', function() {
115
115
const maybeSkipIt = testData . skipReason ? it . skip : it ;
116
116
maybeSkipIt ( testData . description , function ( ) {
117
117
let testPromise = Promise . resolve ( ) ;
118
+
119
+ if ( testData . failPoint ) {
120
+ testPromise = testPromise . then ( ( ) =>
121
+ enableFailPoint ( testData . failPoint , testContext )
122
+ ) ;
123
+ }
124
+
125
+ // run the actual test
118
126
testPromise = testPromise . then ( ( ) => runTestSuiteTest ( testData , testContext ) ) ;
119
127
128
+ if ( testData . failPoint ) {
129
+ testPromise = testPromise . then ( ( ) =>
130
+ disableFailPoint ( testData . failPoint , testContext )
131
+ ) ;
132
+ }
133
+
120
134
return testPromise ;
121
135
} ) ;
122
136
} ) ;
@@ -154,6 +168,17 @@ function cleanupAfterSuite(context) {
154
168
}
155
169
}
156
170
171
+ function enableFailPoint ( failPoint , testContext ) {
172
+ return testContext . sharedClient . db ( testContext . dbName ) . executeDbAdminCommand ( failPoint ) ;
173
+ }
174
+
175
+ function disableFailPoint ( failPoint , testContext ) {
176
+ return testContext . sharedClient . db ( testContext . dbName ) . executeDbAdminCommand ( {
177
+ configureFailPoint : failPoint . configureFailPoint ,
178
+ mode : 'off'
179
+ } ) ;
180
+ }
181
+
157
182
let displayCommands = false ;
158
183
function runTestSuiteTest ( testData , context ) {
159
184
const commandEvents = [ ] ;
0 commit comments