question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Quarkus BOM breaks Testcontainers starting with 1.16.0

See original GitHub issue

Hi, I tried to update testcontainer from version 1.15.3 to 1.16.0 and my tests crashed with the following error:

java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration

This is my test:

@Testcontainers
public class testContainer {
  @Test
    public void containerWithInitScriptShouldWork() {
      Jdbi jdbi = Jdbi.create("jdbc:tc:postgis:13-3.1:///testWIthData?TC_INITSCRIPT=sql/init_sql.sql")
          .installPlugin(new PostgresPlugin())
          .installPlugin(new Jackson2Plugin());
  
      List<Map<String, Object>> values = jdbi.withHandle(handle ->
          handle.createQuery("select ID, LAST_NAME, FIRST_NAME from users")
              .mapToMap().list());
      assertEquals(1, values.size());
      Map<String, Object> data = values.get(0);
      assertEquals(1, data.get("id"));
      assertEquals("Doe", data.get("last_name"));
      assertEquals("John", data.get("first_name"));
    }
}

I tried on macOS and Linux but neither worked (same for Github actions).

Application:

  • Java 11
  • Quarkus
  • maven

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
bsideupcommented, Jul 30, 2021

I have no idea why, but Quarkus’ BOM forces docker-java-api version to 3.2.8: https://repo1.maven.org/maven2/io/quarkus/quarkus-bom/2.0.3.Final/quarkus-bom-2.0.3.Final.pom

This will break your project. Consider reporting to the Quarkus team and temporary forcing docker-java-api and docker-java-transport-zerodep to the version that Testcontainers defines (3.2.11 as per https://mvnrepository.com/artifact/org.testcontainers/testcontainers/1.16.0).

/cc @Ladicek who added the enforcement in https://github.com/quarkusio/quarkus/commit/11f2e68f8c0ac6627b1b0c87e5b675a6dee857f2

2reactions
Ladicekcommented, Jul 30, 2021

Ah one general recommendation for Maven, though. If you add the Maven Enforcer plugin and enable dependency convergence check, that helps a lot. Something like this:

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${version.maven-enforcer-plugin}</version>
          <executions>
            <execution>
              <id>enforce-dependencies</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <dependencyConvergence />
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom configuration - Testcontainers for Java
Disabling Ryuk. Ryuk must be started as a privileged container. If your environment already implements automatic cleanup of containers after the execution, but ......
Read more >
Apache camel 3.12.0 Release
This version supports Java 8 and 11. Getting the Binaries using Maven. To use this release in your Apache Maven pom.xml , import...
Read more >
Central Repository: org/testcontainers/testcontainers-bom/1.16.0
org/testcontainers/testcontainers-bom/1.16.0 ../ testcontainers-bom-1.16.0.pom 2021-07-20 13:54 7066 testcontainers-bom-1.16.0.pom.asc 2021-07-20 13:54 801 ...
Read more >
junit - Testcontainers - postgres + Quarkus test resulting in ...
Quarkus 2.0+ includes a new system call devServices which uses internally testcontainers to setup a development an testing environment for ...
Read more >
Quarkus: Supersonic Subatomic Java. - JavaRepos
I have created integration tests that leverage testcontainers to start and configure a complete vault+postgres system. see VaultTestExtension ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found