diff options
author | Jack Mulrow <jack.mulrow@mongodb.com> | 2019-04-12 16:26:24 -0400 |
---|---|---|
committer | Jack Mulrow <jack.mulrow@mongodb.com> | 2019-04-15 21:50:28 -0400 |
commit | 1406a964675363577a23ca69a4056d8726fed820 (patch) | |
tree | b6dd4926ced4c982d5826f81134eb5bf2685ceda /jstests/sharding/transactions_writes_not_retryable.js | |
parent | 90a12d97d835c692aee72f0f0c6c4a7fae6739e6 (diff) | |
download | mongo-1406a964675363577a23ca69a4056d8726fed820.tar.gz |
SERVER-40631 Attach TransientTransactionError error label for network error codes
Diffstat (limited to 'jstests/sharding/transactions_writes_not_retryable.js')
-rw-r--r-- | jstests/sharding/transactions_writes_not_retryable.js | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/jstests/sharding/transactions_writes_not_retryable.js b/jstests/sharding/transactions_writes_not_retryable.js index d0253653362..76cb3af7854 100644 --- a/jstests/sharding/transactions_writes_not_retryable.js +++ b/jstests/sharding/transactions_writes_not_retryable.js @@ -54,19 +54,11 @@ "expected write in transaction not to be retried on closed connection, cmd: " + tojson(writeCmd) + ", sharded: " + isSharded); - let confirmIsNetworkError = function(response) { - if (response.hasOwnProperty('writeErrors')) { - assert.neq(null, res.writeErrors[0]); - assert(ErrorCodes.isNetworkError(res.writeErrors[0].code), - "expected network error, got: " + tojson(res.code)); - } else { - assert.eq('findAndModify', writeCmdName); - assert(ErrorCodes.isNetworkError(res.code), - "expected network error, got: " + tojson(res.code)); - } - }; - - confirmIsNetworkError(res); + // Network errors during sharded transactions are transient transaction errors, so they're + // returned as top level codes for all commands, including batch writes. + assert(ErrorCodes.isNetworkError(res.code), + "expected network error, got: " + tojson(res.code)); + assert.eq(res.errorLabels, ["TransientTransactionError"]); assert.commandFailedWithCode(session.abortTransaction_forTesting(), ErrorCodes.NoSuchTransaction); |