Skip to content

[BUG] Generated test using Testcontainers doesn't work with the recent version of Docker #455

@sekikn

Description

@sekikn

Describe the bug.

Generated test code uses Testcontainers 1.16.3, but it's not compatible with recent version of Docker, as reported in testcontainers/testcontainers-java#11212.

Expected behavior

The generated test code should pass without any modification.

Screenshots

Image

How to Reproduce

  1. Generate codebase from java-spring-template:
$ asyncapi generate fromTemplate tests/mocks/kafka.yml . -o ~/kafka
  1. Run generated test code and get across a failure:
$ cd ~/kafka
$ chmod +x gradlew
$ ./gradlew test --tests com.asyncapi.TestcontainerKafkaTest

> Task :compileTestJava
Note: /home/sekikn/kafka/src/test/java/com/asyncapi/TestcontainerKafkaTest.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :test FAILED

com.asyncapi.TestcontainerKafkaTest > classMethod FAILED
    java.lang.IllegalStateException at DockerClientProviderStrategy.java:156

1 test completed, 1 failed

FAILURE: Build failed with an exception.
  1. Find the root cause in build/reports/tests/test/classes/com.asyncapi.TestcontainerKafkaTest.html:
Root cause BadRequestException (Status 400: {"message":"client version 1.32 is too old. Minimum supported API version is 1.44, please upgrade your client to a newer version"}

🖥️ Device Information [optional]

  • Operating System (OS): Ubuntu 24.04
  • Docker version:
Client: Docker Engine - Community
 Version:           29.1.1
 API version:       1.52
 Go version:        go1.25.4
  ...

Server: Docker Engine - Community
 Engine:
  Version:          29.1.1
  API version:      1.52 (minimum version 1.44)
  Go version:       go1.25.4
  ...

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions