Stop container after tests
This commit is contained in:
parent
9a8ae45c54
commit
c80cc35ae3
|
@ -15,7 +15,7 @@ import {
|
||||||
import _ from "lodash"
|
import _ from "lodash"
|
||||||
import { generator } from "@budibase/backend-core/tests"
|
import { generator } from "@budibase/backend-core/tests"
|
||||||
import { utils } from "@budibase/backend-core"
|
import { utils } from "@budibase/backend-core"
|
||||||
import { GenericContainer } from "testcontainers"
|
import { GenericContainer, StartedTestContainer } from "testcontainers"
|
||||||
|
|
||||||
const config = setup.getConfig()!
|
const config = setup.getConfig()!
|
||||||
|
|
||||||
|
@ -30,14 +30,16 @@ describe("row api - postgres", () => {
|
||||||
let host: string
|
let host: string
|
||||||
let port: number
|
let port: number
|
||||||
|
|
||||||
|
let postgresContainer: StartedTestContainer
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const container = await new GenericContainer("postgres")
|
postgresContainer = await new GenericContainer("postgres")
|
||||||
.withExposedPorts(5432)
|
.withExposedPorts(5432)
|
||||||
.withEnv("POSTGRES_PASSWORD", "password")
|
.withEnv("POSTGRES_PASSWORD", "password")
|
||||||
.start()
|
.start()
|
||||||
|
|
||||||
host = container.getContainerIpAddress()
|
host = postgresContainer.getContainerIpAddress()
|
||||||
port = container.getMappedPort(5432)
|
port = postgresContainer.getMappedPort(5432)
|
||||||
|
|
||||||
await config.init()
|
await config.init()
|
||||||
const apiKey = await config.generateApiKey()
|
const apiKey = await config.generateApiKey()
|
||||||
|
@ -132,6 +134,7 @@ describe("row api - postgres", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
await postgresContainer?.stop()
|
||||||
await config.end()
|
await config.end()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue