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
0
votes
1 answer

Kotlintest; how to use abstract testcontainers class

We have a Spring Boot project written in kotlin (for the first time) where we want to try kotlintest for writing tests. Our datasource is a postgresql database, and in our tests we utilize org.testcontainers:postgresql in order to not use a separate…
Terje Andersen
  • 429
  • 2
  • 17
0
votes
0 answers

@Transactional not rolling back when using TestContainers

The issue I am seeing, is that @Transactional is causing a transaction to be created and rolled back, however the data is being carried over from one test to the next. Versions in…
rboarman
  • 8,248
  • 8
  • 57
  • 87
0
votes
1 answer

testcontainers - maven build fails due to test failures

My development environment(JDK, Maven) is setup within WSL2. With this setup, there are test failures Below is the output of the build process. 00:18:14.261 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved…
Sudhir
  • 1,339
  • 2
  • 15
  • 36
0
votes
1 answer

Use custom container as database with TestContainer

I'm trying to use TestContainer for an integration test of a Spring Boot application. The database of such application resides in a custom PostgreSQL Docker image. In the integration test the ApplicationContext is started through MockMvc and the…
AleG
  • 108
  • 9
0
votes
1 answer

TestContainers - Is it possible to run containers manually before starting tests?

Using docker-compose.yml and DockerComposeContainer I managed to start the whole stack and run my tests. (To make it faster, I implemented a singleton instance of DockerComposeContainer). This is fast enough when I run all tests together. But in the…
Rad
  • 4,292
  • 8
  • 33
  • 71
0
votes
1 answer

Modify remote driver URL at runtime

I have a project which is based on the serenity-bdd/serenity-cucumber-starter project. I'm using test-containers to start a couple of Docker containers as well as a Selenium Grid container to run the test against. new…
Thomas Schmidt
  • 1,248
  • 2
  • 12
  • 37
0
votes
0 answers

Testcontainers - Run container with different database in integration test

During the maven package phase I build a docker image of my application: com.spotify dockerfile-maven-plugin ${version.dockerfile-plugin}
jwi
  • 1,116
  • 1
  • 18
  • 38
0
votes
2 answers

How set up test containers for paraller runwith docker compose?

Here is docker-compose file: app: image: myimage depends_on: - nsqd - localstack command: ["run.sh"] environment: - "DYNAMODB=http://localstack:4569" ports: - 8080:8080 nsqd: image: nsqio/nsq …
Cherry
  • 31,309
  • 66
  • 224
  • 364
0
votes
1 answer

Starting RabbitMq as GenerigContainer in Gitlab Ci

I have a Spring Boot 2.1 Application which has integration tests. For integration tests purposes i want start a RabbitMq container with testcontainers framework. When I start those on my local machine everything seems to work i can access my…
0
votes
1 answer

How to Configure spring datasource with GenericContainer that's creating a container from a custom MySQL Docker image

I am trying to run an integration test in spring that is using the data access layer but for that i need to connect to a database for me to run the application beans for testing. some of my testing involves using the database persisted data, so…
Brighton
  • 1
  • 1
0
votes
0 answers

Testcontainer access external docker network

I have docker containers running using a network. I run a test which uses BrowserWebDriverContainer, can the testcontainer access the external docker network used by the other docker container, so the testcontainer can access the docker tomcat by…
user518066
  • 1,277
  • 3
  • 23
  • 35
0
votes
2 answers

Repositories with native queries fail in test environment - postgres, jpa, spring

I have set up integration tests for a spring boot project using test containers (sets up a docker instance with postgresql). The tests work great if the repositories that I am testing against do not use native queries. However, whenever a repository…
BPR
  • 3
  • 4
0
votes
1 answer

Unable to open any URLs with Selenium using Chrome driver in Testcontainers

I'm trying to set up a UI testing framework on a project using Selenium in JUnit tests inside of Testcontainers, using IntelliJ IDE to develop. I am using OpenJDK 12.0.1 I have the most basic test that I can think of, but I keep getting Null Pointer…
phillter
  • 3
  • 1
0
votes
1 answer

Use Artifactory proxy to Docker Hub with testcontainers inside a firewall for testing

I'm trying to run tests of a spring boot application when it writes to mongodb using the testcontainers test library. Testcontainers should spin up a Docker image running mongodb. Then I run my test, it connects to the data store, writes something…
Lee Meador
  • 12,829
  • 2
  • 36
  • 42
0
votes
1 answer

running job as a Docker Container in gitlab CI - Docker wormhole pattern

I am trying to run tests inside a Docker container and the following is my gitlab-ci.yml image: openjdk:11 include: - project: 'xxxxxxx/sdlc' file: '/sdlc.yml' services: - docker:dind gradle test: stage: test image: docker:latest …
chom
  • 651
  • 3
  • 9
  • 23