Add useRealQueues helpers
This commit is contained in:
parent
c5da1a06c6
commit
a7bb89a710
|
@ -1,4 +1,26 @@
|
|||
import { Queue } from "bull"
|
||||
import { GenericContainer, Wait } from "testcontainers"
|
||||
|
||||
export async function useRealQueues() {
|
||||
const redis = await new GenericContainer("redis")
|
||||
.withExposedPorts(6379)
|
||||
.withEnvironment({})
|
||||
.withLabels({ "com.budibase": "true" })
|
||||
.withReuse()
|
||||
.withWaitStrategy(
|
||||
Wait.forSuccessfulCommand(
|
||||
`until redis-cli ping | grep -q PONG; do
|
||||
echo "Waiting for Redis to be ready..."
|
||||
sleep 1
|
||||
done
|
||||
echo "Redis is ready!"`
|
||||
).withStartupTimeout(10000)
|
||||
)
|
||||
.start()
|
||||
|
||||
const port = redis.getMappedPort(6379)
|
||||
process.env.BULL_TEST_REDIS = `http://127.0.0.1:${port}`
|
||||
}
|
||||
|
||||
export async function processMessages(queue: Queue) {
|
||||
do {
|
||||
|
|
Loading…
Reference in New Issue