Open

Description
Hi. I'm trying to write a Java / junit integration test which requires the following testcontainers: postgres, kafka and a webhook container which is based out of the docker-file specified at https://github.com/fredsted/webhook.site/blob/master/docker-compose.yml.Following is the code snippet:
protected static final Map.Entry<String, Integer> WEBHOOK_SERVICE_PORT = Maps.immutableEntry(
"webhook",
80
); public static void prepare(TestContext context) throws JoseException {
vertx = Vertx.vertx(); kafkaContainer = new KafkaContainer();
kafkaContainer.start(); postgreSqlContainer = new PostgreSQLContainer<>().withDatabaseName("testDB")
.withUsername("testUser")
.withPassword("testPassword")
.withInitScript("init.sql"); postgreSqlContainer.start(); webhookContainer = WebhookUtils.createWebhookcontainer(WEBHOOK_SERVICE_PORT);
webhookContainer.start();
} public static DockerComposeContainer createWebhookcontainer(
Entry<String, Integer> webhookServicePortEntry
) {
return new DockerComposeContainer(
new File("src/test/resources/docker-webhook/docker-compose.yml")
).withExposedService(webhookServicePortEntry.getKey(), webhookServicePortEntry.getValue())
.waitingFor(webhookServicePortEntry.getKey(), Wait.forHttp("/"));
}
I tweaked the docker-compose.yml
file slightly to ensure a random port:
version: '3'
services:
webhook:
image: "fredsted/webhook.site"
# Enable build for development:
# build:
# dockerfile: Dockerfile
# context: ./
command: php artisan queue:work --daemon --tries=1 --timeout=1
environment:
- APP_ENV=dev
- APP_DEBUG=true
- APP_URL=http://localhost:8084
- APP_LOG=errorlog
- DB_CONNECTION=sqlite
- REDIS_HOST=redis
- BROADCAST_DRIVER=redis
- CACHE_DRIVER=redis
- QUEUE_DRIVER=redis
- ECHO_HOST_MODE=path
redis:
image: "redis:alpine"
laravel-echo-server:
image: "mintopia/laravel-echo-server"
environment:
- LARAVEL_ECHO_SERVER_AUTH_HOST=http://webhook
- LARAVEL_ECHO_SERVER_HOST=0.0.0.0
- LARAVEL_ECHO_SERVER_PORT=6001
- ECHO_REDIS_PORT=6379
- ECHO_REDIS_HOST=redis
- ECHO_PROTOCOL=http
- ECHO_ALLOW_CORS=true
- ECHO_ALLOW_ORIGIN=*
- ECHO_ALLOW_METHODS=*
- ECHO_ALLOW_HEADERS=*
I get the following error:
java.lang.RuntimeException: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [32845] should be listening)17:34
Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [32845] should be listening)17:34
Metadata
Metadata
Assignees
Labels
No labels