diff options
author | A. Jesse Jiryu Davis <jesse@mongodb.com> | 2019-02-01 23:07:51 -0500 |
---|---|---|
committer | A. Jesse Jiryu Davis <jesse@mongodb.com> | 2019-02-12 17:40:26 -0500 |
commit | d7fcc8ab5b3455ab5530969edc8383929bed07f7 (patch) | |
tree | c127047f9b54d8ee4f53bca92868118c3ba06aee /jstests/libs/txns | |
parent | db3baf2ee165ebba924620b887814adefabf1e94 (diff) | |
download | mongo-d7fcc8ab5b3455ab5530969edc8383929bed07f7.tar.gz |
SERVER-38583 JS test fixes for write errors in transactions
Diffstat (limited to 'jstests/libs/txns')
-rw-r--r-- | jstests/libs/txns/txn_override.js | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/jstests/libs/txns/txn_override.js b/jstests/libs/txns/txn_override.js index 295a06b18ee..8c01e8c6a1a 100644 --- a/jstests/libs/txns/txn_override.js +++ b/jstests/libs/txns/txn_override.js @@ -7,6 +7,7 @@ (function() { 'use strict'; + load("jstests/libs/error_code_utils.js"); load("jstests/libs/override_methods/read_and_write_concern_helpers.js"); load('jstests/libs/override_methods/override_helpers.js'); load("jstests/libs/retryable_writes_util.js"); @@ -288,17 +289,7 @@ // retry the command. If the collection did exist, we'll return the original // response because it failed for a different reason. Tests that expect collections // to not exist will have to be skipped. - var unsupported = false; - if (res.code === ErrorCodes.OperationNotSupportedInTransaction) { - unsupported = true; - } else if (res.writeErrors) { - const code = res.writeErrors.slice(-1)[0].code; - if (code === ErrorCodes.OperationNotSupportedInTransaction) { - unsupported = true; - } - } - - if (unsupported) { + if (includesErrorCode(res, ErrorCodes.OperationNotSupportedInTransaction)) { const createCmdRes = runCommandOriginal.call(conn, dbName, { |