You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To test our opensearch cluster functionality we have many Junit 5 tests using localstack-utils annotations as below.
@ExtendWith(LocalstackDockerExtension.class)
@LocalstackDockerProperties(portEdge = "3000", portElasticSearch = "3100", services = { ServiceName.S3, ServiceName.ELASTICSEARCH_SERVICE })
@ExtendWith(SpringExtension.class)
public class MyOpenSearchTest {
...
}
Everything works fine when running the junit tests one by one.
However, since we have many test classes and it takes ~1 minute for the docker container to startup, we tried to speed up overall test duration by doing the following:
use a different portEdge and portElasticSearch in @LocalstackDockerProperties for each junit test class
we enabled parralel junit tets execution by adding the lines below to file /resources/junit-platform.properties
With the above chganges, the junit tests are started in parallel but we get this error:
java.lang.IllegalStateException: A docker instance is starting or already started.
at cloud.localstack.Localstack.startup(Localstack.java:67)
at cloud.localstack.docker.LocalstackDockerExtension$StartedLocalStack.<init>(LocalstackDockerExtension.java:57)
at cloud.localstack.docker.LocalstackDockerExtension.beforeAll(LocalstackDockerExtension.java:42)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$invokeBeforeAllCallbacks$7(ClassTestDescriptor.java:358)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.invokeBeforeAllCallbacks(ClassTestDescriptor.java:358)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.before(ClassTestDescriptor.java:197)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.before(ClassTestDescriptor.java:74)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:102)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:71)
at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:169)
at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1311)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1840)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1806)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
To test our opensearch cluster functionality we have many Junit 5 tests using localstack-utils annotations as below.
Everything works fine when running the junit tests one by one.
However, since we have many test classes and it takes ~1 minute for the docker container to startup, we tried to speed up overall test duration by doing the following:
With the above chganges, the junit tests are started in parallel but we get this error:
we are using this dependency:
How can we run these Junit tests in parallel without getting this error?
The text was updated successfully, but these errors were encountered: