Questions tagged [testcontainers]

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.

Testcontainers is an open source framework for providing throwaway, lightweight instances of databases, message brokers, web browsers, or just about anything that can run in a Docker container.

Define your test dependencies as code, then simply run your tests and containers will be created and then deleted.

https://www.testcontainers.org/

881 questions
3
votes
0 answers

Testcontainers fails to get mapped port on Jenkins kubernates docker in docker

I am trying to run my integration tests with Testcontainers on Jenkins Kubernetes Docker in Docker container. Testcontainer version: 1.15.3 However, it always fails to get the Container.getMappedPort(X) inside the DinD Container. It works absolutely…
theGeek
  • 101
  • 9
3
votes
1 answer

How do we initialize schema in Testcontainers R2DBC?

Currently, I want to create an integration test for my system. I'm using testcontainers to spawn my temporary database instance, and use R2DBC Database to make my system reactive. The problem is I don't know how to create a schema in R2DBC…
3
votes
2 answers

java.lang.IllegalStateException: Previous attempts to find a Docker environment failed. Will not retry. Please see logs and check configuration

I am trying to run my spring boot app junit tests inside docker and then create image of that app. Below is my Dockerfile: FROM adoptopenjdk/openjdk14:alpine-jre as base COPY .mvn/ .mvn COPY mvnw pom.xml ./ RUN ./mvnw -B dependency:resolve-plugins…
Rohit Singh
  • 169
  • 2
  • 2
  • 9
3
votes
1 answer

testcontainers - cannot connect to exposed port of generic container

I am trying to launch a custom docker container using GenericContainer. Once the container is launched, I would like to execute a http request from a test class. I am seeing this error : INFO: Exposed ports: 9000 java.net.ConnectException: Failed…
truthSeekr
  • 1,603
  • 4
  • 25
  • 44
3
votes
1 answer

Testcontainers Couchbase timeouts

I've created a minimal, complete and verifiable example illustrating my problem: https://github.com/Virkom/CouchbaseMCVE. I've created an integration test using Testcontainers and CouchbaseContainer. My gradle.build: implementation…
Virkom
  • 373
  • 4
  • 22
3
votes
1 answer

Test container error when starting docker from macbook m1

I using macbook m1 and i have error when using test container from docker. When i start project using docker it throw me error Docker machine "" does not exist I install virtualbox using command :brew install virtualbox --cask When i install…
BaoTrung Tran
  • 392
  • 2
  • 6
  • 21
3
votes
1 answer

Spring Data JDBC Testcontainers DataSource

With spring boot + spring data jdbc i have to wire the DataSource bean by myself. Like so: @Bean public DataSource dataSource() { HikariConfig hikariConfig = new HikariConfig(); …
Thomas Lang
  • 1,285
  • 17
  • 35
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…
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
3
votes
1 answer

Testcontainers in Windows environment on GitHub Actions: "Could not find a valid Docker environment. Please see logs and check configuration"

We're using testcontainers-java heavily in our spring-boot-admin project. Since we also want to be able to run our Maven build also on Windows, we added a windows-latest environment to our GitHub Actions Pipeline using a Matrix strategy build (as…
jonashackt
  • 12,022
  • 5
  • 67
  • 124
3
votes
2 answers

Is there a way to rollback a Transaction in Quarkus Unit Tests?

I'm trying to learn some new things using Quarkus, and I kinda got stuck on something: I want to create some tests that are self sustained, I mean, I should be able to run each one independently of each other. I'm using Testcontainers(PostgreSQL) to…
Johnnes Souza
  • 361
  • 1
  • 8
  • 22
3
votes
1 answer

How to restart testcontainers container?

I have server and client applications. Server is launched inside docker container. I want to test scenario that server crashes and comes back. Client is connected to server before crash and automatically connects to server when server is back. The…
Mariusz
  • 1,907
  • 3
  • 24
  • 39
3
votes
0 answers

Testcontainers: execute TC_INITSCRIPT at each test

In a quakus project, I successfully set up testcontainers using only the following…
Rolintocour
  • 2,934
  • 4
  • 32
  • 63
3
votes
1 answer

Examining contents of TestContainers

I am using a PostgreSQL TestContainer to test Liquibase schema migration in Spring Boot. I don't have any respositories. I am wondering if I can see/access the contents of the TestContainer, and test the schema migration.