diff options
author | Cheahuychou Mao <mao.cheahuychou@gmail.com> | 2022-05-23 01:43:25 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-05-23 15:15:55 +0000 |
commit | 62ef2bf50cccf8683fbdd0ab0d9c2351d5e2daaa (patch) | |
tree | a0fc43f7e10ba6599da57607b133b135c4e0b6ea /jstests/concurrency | |
parent | 7a8e211d20de65c14f525acdef662eeea28d441c (diff) | |
download | mongo-62ef2bf50cccf8683fbdd0ab0d9c2351d5e2daaa.tar.gz |
SERVER-66344 Only check the response if the last try was not a retry that failed
Diffstat (limited to 'jstests/concurrency')
-rw-r--r-- | jstests/concurrency/fsm_workloads/internal_transactions_unsharded.js | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/jstests/concurrency/fsm_workloads/internal_transactions_unsharded.js b/jstests/concurrency/fsm_workloads/internal_transactions_unsharded.js index 97a17315bb7..492f331837a 100644 --- a/jstests/concurrency/fsm_workloads/internal_transactions_unsharded.js +++ b/jstests/concurrency/fsm_workloads/internal_transactions_unsharded.js @@ -381,8 +381,8 @@ var $config = extendWorkload($config, function($config, $super) { tojsononeline(internalTxnTestCmdObj)}: ${tojsononeline({executionCtxType})}`); const txnDb = this.getInternalTransactionDB(executionCtxType, defaultDb.getName()); - let res; const runFunc = () => { + let res; try { res = txnDb.adminCommand(internalTxnTestCmdObj); print(`Response: ${tojsononeline(res)}`); @@ -395,6 +395,24 @@ var $config = extendWorkload($config, function($config, $super) { } throw e; } + + // Check responses. + res.responses.forEach(innerRes => { + assert.commandWorked(innerRes); + }); + if (executionCtxType == this.executionContextTypes.kClientRetryableWrite) { + // If the command was retried, 'responses' would only contain the response for + // 'crudOp.cmdObj'. + assert.lte(res.responses.length, 2); + } else { + assert.eq(res.responses.length, 2); + } + const crudRes = res.responses[0]; + crudOp.checkResponseFunc(crudRes); + if (res.responses.length == 2) { + const insertRes = res.responses[1]; + insertOp.checkResponseFunc(insertRes); + } }; print("Starting internal transaction"); @@ -408,24 +426,6 @@ var $config = extendWorkload($config, function($config, $super) { runFunc(); } - // Check responses. - res.responses.forEach(innerRes => { - assert.commandWorked(innerRes); - }); - if (executionCtxType == this.executionContextTypes.kClientRetryableWrite) { - // If the command was retried, 'responses' would only contain the response for - // 'crudOp.cmdObj'. - assert.lte(res.responses.length, 2); - } else { - assert.eq(res.responses.length, 2); - } - const crudRes = res.responses[0]; - crudOp.checkResponseFunc(crudRes); - if (res.responses.length == 2) { - const insertRes = res.responses[1]; - insertOp.checkResponseFunc(insertRes); - } - // Check documents. const collection = this.getCollectionForDocumentChecks(defaultDb, txnDb, collName); crudOp.checkDocsFunc(collection); |