mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-27 03:14:11 +00:00
feat(workflow-e2e): add E2E tests for agentAutofillMedia workflow
- Setup E2E package under packages/e2e - Use testcontainers to spin up postgres and temporal dev server - Overwrite activities in global registry to mock AI model output - Track temporal workers and expose shutdownWorkers() method for clean shutdown - Integrate test:e2e:workflow into root package.json and GitHub actions CI
This commit is contained in:
@@ -9,6 +9,7 @@ import { TaskQueueAgent, TaskQueueTranscode, getConcurrencyLimit } from './workf
|
||||
|
||||
export class WorkflowService {
|
||||
private executor: Executor
|
||||
private activeWorkers: unknown[] = []
|
||||
|
||||
constructor() {
|
||||
const type = process.env.WORKFLOW_EXECUTOR || 'local'
|
||||
@@ -64,6 +65,13 @@ export class WorkflowService {
|
||||
this.executor.close()
|
||||
}
|
||||
|
||||
async shutdownWorkers(): Promise<void> {
|
||||
await Promise.all(
|
||||
this.activeWorkers.map((w) => (w as { shutdown: () => Promise<void> }).shutdown()),
|
||||
)
|
||||
this.activeWorkers = []
|
||||
}
|
||||
|
||||
// Starts Temporal workers for specific task queues
|
||||
async startWorkers(
|
||||
queue: string,
|
||||
@@ -156,6 +164,8 @@ export class WorkflowService {
|
||||
},
|
||||
})
|
||||
|
||||
this.activeWorkers.push(sharedWorker, specificWorker)
|
||||
|
||||
await Promise.all([sharedWorker.run(), specificWorker.run()])
|
||||
} else {
|
||||
console.log(
|
||||
|
||||
Reference in New Issue
Block a user