Testcontainers-java: Tests are failing on elasticsearch module after upgrade to 1.7 or 1.8

Created on 15 Jun 2018  路  6Comments  路  Source: testcontainers/testcontainers-java

I just try to upgrade my project from 1.6.0 to 1.7 and 1.8 but this is failing my tests. And I'm not sure why.

Here is my branch: https://github.com/dadoonet/testcontainers-java-module-elasticsearch/tree/pr/tc-1.8.0 and the associated PR https://github.com/dadoonet/testcontainers-java-module-elasticsearch/pull/34/

When changing this line: https://github.com/dadoonet/testcontainers-java-module-elasticsearch/blob/pr/tc-1.8.0/pom.xml#L21 from

<testcontainer.version>1.6.0</testcontainer.version>

to

<testcontainer.version>1.7.3</testcontainer.version>

or

<testcontainer.version>1.8.0</testcontainer.version>

And then run mvn clean install, I'm getting some errors in tests:

fr.pilato.elasticsearch.containers.ElasticsearchResourceWithPluginsTest  Time elapsed: 28.462 sec  <<< ERROR!
org.testcontainers.containers.ContainerLaunchException: Container startup failed
        at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:214)
        at fr.pilato.elasticsearch.containers.ElasticsearchResource.before(ElasticsearchResource.java:166)
        at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: org.testcontainers.containers.ContainerFetchException: Can't get Docker image: org.testcontainers.images.builder.ImageFromDockerfile@53667cbe
        at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:841)
        at org.testcontainers.containers.GenericContainer.logger(GenericContainer.java:311)
        at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:203)
        ... 16 more
Caused by: com.github.dockerjava.api.exception.DockerClientException: Could not build image
        at com.github.dockerjava.core.command.BuildImageResultCallback.getImageId(BuildImageResultCallback.java:76)
        at com.github.dockerjava.core.command.BuildImageResultCallback.awaitImageId(BuildImageResultCallback.java:51)
        at org.testcontainers.images.builder.ImageFromDockerfile.resolve(ImageFromDockerfile.java:141)
        at org.testcontainers.images.builder.ImageFromDockerfile.resolve(ImageFromDockerfile.java:30)
        at org.testcontainers.utility.LazyFuture.getResolvedValue(LazyFuture.java:20)
        at org.testcontainers.utility.LazyFuture.get(LazyFuture.java:27)
        at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:839)
        ... 18 more

Reverting to 1.6.0 and all tests are OK again.

Also another side effect is about logger. I might be missing some pieces as I'm now having:

log4j:WARN No appenders could be found for logger (org.apache.http.impl.nio.client.MainClientExec).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

I tried various things like adding log4j 1 lib as one of first dependencies with no luck.

resolutioacknowledged typbug

All 6 comments

Hi @dadoonet, thanks for reporting!

I just tested it, it works with 1.7.0 but fails with 1.7.1+. 1.7.1 has Updated docker-java to 3.1.0-rc-2 and it seems that here is a regression in docker-java.
I'll debug it further to figure out what causes the exception

Right. I was also able to make it work on 1.7.0. And no LOG4J Warn message BTW.

Hey @dadoonet, I just tested your branch locally with Testcontainers 1.8.0 and the tests were working fine for me.

Results :

Tests run: 17, Failures: 0, Errors: 0, Skipped: 0

I was testing on Linux Fedora 28 with Docker 18.03.1-ce.

A general suggestion, WDYT about integrating your module in the main testcontainers repository? It will be easier to spot regressions in this case.

A general suggestion, WDYT about integrating your module in the main testcontainers repository? It will be easier to spot regressions in this case.

I started this a month ago. First step was to migrate my project to Gradle and I hit an issue with a 3rd party gradle plugin which is blocking me a bit. But definitely, this is something I want to do this summer.

For the feedback about this issue, I'll test again.
I'm running this on MacOS which is may be the source of this "regression".

I have the same issues on Travis CI.

I upgraded to 1.8.2 today and it seems to work well so far.
I believe I can close this issue then.

Was this page helpful?
0 / 5 - 0 ratings