Skip to content

Commit 45db8c0

Browse files
committed
test(NODE-7508): Fix inconsistent wording for prose retryable writes test 6, case 3
1 parent b2cb05e commit 45db8c0

1 file changed

Lines changed: 24 additions & 19 deletions

File tree

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

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -239,38 +239,40 @@ describe('Retryable Writes Spec Prose', () => {
239239
* Additionally, this test requires drivers to set a fail point after an insertOne operation but before the subsequent retry.
240240
* Drivers that are unable to set a failCommand after the CommandSucceededEvent SHOULD use mocking or write a unit test to cover the same sequence of events.
241241
*
242-
* Create a client with retryWrites=true.
242+
* 1. Create a client with retryWrites=true.
243243
*
244-
* Configure a fail point with error code 91 (ShutdownInProgress):
244+
* 2. Configure a fail point with error code `91` (ShutdownInProgress) with the `RetryableError` and
245+
* `SystemOverloadedError` error labels:
245246
* ```js
246247
* db.adminCommand({
247248
* configureFailPoint: 'failCommand',
248249
* mode: { times: 1 },
249250
* data: {
250-
* writeConcernError: {
251-
* code: 91,
252-
* errorLabels: ['RetryableWriteError']
253-
* },
254251
* failCommands: ['insert']
252+
* errorLabels: ['RetryableError', 'SystemOverloadedError'],
253+
* errorCode: 91,
255254
* }
256255
* });
257256
* ```
258-
* Via the command monitoring CommandSucceededEvent, configure a fail point with error code 10107 (NotWritablePrimary) and a NoWritesPerformed label:
257+
*
258+
* 3. Via the command monitoring CommandSucceededEvent, configure a fail point with error code `91` (ShutdownInProgress) and
259+
* the `NoWritesPerformed`, `RetryableError` and `SystemOverloadedError` labels:
259260
*
260261
* ```js
261262
* db.adminCommand({
262263
* configureFailPoint: 'failCommand',
263-
* mode: { times: 1 },
264+
* mode: 'alwaysOn',
264265
* data: {
265-
* errorCode: 10107,
266-
* errorLabels: ['RetryableWriteError', 'NoWritesPerformed'],
267266
* failCommands: ['insert']
267+
* errorLabels: [ 'RetryableError', 'SystemOverloadedError', 'NoWritesPerformed'],
268+
* errorCode: 91,
268269
* }
269270
* });
270271
* ```
271-
* Drivers SHOULD only configure the 10107 fail point command if the the succeeded event is for the 91 error configured in step 2.
272+
*
273+
* Drivers SHOULD configure the second fail point command only if the event is for the first error configured in step 2.
272274
*
273-
* Attempt an insertOne operation on any record for any database and collection. For the resulting error, assert that the associated error code is 91.
275+
* 4. Attempt an insertOne operation on any record for any database and collection. For the resulting error, assert that the associated error code is 91.
274276
*/
275277
it(
276278
'when a retry attempt fails with an error labeled NoWritesPerformed, drivers MUST return the original error',
@@ -279,16 +281,19 @@ describe('Retryable Writes Spec Prose', () => {
279281
const serverCommandStub = sinon.stub(Server.prototype, 'command');
280282
serverCommandStub.onCall(0).rejects(
281283
new MongoWriteConcernError({
282-
errorLabels: ['RetryableWriteError'],
284+
// errorLabels: ['RetryableError', 'SystemOverloadedError'], // expected changes, tests fail
285+
errorLabels: ['RetryableWriteError'], // original, tests pass
283286
writeConcernError: { errmsg: 'ShutdownInProgress error', code: 91 },
284287
ok: 1
285288
})
286289
);
287290
serverCommandStub.onCall(1).returns(
288291
Promise.reject(
289292
new MongoWriteConcernError({
290-
errorLabels: ['RetryableWriteError', 'NoWritesPerformed'],
291-
writeConcernError: { errmsg: 'NotWritablePrimary error', errorCode: 10107 }
293+
errorLabels: ['RetryableWriteError', 'NoWritesPerformed'], // original, tests pass
294+
// errorLabels: ['RetryableError', 'SystemOverloadedError', 'NoWritesPerformed'], // expected changes, tests fail
295+
writeConcernError: { errmsg: 'NotWritablePrimary error', code: 91 }, // my changes
296+
ok: 1
292297
})
293298
)
294299
);
@@ -526,10 +531,10 @@ describe('Retryable Writes Spec Prose', () => {
526531
serverCommandStub.callCount === 1
527532
? [MongoErrorLabel.RetryableError, MongoErrorLabel.SystemOverloadedError]
528533
: [
529-
MongoErrorLabel.RetryableError,
530-
MongoErrorLabel.SystemOverloadedError,
531-
MongoErrorLabel.NoWritesPerformed
532-
];
534+
MongoErrorLabel.RetryableError,
535+
MongoErrorLabel.SystemOverloadedError,
536+
MongoErrorLabel.NoWritesPerformed
537+
];
533538

534539
throw new MongoServerError({
535540
message: 'Server Error',

0 commit comments

Comments
 (0)