Updating back to use our own home-rolled version which allows us to specify the image version correctly, but using the testcontainers option to wait for two logs.
This commit is contained in:
parent
ccd6c2ece6
commit
99c2a51f41
|
@ -114,8 +114,7 @@
|
|||
"@babel/preset-env": "7.16.11",
|
||||
"@swc/core": "1.3.71",
|
||||
"@swc/jest": "0.2.27",
|
||||
"@testcontainers/postgresql": "10.6.0",
|
||||
"@trendyol/jest-testcontainers": "2.1.1",
|
||||
"@trendyol/jest-estcontainers": "2.1.1",
|
||||
"@types/global-agent": "2.1.1",
|
||||
"@types/google-spreadsheet": "3.1.5",
|
||||
"@types/jest": "29.5.5",
|
||||
|
@ -143,6 +142,7 @@
|
|||
"rimraf": "3.0.2",
|
||||
"supertest": "6.3.3",
|
||||
"swagger-jsdoc": "6.1.0",
|
||||
"testcontainers": "10.6.0",
|
||||
"timekeeper": "2.2.0",
|
||||
"ts-node": "10.8.1",
|
||||
"tsconfig-paths": "4.0.0",
|
||||
|
|
|
@ -2,7 +2,7 @@ version: "3.8"
|
|||
services:
|
||||
db:
|
||||
container_name: postgres
|
||||
image: postgres:latest
|
||||
image: postgres:16.1-bullseye
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: root
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
import { Datasource, SourceName } from "@budibase/types"
|
||||
import {
|
||||
PostgreSqlContainer,
|
||||
StartedPostgreSqlContainer,
|
||||
} from "@testcontainers/postgresql"
|
||||
import { GenericContainer, Wait, StartedTestContainer } from "testcontainers"
|
||||
|
||||
let container: StartedPostgreSqlContainer | undefined
|
||||
let container: StartedTestContainer | undefined
|
||||
|
||||
export async function getDsConfig(): Promise<Datasource> {
|
||||
try {
|
||||
if (!container) {
|
||||
const pgContainer = new PostgreSqlContainer()
|
||||
container = await pgContainer
|
||||
.withUsername("postgres")
|
||||
.withPassword("password")
|
||||
container = await new GenericContainer("postgres:16.1-bullseye")
|
||||
.withExposedPorts(5432)
|
||||
.withEnvironment({ POSTGRES_PASSWORD: "password" })
|
||||
.withWaitStrategy(
|
||||
Wait.forLogMessage(
|
||||
"database system is ready to accept connections",
|
||||
2
|
||||
)
|
||||
)
|
||||
.start()
|
||||
}
|
||||
const host = container!.getHost()
|
||||
const port = container!.getMappedPort(5432)
|
||||
const host = container.getHost()
|
||||
const port = container.getMappedPort(5432)
|
||||
|
||||
return {
|
||||
type: "datasource_plus",
|
||||
|
|
|
@ -4977,13 +4977,6 @@
|
|||
resolved "https://registry.yarnpkg.com/@tediousjs/connection-string/-/connection-string-0.5.0.tgz#9b3d858c040aac6bdf5584bf45370cef5b6522b4"
|
||||
integrity sha512-7qSgZbincDDDFyRweCIEvZULFAw5iz/DeunhvuxpL31nfntX3P4Yd4HkHBRg9H8CdqY1e5WFN1PZIz/REL9MVQ==
|
||||
|
||||
"@testcontainers/postgresql@10.6.0":
|
||||
version "10.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@testcontainers/postgresql/-/postgresql-10.6.0.tgz#dfeff325130ab0ed4fd0dbd5dbe5847cddb435d9"
|
||||
integrity sha512-gHYpsXkVLpCkJ0jg7xE5n8pogTNvw2LyhkXeJm04raH1yz020jcHAB2a1tRW1J2D8mM8WhFH+xH6pzH2ZggFdg==
|
||||
dependencies:
|
||||
testcontainers "^10.6.0"
|
||||
|
||||
"@testing-library/dom@^8.1.0":
|
||||
version "8.20.0"
|
||||
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.20.0.tgz#914aa862cef0f5e89b98cc48e3445c4c921010f6"
|
||||
|
|
Loading…
Reference in New Issue