Skip to content

HostPortWaitStrategy does not support UDP ports #2532

Closed
@pravussum

Description

@pravussum

I have a testcontainer where I want to expose a UPD port, therefor I used GenericContainers addFixedExposedPort method (only that allows to specify the protocol).

addFixedExposedPort(5775, 6831, InternetProtocol.UDP);
addExposedPort(16686);

The container fails to come up with this error:

Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [32790, 5775] should be listening)
at org.testcontainers.containers.wait.strategy.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:47)
at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:35)
at org.testcontainers.containers.wait.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:23)
at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:35)
at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:582)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:259)
... 35 more

It looks to me like
https://github.com/testcontainers/testcontainers-java/blob/master/core/src/main/java/org/testcontainers/containers/wait/strategy/HostPortWaitStrategy.java or rather
https://github.com/testcontainers/testcontainers-java/blob/master/core/src/main/java/org/testcontainers/containers/wait/internal/ExternalPortListeningCheck.java
is only supporting TCP ports when checking the port availability (DatagramSocket should be used depending on the used protocol).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions