MCPcopy Index your code
hub / github.com/chartbrew/chartbrew / startPostgres

Method startPostgres

server/tests/helpers/testDbManager.js:150–172  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

148 }
149
150 async startPostgres() {
151 this.container = await new GenericContainer("postgres:15")
152 .withEnvironment({
153 POSTGRES_USER: this.username,
154 POSTGRES_PASSWORD: this.password,
155 POSTGRES_DB: this.database,
156 })
157 .withExposedPorts(5432)
158 .withWaitStrategy(
159 Wait.forAll([
160 Wait.forLogMessage("database system is ready to accept connections"),
161 Wait.forListeningPorts()
162 ])
163 )
164 .withStartupTimeout(60000) // 60 seconds timeout
165 .start();
166
167 this.port = this.container.getMappedPort(5432);
168
169 // Additional wait to ensure PostgreSQL is truly ready
170 console.log("⏳ Waiting for PostgreSQL to be fully ready...");
171 await new Promise((resolve) => setTimeout(resolve, 2000));
172 }
173
174 setTestEnvVars() {
175 const dbDialect = process.env.CB_DB_DIALECT_DEV || "mysql";

Callers 1

startMethod · 0.95

Calls 1

startMethod · 0.80

Tested by

no test coverage detected