It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

TestContainers + Bitbucket pipelines not working

Hi!

We are using testContainers to perform integration tests. Unfortunately, we are not being able to execute it using the bitbucket-pipeline.

We are using version 1.11.3 of testContainer to test our software with Cassandra. We are also using junt-jupiter for this.

Locally the tests are performed with any problem. We are disabling ryuk by setting TESTCONTAINERS_RYUK_DISABLED to true in the environment variables.

From the test report there seems to be a problem at the container startup:

Caused by: org.testcontainers.containers.ContainerLaunchException: Container startup failed

Since Cassandra is a huge memory consumer, I double the size for the gradle test step and give 6gb of memory to docker service.

Any idea on how to solve this problem?

Thanks in advance.
André

1 answer

1 accepted

0 votes
Answer accepted

Hi André,

Are there any extra details in the error message? There could be other causes for this issue apart from memory limitations. So it'd help us pinpoint a more specific cause for this to investigate.

Thanks,

Phil

Hey Philip,

Thanks for your reply.

I double the size of the step and give 5gb to docker services. The tests take some time even locally but they all pass. In the pipeline all fail with the same error:

    org.testcontainers.containers.ContainerLaunchException        Caused by: org.rnorth.ducttape.RetryCountExceededException            Caused by: org.testcontainers.containers.ContainerLaunchException                Caused by: org.testcontainers.containers.ContainerLaunchException

It takes some minutes to fail for every test and the same occurs for the ≃ 30 tests.

From the Test Reports, it seems that the container startup fails. The full exception stack trace here:

org.testcontainers.containers.ContainerLaunchException: Container startup failed
 at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:217)
 at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:199)
 at com.webgs.telemetryservice.utils.CassandraTestContainer.initCassandra(CassandraTestContainer.kt:16)
 at com.webgs.telemetryservice.utils.CassandraTestContainer.access$initCassandra(CassandraTestContainer.kt:8)
 at com.webgs.telemetryservice.utils.CassandraTestContainer$instance$2.invoke(CassandraTestContainer.kt:9)
 at com.webgs.telemetryservice.utils.CassandraTestContainer$instance$2.invoke(CassandraTestContainer.kt:8)
 at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
 at com.webgs.telemetryservice.utils.CassandraTestContainer.getInstance(CassandraTestContainer.kt)
 at com.webgs.telemetryservice.utils.CassandraUtils.clearTelemetry(CassandraUtils.kt:9)
 at com.webgs.telemetryservice.telemetry.io.http.TelemetryHandlerTests.cleanup(TelemetryHandlerTests.kt:50)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:628)
 at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:117)
 at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.invokeMethodInExtensionContext(ClassTestDescriptor.java:439)
 at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$synthesizeBeforeEachMethodAdapter$15(ClassTestDescriptor.java:427)
 at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeEachMethods$3(TestMethodTestDescriptor.java:149)
 at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
 at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(TestMethodTestDescriptor.java:169)
 at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeEachMethods(TestMethodTestDescriptor.java:148)
 at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:123)
 at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
 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:125)
 at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
 at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
 at java.util.ArrayList.forEach(ArrayList.java:1257)
 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:139)
 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:125)
 at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
 at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
 at java.util.ArrayList.forEach(ArrayList.java:1257)
 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:139)
 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:125)
 at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
 at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
 at java.util.ArrayList.forEach(ArrayList.java:1257)
 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:139)
 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:125)
 at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
 at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
 at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
 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.DefaultLauncher.execute(DefaultLauncher.java:170)
 at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154)
 at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
 at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:92)
 at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$100(JUnitPlatformTestClassProcessor.java:77)
 at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:73)
 at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
 at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
 at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
 at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
 at com.sun.proxy.$Proxy2.stop(Unknown Source)
 at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:131)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
 at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
 at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:155)
 at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:137)
 at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
 at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
 at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
 at java.lang.Thread.run(Thread.java:748)
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
 at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:83)
 at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:210)
 ... 96 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
 at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:277)
 at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:212)
 at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:76)
 ... 97 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for Cassandra to be accessible for query execution
 at org.testcontainers.containers.wait.CassandraQueryWaitStrategy.waitUntilReady(CassandraQueryWaitStrategy.java:36)
 at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:35)
 at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:582)
 at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:259)
 ... 99 more


We are using these dependencies in our build.gradle:

"testContainers": [
"junit5" : "org.testcontainers:junit-jupiter:1.11.3",
"cassandra": "org.testcontainers:cassandra:1.11.3"
],


Ping me if you need more information.

Thanks,
André

Hi Philip,

Don't know if this will be useful but I tried to run the test locally using moby-engine - which is some kind of fork from docker - and the behavior was the same I notice in the pipeline. All the test take to much time and fail with a timeout. 

 

André

Hey @Philip Hodder

do you have some progress here?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,034 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you