testcontainers / testcontainers-java

Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
https://testcontainers.org
MIT License
8.02k stars 1.65k forks source link

Using Influxdb 1.7.11 is Unstable #4962

Closed jwedel closed 1 year ago

jwedel commented 2 years ago

We are using influxdb testcontainers 1.16.3. The default influxdb version is 1.4.3. When we update it to 1.7.11 to match our prod DB, the tests often fail locally (Windows), but not on Jenkins (Linux). It fails when connecting to the DB, it times out but I can see some queries executed in the container:

08:50:22.414 [main] INFO  org.testcontainers.dockerclient.DockerClientProviderStrategy - Loaded org.testcontainers.dockerclient.NpipeSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
08:50:23.405 [main] INFO  org.testcontainers.dockerclient.DockerClientProviderStrategy - Found Docker environment with local Npipe socket (npipe:////./pipe/docker_engine)
08:50:23.409 [main] INFO  org.testcontainers.DockerClientFactory - Docker host IP address is localhost
08:50:23.499 [main] INFO  org.testcontainers.DockerClientFactory - Connected to docker: 
  Server Version: 20.10.8
  API Version: 1.41
  Operating System: Docker Desktop
  Total Memory: 25508 MB
08:50:23.507 [main] INFO  org.testcontainers.utility.ImageNameSubstitutor - Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
08:50:27.908 [main] INFO  org.testcontainers.DockerClientFactory - Ryuk started - will monitor and terminate Testcontainers containers on JVM exit
08:50:27.909 [main] INFO  org.testcontainers.DockerClientFactory - Checking the system...
08:50:27.910 [main] INFO  org.testcontainers.DockerClientFactory - ✔︎ Docker server version should be at least 1.6.0
08:50:28.182 [main] INFO  org.testcontainers.DockerClientFactory - ✔︎ Docker environment should have more than 2GB free disk space
08:50:28.231 [main] INFO  🐳 [rabbitmq:3.7.25-management-alpine] - Creating container for image: rabbitmq:3.7.25-management-alpine
08:50:28.454 [main] INFO  🐳 [rabbitmq:3.7.25-management-alpine] - Container rabbitmq:3.7.25-management-alpine is starting: 0170ccc37143c6464678211d9071805fc5f3c37f770da8c406abab96c7557fea
08:50:43.089 [main] INFO  🐳 [rabbitmq:3.7.25-management-alpine] - Container rabbitmq:3.7.25-management-alpine started in PT14.9053765S
08:50:43.304 [main] INFO  🐳 [influxdb:1.7.11] - Creating container for image: influxdb:1.7.11
08:50:43.425 [main] INFO  🐳 [influxdb:1.7.11] - Container influxdb:1.7.11 is starting: 7a19e5c1a264265d6af904fb7183534700ca81701a2b1f6feb9bbdb80df944d7
08:50:44.003 [ducttape-0] INFO  org.testcontainers.containers.wait.strategy.HttpWaitStrategy - /silly_jang: Waiting for 30 seconds for URL: http://localhost:55737/ping (where port 55737 maps to container port 8086)
08:51:13.614 [main] ERROR 🐳 [influxdb:1.7.11] - Could not start container
org.rnorth.ducttape.TimeoutException: java.util.concurrent.TimeoutException
    at org.rnorth.ducttape.timeouts.Timeouts.callFuture(Timeouts.java:70)
    at org.rnorth.ducttape.timeouts.Timeouts.doWithTimeout(Timeouts.java:60)
    at org.testcontainers.containers.wait.strategy.WaitAllStrategy.waitUntilReady(WaitAllStrategy.java:53)
    at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:929)
    at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:468)
    at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:331)
    at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
    at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:329)
    at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:317)
    at com.bosch.bci.trinity.trn.commons.IntegrationTestBase.<clinit>(IntegrationTestBase.java:119)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at org.junit.platform.commons.util.ReflectionUtils.newInstance(ReflectionUtils.java:513)
    at org.junit.jupiter.engine.execution.ConstructorInvocation.proceed(ConstructorInvocation.java:56)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
    at org.junit.jupiter.api.extension.InvocationInterceptor.interceptTestClassConstructor(InvocationInterceptor.java:72)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:77)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestClassConstructor(ClassBasedTestDescriptor.java:342)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateTestClass(ClassBasedTestDescriptor.java:289)
    at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.instantiateTestClass(ClassTestDescriptor.java:79)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:267)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$2(ClassBasedTestDescriptor.java:259)
    at java.base/java.util.Optional.orElseGet(Optional.java:369)
    at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$3(ClassBasedTestDescriptor.java:258)
    at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:101)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:100)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:65)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$1(NodeTestTask.java:111)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:111)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:79)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
    at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.util.concurrent.TimeoutException: null
    at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:204)
    at org.rnorth.ducttape.timeouts.Timeouts.callFuture(Timeouts.java:65)
    ... 76 common frames omitted
08:51:13.682 [main] ERROR 🐳 [influxdb:1.7.11] - Log output from the failed container:
influxdb init process in progress...
ts=2022-01-31T07:50:51.087091Z lvl=info msg="InfluxDB starting" log_id=0ZNmgRoW000 version=1.7.11 branch=1.7.11 commit=f11ad4780c8a61108108a18b141c1d067d920a80
ts=2022-01-31T07:50:51.087216Z lvl=info msg="Go runtime" log_id=0ZNmgRoW000 version=go1.13.8 maxprocs=4
ts=2022-01-31T07:50:51.210496Z lvl=info msg="Using data dir" log_id=0ZNmgRoW000 service=store path=/var/lib/influxdb/data
ts=2022-01-31T07:50:51.210994Z lvl=info msg="Compaction settings" log_id=0ZNmgRoW000 service=store max_concurrent_compactions=2 throughput_bytes_per_second=50331648 throughput_bytes_per_second_burst=50331648
ts=2022-01-31T07:50:51.211281Z lvl=info msg="Open store (start)" log_id=0ZNmgRoW000 service=store trace_id=0ZNmgSIl000 op_name=tsdb_open op_event=start
ts=2022-01-31T07:50:51.211499Z lvl=info msg="Open store (end)" log_id=0ZNmgRoW000 service=store trace_id=0ZNmgSIl000 op_name=tsdb_open op_event=end op_elapsed=0.466ms
ts=2022-01-31T07:50:51.211638Z lvl=info msg="Opened service" log_id=0ZNmgRoW000 service=subscriber
ts=2022-01-31T07:50:51.211869Z lvl=info msg="Starting monitor service" log_id=0ZNmgRoW000 service=monitor
ts=2022-01-31T07:50:51.211905Z lvl=info msg="Registered diagnostics client" log_id=0ZNmgRoW000 service=monitor name=build
ts=2022-01-31T07:50:51.211921Z lvl=info msg="Registered diagnostics client" log_id=0ZNmgRoW000 service=monitor name=runtime
ts=2022-01-31T07:50:51.211932Z lvl=info msg="Registered diagnostics client" log_id=0ZNmgRoW000 service=monitor name=network
ts=2022-01-31T07:50:51.211955Z lvl=info msg="Registered diagnostics client" log_id=0ZNmgRoW000 service=monitor name=system
ts=2022-01-31T07:50:51.212053Z lvl=info msg="Starting precreation service" log_id=0ZNmgRoW000 service=shard-precreation check_interval=10m advance_period=30m
ts=2022-01-31T07:50:51.212090Z lvl=info msg="Starting snapshot service" log_id=0ZNmgRoW000 service=snapshot
ts=2022-01-31T07:50:51.212116Z lvl=info msg="Starting continuous query service" log_id=0ZNmgRoW000 service=continuous_querier
ts=2022-01-31T07:50:51.212136Z lvl=info msg="Starting HTTP service" log_id=0ZNmgRoW000 service=httpd authentication=true
ts=2022-01-31T07:50:51.212151Z lvl=info msg="opened HTTP access log" log_id=0ZNmgRoW000 service=httpd path=stderr
ts=2022-01-31T07:50:51.212161Z lvl=info msg="Auth is enabled but shared-secret is blank. BearerAuthentication is disabled." log_id=0ZNmgRoW000 service=httpd
ts=2022-01-31T07:50:51.213896Z lvl=info msg="Listening on HTTP" log_id=0ZNmgRoW000 service=httpd addr=127.0.0.1:8086 https=false
ts=2022-01-31T07:50:51.213957Z lvl=info msg="Starting retention policy enforcement service" log_id=0ZNmgRoW000 service=retention check_interval=30m
ts=2022-01-31T07:50:51.214607Z lvl=info msg="Listening for signals" log_id=0ZNmgRoW000
ts=2022-01-31T07:50:51.212331Z lvl=info msg="Storing statistics" log_id=0ZNmgRoW000 service=monitor db_instance=_internal db_rp=monitor interval=10s
ts=2022-01-31T07:50:51.214664Z lvl=info msg="Sending usage statistics to usage.influxdata.com" log_id=0ZNmgRoW000
[httpd] 127.0.0.1 - - [31/Jan/2022:07:50:57 +0000] "GET /ping HTTP/1.1" 204 0 "-" "InfluxDBShell/1.7.11" 866dcea2-826a-11ec-8001-0242ac110006 2400
ts=2022-01-31T07:50:57.518707Z lvl=info msg="Executing query" log_id=0ZNmgRoW000 service=query query="CREATE USER admin WITH PASSWORD [REDACTED] WITH ALL PRIVILEGES"
[httpd] 127.0.0.1 - - [31/Jan/2022:07:50:57 +0000] "POST /query?chunked=true&db=&epoch=ns&q=CREATE+USER+%22admin%22+WITH+PASSWORD+%5BREDACTED%5D+WITH+ALL+PRIVILEGES HTTP/1.1" 200 57 "-" "InfluxDBShell/1.7.11" 866e648c-826a-11ec-8002-0242ac110006 116072
[httpd] 127.0.0.1 - admin [31/Jan/2022:07:51:04 +0000] "GET /ping HTTP/1.1" 204 0 "-" "InfluxDBShell/1.7.11" 8a6b6633-826a-11ec-8003-0242ac110006 51
ts=2022-01-31T07:51:04.276464Z lvl=info msg="Executing query" log_id=0ZNmgRoW000 service=query query="CREATE DATABASE trinity_dev"
[httpd] 127.0.0.1 - admin [31/Jan/2022:07:51:04 +0000] "POST /query?chunked=true&db=&epoch=ns&q=CREATE+DATABASE+trinity_dev HTTP/1.1" 200 57 "-" "InfluxDBShell/1.7.11" 8a6b7806-826a-11ec-8004-0242ac110006 82425
[httpd] 127.0.0.1 - admin [31/Jan/2022:07:51:08 +0000] "GET /ping HTTP/1.1" 204 0 "-" "InfluxDBShell/1.7.11" 8d243cc4-826a-11ec-8005-0242ac110006 45
ts=2022-01-31T07:51:08.775587Z lvl=info msg="Executing query" log_id=0ZNmgRoW000 service=query query="CREATE USER \"any\" WITH PASSWORD [REDACTED]"
[httpd] 127.0.0.1 - admin [31/Jan/2022:07:51:08 +0000] "POST /query?chunked=true&db=&epoch=ns&q=CREATE+USER+%22any%22+WITH+PASSWORD+%5BREDACTED%5D HTTP/1.1" 200 57 "-" "InfluxDBShell/1.7.11" 8d244dfe-826a-11ec-8006-0242ac110006 96885
[httpd] 127.0.0.1 - admin [31/Jan/2022:07:51:14 +0000] "GET /ping HTTP/1.1" 204 0 "-" "InfluxDBShell/1.7.11" 90904e31-826a-11ec-8007-0242ac110006 60
ts=2022-01-31T07:51:14.517324Z lvl=info msg="Executing query" log_id=0ZNmgRoW000 service=query query="REVOKE ALL PRIVILEGES FROM \"any\""
[httpd] 127.0.0.1 - admin [31/Jan/2022:07:51:14 +0000] "POST /query?chunked=true&db=&epoch=ns&q=REVOKE+ALL+PRIVILEGES+FROM+%22any%22 HTTP/1.1" 200 57 "-" "InfluxDBShell/1.7.11" 90906088-826a-11ec-8008-0242ac110006 9132

I also wonder about the now deprecated default constructor and VERSION field. This suggest to alwas specify a custom version. But is there a list of supported versions?

Thanks!

kiview commented 2 years ago

Hey @jwedel, thanks for reporting. I just checked our tests with the 1.7.11 image on my Windows 11 with Docker for Windows on WSL2 and everything works fine for me.

What kind of Docker for Windows setup do you use?

jwedel commented 2 years ago

@kiview image

kiview commented 2 years ago

This seems to be an old version of Docker Desktop, current in 4.3.2. Consider updating. Also, are you using WSL2 or Hyper-V backend?

jwedel commented 2 years ago

I’m using WSL2. I’m staying on that version due to the licence foo. Will check if we can now upgrade…

kiview commented 2 years ago

Not sure if this will resolve the issue, just saying I can't reproduce on up-to-date version.

eddumelendez commented 1 year ago

@jwedel Do you have an update on this one? Could you solve the issue?

eddumelendez commented 1 year ago

Closing due to inactivity. @jwedel try latest version, ATM 1.18.3. Also, feel free to reopen the issue.