mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-25 23:49:28 +00:00
chore(vitest): exclude packages/e2e/** from root unit test suite
This commit is contained in:
@@ -26,16 +26,12 @@ describe('WorkflowService Temporal Workers Concurrency Control', () => {
|
||||
originalExecutor = process.env.WORKFLOW_EXECUTOR
|
||||
originalTranscode = process.env.CONCURRENCY_TRANSCODE
|
||||
originalAgent = process.env.CONCURRENCY_AGENT
|
||||
process.env.WORKFLOW_EXECUTOR = 'temporal'
|
||||
workflowService.setExecutorType('temporal')
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
if (originalExecutor === undefined) {
|
||||
delete process.env.WORKFLOW_EXECUTOR
|
||||
} else {
|
||||
process.env.WORKFLOW_EXECUTOR = originalExecutor
|
||||
}
|
||||
workflowService.setExecutorType(originalExecutor === 'temporal' ? 'temporal' : 'local')
|
||||
|
||||
if (originalTranscode === undefined) {
|
||||
delete process.env.CONCURRENCY_TRANSCODE
|
||||
|
||||
@@ -20,6 +20,14 @@ export class WorkflowService {
|
||||
}
|
||||
}
|
||||
|
||||
setExecutorType(type: 'local' | 'temporal') {
|
||||
if (type === 'temporal') {
|
||||
this.executor = new TemporalExecutor(process.env.TEMPORAL_ADDRESS)
|
||||
} else {
|
||||
this.executor = new LocalExecutor()
|
||||
}
|
||||
}
|
||||
|
||||
async submit(task: WorkflowTask): Promise<string> {
|
||||
return this.executor.submit(task)
|
||||
}
|
||||
@@ -77,7 +85,7 @@ export class WorkflowService {
|
||||
queue: string,
|
||||
options: { workflowBundle?: unknown; workflowsPath?: string } = {},
|
||||
): Promise<void> {
|
||||
const type = process.env.WORKFLOW_EXECUTOR || 'local'
|
||||
const type = this.executor instanceof TemporalExecutor ? 'temporal' : 'local'
|
||||
if (type === 'temporal') {
|
||||
const { Worker, NativeConnection } = await import('@temporalio/worker')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user