Chore/test runner improvements (#12439)

**What**
Make sure there is no open handles left and that the shutdown function are properly called. Refactor and improve the medusa test runner. Make sure all modules instances are released and cleaned up

**NOTE:**
On a separate PR we can continue the investigation for the memory growing over time while the tests execute
This commit is contained in:
Adrien de Peretti
2025-05-14 15:17:41 +02:00
committed by GitHub
parent e60d15ea84
commit ab22faaa52
13 changed files with 562 additions and 292 deletions

View File

@@ -70,14 +70,6 @@ export class WorkflowsModuleService<
}
__hooks = {
onApplicationShutdown: async () => {
await this.workflowOrchestratorService_.onApplicationShutdown()
await this.redisDisconnectHandler_()
clearInterval(this.clearTimeout_)
},
onApplicationPrepareShutdown: async () => {
await this.workflowOrchestratorService_.onApplicationPrepareShutdown()
},
onApplicationStart: async () => {
await this.workflowOrchestratorService_.onApplicationStart()
@@ -88,6 +80,14 @@ export class WorkflowsModuleService<
} catch {}
}, 1000 * 60 * 60)
},
onApplicationPrepareShutdown: async () => {
await this.workflowOrchestratorService_.onApplicationPrepareShutdown()
},
onApplicationShutdown: async () => {
await this.workflowOrchestratorService_.onApplicationShutdown()
await this.redisDisconnectHandler_()
clearInterval(this.clearTimeout_)
},
}
static prepareFilters<T>(filters: T & { q?: string }) {