chore(): only execute race execution checks and publish message only for async workflows (#13396)

* chore(): only execute race execution checks for async workflows

* chore(): workflow redis publish only for async flows

* Create cyan-gorillas-poke.md

* chore(): workflow redis publish only for async flows

* fix negative check

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
This commit is contained in:
Adrien de Peretti
2025-09-04 09:12:09 +02:00
committed by GitHub
parent 28830567e7
commit 2b89510df3
7 changed files with 144 additions and 52 deletions

View File

@@ -47,11 +47,11 @@ import { createScheduled } from "../__fixtures__/workflow_scheduled"
jest.setTimeout(60000)
const failTrap = (done) => {
const failTrap = (done, name) => {
setTimeoutSync(() => {
// REF:https://stackoverflow.com/questions/78028715/jest-async-test-with-event-emitter-isnt-ending
console.warn(
`Jest is breaking the event emit with its debouncer. This allows to continue the test by managing the timeout of the test manually.`
`Jest is breaking the event emit with its debouncer. This allows to continue the test by managing the timeout of the test manually. ${name}`
)
done()
}, 5000)
@@ -200,7 +200,10 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
})
})
failTrap(done)
failTrap(
done,
"should cancel an ongoing execution with async unfinished yet step"
)
})
it("should cancel a complete execution with a sync workflow running as async", async () => {
@@ -537,7 +540,10 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
})
})
failTrap(done)
failTrap(
done,
"should subscribe to a async workflow and receive the response when it finishes"
)
})
describe("Testing basic workflow", function () {
@@ -744,7 +750,10 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
})
expect(onFinish).toHaveBeenCalledTimes(0)
failTrap(done)
failTrap(
done,
"should subscribe to a async workflow and receive the response when it finishes"
)
})
it("should cancel and revert a completed workflow", async () => {
@@ -817,7 +826,10 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
throwOnError: true,
})
failTrap(done)
failTrap(
done,
"should not run conditional steps if condition is false"
)
})
it("should not run conditional steps if condition is false", (done) => {
@@ -839,7 +851,10 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
throwOnError: true,
})
failTrap(done)
failTrap(
done,
"should not run conditional steps if condition is false"
)
})
})
@@ -988,7 +1003,10 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
},
})
failTrap(done)
failTrap(
done,
"should display error when multple async steps are running in parallel"
)
})
})

View File

@@ -14,11 +14,11 @@ import "../__fixtures__"
jest.setTimeout(300000)
const failTrap = (done) => {
const failTrap = (done, name) => {
setTimeoutSync(() => {
// REF:https://stackoverflow.com/questions/78028715/jest-async-test-with-event-emitter-isnt-ending
console.warn(
"Jest is breaking the event emit with its debouncer. This allows to continue the test by managing the timeout of the test manually."
`Jest is breaking the event emit with its debouncer. This allows to continue the test by managing the timeout of the test manually. ${name}`
)
done()
}, 5000)
@@ -99,7 +99,10 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
})
.catch((e) => e)
failTrap(done)
failTrap(
done,
"should prevent race continuation of the workflow during retryIntervalAwaiting in background execution"
)
})
it("should prevent race continuation of the workflow compensation during retryIntervalAwaiting in background execution", (done) => {
@@ -190,7 +193,10 @@ moduleIntegrationTestRunner<IWorkflowEngineService>({
})
.catch((e) => e)
failTrap(done)
failTrap(
done,
"should prevent race continuation of the workflow compensation during retryIntervalAwaiting in background execution"
)
})
})
},