Close server back

This commit is contained in:
Adria Navarro 2024-11-06 23:08:37 +01:00
parent 505146f4b3
commit c5da1a06c6
3 changed files with 22 additions and 15 deletions

View File

@ -238,11 +238,11 @@ export default class TestConfiguration {
return
}
// if (this.server) {
// this.server.close()
// } else {
// require("../../app").getServer().close()
// }
if (this.server) {
this.server.close()
} else {
require("../../app").getServer().close()
}
if (this.allApps) {
cleanup(this.allApps.map(app => app.appId))
}

View File

@ -12,21 +12,28 @@ const BASE_IDENTITY = {
const USER_AUDIT_LOG_COUNT = 3
const APP_ID = "app_1"
const config = new TestConfiguration()
beforeAll(async () => {
await config.beforeAll()
})
afterAll(async () => {
await config.afterAll()
})
describe.each(["lucene", "sql"])("/api/global/auditlogs (%s)", method => {
const config = new TestConfiguration()
let envCleanup: (() => void) | undefined
beforeAll(async () => {
envCleanup = features.testutils.setFeatureFlags("*", {
SQS: method === "sql",
})
await config.beforeAll()
await config.useNewTenant()
})
afterAll(async () => {
afterAll(() => {
envCleanup?.()
await config.afterAll()
})
describe("POST /api/global/auditlogs/search", () => {

View File

@ -12,7 +12,7 @@ dbConfig.init()
import env from "../environment"
import * as controllers from "./controllers"
const supertest = require("supertest")
import supertest from "supertest"
import { Config } from "../constants"
import {
@ -123,11 +123,11 @@ class TestConfiguration {
}
async afterAll() {
// if (this.server) {
// await this.server.close()
// } else {
// await require("../index").default.close()
// }
if (this.server) {
await this.server.close()
} else {
await require("../index").default.close()
}
}
// TENANCY