diff options
Diffstat (limited to 'jstests')
-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); |