Questions tagged [testcontainers-junit5]
89 questions
16
votes
5 answers
Testcontainers with Podman in Java tests
Is it possible to use Testcontainers with Podman in Java tests?
As of March 2022 Testcontainers library doesn't detect an installed Podman as a valid Docker environment.
Can Podman be a Docker replacement on both MacOS with Apple silicon (local…

Eugene Khyst
- 9,236
- 7
- 38
- 65
16
votes
2 answers
Mongo driver with @Testcontainers, throws exceptions after tests run successfully
I'm setting up integration tests in a sample spring boot kotlin project, using testcontainers:mongodb.
I've set up a MongoDBContaine, and everything works as expected - the app connects to the mongodb and tests with repositories (e.g. save, delete)…

eja
- 4,677
- 3
- 21
- 30
9
votes
2 answers
testcontainer initializationError while running a test suite
I have multiple test classes running the same docker-compose with testcontainer.
The suite fails with initializationError although each test passes when performed separately.
Here is the relevant part of the stacktrace occuring during the second…

aiqency
- 1,015
- 1
- 8
- 22
7
votes
2 answers
Testcontainer cannot configure port binding
I'm using testcontainer version 1.15.2. Tests are run in intellij on windows 10.
I have a wiremock container. By default it listens on the port 8080. I would like to map this port to let's say 8081. So I do:
public WiremockContainer() {
…

Filip Kowalski
- 144
- 1
- 3
- 15
6
votes
0 answers
Testcontainers: FileNotFoundException: .testcontainers.properties
I am getting issues with running integration tests (using JUnit5) of my micronaut app on my Windows 10 Pro machine. My tests depend on two containers, that I defined using Testcontainers java library: RabbitMQ and MS SQL server. The Docker version…

Hutsul
- 1,535
- 4
- 31
- 51
6
votes
3 answers
java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
I have a docker image called myImageName:latest, which I use in my application.
I want to write an integration test for my application, therefore I want to use the TestContainer package. When I run the following simple test:
@Testcontainers
public…

Oded
- 336
- 1
- 3
- 17
5
votes
3 answers
Testcontainers: docker-machine executable was not found on PATH
I have two spring boot projects both with the same JDK and running on the same machine (apple m1). The first project is just a dummy project with just testcontainer dependency in it.
While the second project is a legacy project in which i was…

pankaj kumar
- 119
- 1
- 1
- 8
4
votes
0 answers
TestContainer can't start due to error: Timed out waiting for log output matching
I got "ContainerLaunchException: Timed out waiting for log output matching" when starting testcontainer for elasticserach. How should I fix this issue?
container = new ElasticsearchContainer(ELASTICSEARCH_IMAGE)
…

Abe
- 310
- 3
- 15
4
votes
0 answers
Making Testcontainers restartable with Kotlin, JUnit, and Spring Boot
I'm trying to integrate restartable Testcontainers into an application that uses JUnit and Kotlin.
The way I do it currently, is to have a companion class in every test suite where I set up the container and the Spring Boot properties, like so:
…

Cube.
- 483
- 6
- 15
3
votes
1 answer
Unable to connect to Ryuk?
Hi I am trying to spin up a test container from my unit test class.
from my test class i am using the following
@Container
private static GenericContainer> testContainer = new GenericContainer<>(TEST_IMAGE)
.withCommand("sleep…

Starbucks Admin
- 585
- 1
- 8
- 21
3
votes
0 answers
Binding volume with 'withFileSystemBind' -> Permission Denied
i bind a volume to my GenericContainer as follows:
@Container
public GenericContainer ap = new GenericContainer(DockerImageName.parse("myImage:latest"))
.withExposedPorts(AP_PORT)
…

naturzukunft
- 79
- 1
- 8
3
votes
0 answers
Could not find a valid Docker environment. Please see logs and check configuration
I'm trying to write integration tests in Spring Boot Kotlin using Junit5. I'm using the Test containers to test the data access layer of my application. I have initialized my docker image. Please refer my below code.
@Container
var…

Anjana
- 366
- 5
- 21
3
votes
1 answer
Connection Timeout with testcontainers and redis
I do integration tests using Spring Boot, TestContainers, redis and Junit 5.
I am facing a weird behavior, when I all the integration tests, I keep having this log displaying :
Cannot reconnect to [localhost:55133]: Connection refused:…

Dimitri
- 8,122
- 19
- 71
- 128
3
votes
1 answer
Does Testcontainers/LocalStack work with DynamoDb Streams KCL 1.x?
Problem Statement
I have written a program which utilizes DynamoDb Streams to get notified when an update occurs, this code works fine when using AWS Services but doesn't seem to work utilizing Testcontainers/Localstack for my integration…

Jim M.
- 909
- 1
- 12
- 29
3
votes
3 answers
Micronaut to reuse testcontainer
I am using Micronaut 2.4.0 and using testContainers for SQL Server Integration testing.
Here is my gradle.build
testImplementation("org.testcontainers:testcontainers")
testImplementation("org.testcontainers:junit-jupiter")
…

Akshay
- 3,558
- 4
- 43
- 77