2024-03-22 18:34:50 +01:00
|
|
|
import { GenericContainer, Wait } from "testcontainers"
|
|
|
|
|
|
|
|
export default async function setup() {
|
2024-03-27 17:40:41 +01:00
|
|
|
let couchdb = new GenericContainer("budibase/couchdb")
|
2024-03-22 18:34:50 +01:00
|
|
|
.withExposedPorts(5984)
|
|
|
|
.withEnvironment({
|
|
|
|
COUCHDB_PASSWORD: "budibase",
|
|
|
|
COUCHDB_USER: "budibase",
|
|
|
|
})
|
2024-03-26 10:58:40 +01:00
|
|
|
.withCopyContentToContainer([
|
2024-03-22 18:34:50 +01:00
|
|
|
{
|
2024-03-26 10:58:40 +01:00
|
|
|
content: `
|
|
|
|
[log]
|
|
|
|
level = warn
|
|
|
|
`,
|
2024-03-22 18:34:50 +01:00
|
|
|
target: "/opt/couchdb/etc/local.d/test-couchdb.ini",
|
|
|
|
},
|
|
|
|
])
|
|
|
|
.withWaitStrategy(
|
|
|
|
Wait.forSuccessfulCommand(
|
|
|
|
"curl http://budibase:budibase@localhost:5984/_up"
|
|
|
|
).withStartupTimeout(20000)
|
|
|
|
)
|
2024-03-27 17:40:41 +01:00
|
|
|
|
|
|
|
if (process.env.REUSE_CONTAINERS) {
|
|
|
|
couchdb = couchdb.withReuse()
|
|
|
|
}
|
|
|
|
|
|
|
|
await couchdb.start()
|
2024-03-22 18:34:50 +01:00
|
|
|
}
|