test(workflow-engine-redist): Update tests to ensure behaviour validation properly (#12514)
This commit is contained in:
+7
-1
@@ -29,6 +29,12 @@ createWorkflow(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const step_1_async = createStep(
|
||||||
|
"step_1_async",
|
||||||
|
jest.fn(async (input) => {}),
|
||||||
|
jest.fn()
|
||||||
|
)
|
||||||
|
|
||||||
createWorkflow(
|
createWorkflow(
|
||||||
{
|
{
|
||||||
name: "workflow_transaction_timeout_async",
|
name: "workflow_transaction_timeout_async",
|
||||||
@@ -37,7 +43,7 @@ createWorkflow(
|
|||||||
retentionTime: 5,
|
retentionTime: 5,
|
||||||
},
|
},
|
||||||
function (input) {
|
function (input) {
|
||||||
const resp = step_1(input).config({
|
const resp = step_1_async(input).config({
|
||||||
async: true,
|
async: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -654,7 +654,7 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
|
|||||||
"workflow_transaction_timeout",
|
"workflow_transaction_timeout",
|
||||||
{
|
{
|
||||||
input: {},
|
input: {},
|
||||||
transactionId: "trx",
|
transactionId: "trx" + ulid(),
|
||||||
throwOnError: false,
|
throwOnError: false,
|
||||||
}
|
}
|
||||||
)) as Awaited<{
|
)) as Awaited<{
|
||||||
@@ -663,6 +663,8 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
|
|||||||
errors: any
|
errors: any
|
||||||
}>
|
}>
|
||||||
|
|
||||||
|
await setTimeout(500)
|
||||||
|
|
||||||
expect(transaction.getFlow().state).toEqual("reverted")
|
expect(transaction.getFlow().state).toEqual("reverted")
|
||||||
expect(result).toEqual({ executed: true })
|
expect(result).toEqual({ executed: true })
|
||||||
expect(errors).toHaveLength(1)
|
expect(errors).toHaveLength(1)
|
||||||
@@ -710,9 +712,10 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("should revert the entire transaction when the transaction timeout expires in a transaction containing an async step", async () => {
|
it("should revert the entire transaction when the transaction timeout expires in a transaction containing an async step", async () => {
|
||||||
|
const transactionId = "transaction_1" + ulid()
|
||||||
await workflowOrcModule.run("workflow_transaction_timeout_async", {
|
await workflowOrcModule.run("workflow_transaction_timeout_async", {
|
||||||
input: {},
|
input: {},
|
||||||
transactionId: "transaction_1",
|
transactionId,
|
||||||
throwOnError: false,
|
throwOnError: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -722,7 +725,7 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
|
|||||||
"workflow_transaction_timeout_async",
|
"workflow_transaction_timeout_async",
|
||||||
{
|
{
|
||||||
input: {},
|
input: {},
|
||||||
transactionId: "transaction_1",
|
transactionId,
|
||||||
throwOnError: false,
|
throwOnError: false,
|
||||||
}
|
}
|
||||||
)) as Awaited<{
|
)) as Awaited<{
|
||||||
@@ -734,7 +737,7 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
|
|||||||
expect(transaction.getFlow().state).toEqual("reverted")
|
expect(transaction.getFlow().state).toEqual("reverted")
|
||||||
expect(result).toEqual(undefined)
|
expect(result).toEqual(undefined)
|
||||||
expect(errors).toHaveLength(1)
|
expect(errors).toHaveLength(1)
|
||||||
expect(errors[0].action).toEqual("step_1")
|
expect(errors[0].action).toEqual("step_1_async")
|
||||||
expect(
|
expect(
|
||||||
TransactionTimeoutError.isTransactionTimeoutError(errors[0].error)
|
TransactionTimeoutError.isTransactionTimeoutError(errors[0].error)
|
||||||
).toBe(true)
|
).toBe(true)
|
||||||
|
|||||||
Reference in New Issue
Block a user