Skip to content

[Bug]: Cannot run build using Testcontainers on JDK 23+ #8986

@marko-bekhta

Description

@marko-bekhta

Module

Core

Testcontainers version

1.20.0

Using the latest Testcontainers version?

Yes

Host OS

Linux

Host Arch

x86

Docker version

Client: Docker Engine - Community
 Version:           27.1.0
 API version:       1.46
 Go version:        go1.21.12
 Git commit:        6312585
 Built:             Fri Jul 19 17:45:03 2024
 OS/Arch:           linux/amd64
 Context:           default

What happened?

Attempting to use TestContainers and JDk 23+ results in:

09:56:16,255 (main) ERROR DockerClientProviderStrategy:269 - Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
	DockerDesktopClientProviderStrategy: failed with exception NullPointerException (Cannot invoke "java.nio.file.Path.toString()" because the return value of "org.testcontainers.dockerclient.DockerDesktopClientProviderStrategy.getSocketPath()" is null)As no valid configuration was found, execution cannot continue.
See https://java.testcontainers.org/on_failure.html for more details.

This is caused by the Awaitility upgrade in this commit c177fb2 which is causing

java.lang.NumberFormatException: For input string: "23-ea"

in this block of code checking the socket strategy:

try (Socket socket = socketProvider.call()) {
Duration timeout = Duration.ofMillis(200);
Awaitility
.await()
.atMost(TestcontainersConfiguration.getInstance().getClientPingTimeout(), TimeUnit.SECONDS)
.pollInterval(timeout)
.pollDelay(Duration.ofSeconds(0)) // start checking immediately
.ignoreExceptionsInstanceOf(SocketTimeoutException.class)
.untilAsserted(() -> socket.connect(socketAddress, (int) timeout.toMillis()));
return true;

on JDK 23+

See:
awaitility/awaitility#277
awaitility/awaitility#275

for the related issue on the Awaitility side.

Relevant log output

No response

Additional Information

Maybe it is worth downgrading to the 4.2.0 version for the time those issues are not addressed on the Awaitility side ?

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