Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: testcontainers-java tests are failling with Timeout ( withStartupTimeoutSeconds has no effect ) #9218

Closed
jpmartins opened this issue Sep 11, 2024 · 6 comments
Labels

Comments

@jpmartins
Copy link

Module

Oracle XE

Testcontainers version

1.20.1

Using the latest Testcontainers version?

Yes

Host OS

macOs 14.6.1

Host Arch

ARM (Apple M2)

Docker version

Client:
 Cloud integration: v1.0.35+desktop.4
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:28:49 2023
 OS/Arch:           darwin/arm64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          27.1.1
  API version:      1.46 (minimum version 1.24)
  Go version:       go1.21.12
  Git commit:       cc13f95
  Built:            Tue Jul 23 19:57:14 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.19
  GitCommit:        2bf793ef6dc9a18e00cb12efb64355c2c9d5eb41
 runc:
  Version:          1.7.19
  GitCommit:        v1.1.13-0-g58aa920
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

What happened?

Trying to run testSID from

.

Fails after 1 minute, even if using .withStartupTimeoutSeconds(20*60).

Error message is ilogical, I do not understand what is going on, since OracleContainer Log should not wait for '.Started.' but for '.DATABASE IS READY TO USE!.'.

Relevant log output

17:30:33.412 INFO  tc.testcontainers/ryuk:0.9.0 - Container testcontainers/ryuk:0.9.0 is starting: 0a4daa15b95b94bdb9a50ff25f713408124ff96d54616c7f76383943fcd47add
17:31:34.492 ERROR tc.testcontainers/ryuk:0.9.0 - Could not start container
java.lang.IllegalStateException: Wait strategy failed. Container is removed
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:511)
	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:354)
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:344)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:330)
	at org.testcontainers.utility.RyukResourceReaper.maybeStart(RyukResourceReaper.java:78)
	at org.testcontainers.utility.RyukResourceReaper.init(RyukResourceReaper.java:42)
	at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:245)
	at org.testcontainers.DockerClientFactory$1.getDockerClient(DockerClientFactory.java:108)
	at com.github.dockerjava.api.DockerClientDelegate.authConfig(DockerClientDelegate.java:109)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:329)
	at org.testcontainers.junit.oracle.SimpleOracleTest.runTest(SimpleOracleTest.java:28)
	at org.testcontainers.junit.oracle.SimpleOracleTest.testSID(SimpleOracleTest.java:80)
	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:566)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:112)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:40)
	at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:60)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:52)
	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:566)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for log output matching '.*Started.*'
	at org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy.waitUntilReady(LogMessageWaitStrategy.java:47)
	at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:52)
	at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:909)
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:500)

Additional Information

Using IntelliJ, java 17.

% colima status

INFO[0000] colima is running using QEMU
INFO[0000] arch: x86_64
INFO[0000] runtime: docker
INFO[0000] mountType: sshfs
INFO[0000] socket: unix:///Users/myuser_is_private_data_so_changed_after_paste_here/.colima/default/docker.sock

Guess it should not be relevant I am on a VPN network (there is a proxy envolved).

@jpmartins jpmartins changed the title [Bug]: [Bug]: withStartupTimeoutSeconds not being respected, and waiting for log wrong pattern Sep 11, 2024
@jpmartins jpmartins changed the title [Bug]: withStartupTimeoutSeconds not being respected, and waiting for log wrong pattern [Bug]: withStartupTimeoutSeconds not being respected, and waiting for wrong log pattern Sep 11, 2024
@jpmartins jpmartins changed the title [Bug]: withStartupTimeoutSeconds not being respected, and waiting for wrong log pattern [Bug]: withStartupTimeoutSeconds not being respected, and waiting for a wrong log pattern Sep 11, 2024
@jpmartins
Copy link
Author

jpmartins commented Sep 11, 2024

Timeout with same error message happened in every test module I run, and also happens outside IntelliJ if run from the command line using:
./gradlew test

@jpmartins
Copy link
Author

jpmartins commented Sep 12, 2024

After reading and understanding a bit more on how testcontainers work (I recommend reading the https://www.continuum.be/en/blog/testcontainers-to-the-rescue/) I realised that the timeout is starting the ryuk-container not the OracleContainer.

@jpmartins jpmartins changed the title [Bug]: withStartupTimeoutSeconds not being respected, and waiting for a wrong log pattern [Bug]: withStartupTimeoutSeconds not being respected Sep 12, 2024
@jpmartins jpmartins changed the title [Bug]: withStartupTimeoutSeconds not being respected [Bug]: testcontainers-java failling with Timeout even withStartupTimeoutSeconds Sep 12, 2024
@jpmartins jpmartins changed the title [Bug]: testcontainers-java failling with Timeout even withStartupTimeoutSeconds [Bug]: testcontainers-java failling with Timeout ( withStartupTimeoutSeconds has no effect ) Sep 12, 2024
@jpmartins jpmartins changed the title [Bug]: testcontainers-java failling with Timeout ( withStartupTimeoutSeconds has no effect ) [Bug]: testcontainers-java tests are failling with Timeout ( withStartupTimeoutSeconds has no effect ) Sep 12, 2024
@jpmartins
Copy link
Author

jpmartins commented Sep 12, 2024

I have a running docker daemon, with the DOCKER_HOST variable set to unix://$HOME/.colima/default/docker.sock

When i to:
docker run testcontainers/ryuk

I get:

2024/09/12 12:10:28 Pinging Docker...
panic: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

goroutine 1 [running]:
main.main()
/go/src/github.com/testcontainers/moby-ryuk/main.go:36 +0x457

@jpmartins
Copy link
Author

Hoping some solution can be found... on the ryuk project side testcontainers/moby-ryuk#161.

Any help will be most appreciated. Thanks.

@jpmartins
Copy link
Author

Got it working with docker-desktop instead of colima.

@jpmartins
Copy link
Author

Ryuk official support is for Docker-Desktop only. testcontainers/moby-ryuk#161 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant