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.

-1
votes
1answer
36 views

Using Docker and Testcontainers for database integration testing

After a bit of research I was led to think that Docker containers could be a good fit for database integration testing using test containers, as this would only require a Docker container running a ...
1
vote
0answers
31 views

Issue when executing Gitlab CI pipeline job running integration test with Testcontainers

I have a Spring Boot application test that used TestContainers (https://www.testcontainers.org) to run some integration tests against a KafkaContainer. When running locally everything is fine, but ...
0
votes
1answer
22 views

Using testcontainers in a Jenkins Docker Agent: containers fail to start, NoRouteToHostException

I'm using a Jenkins declarative pipeline with Docker Agents to build and test my software, including running integration tests using testcontainers. I can run my testcontainers tests OK in my ...
2
votes
1answer
26 views

Why aren't these database modifications rolled back despite the presence of an `@Transactional`?

Written a short convenicence extension for Testcontainers: fun JdbcDatabaseContainer<*>.execute(query:DSLContext.()-> Query){ val connection = DriverManager.getConnection(this.getJdbcUrl(...
0
votes
1answer
16 views

How you manage EM or EMF in integration testing with testcontainers?

I have java web application and I would like to write integration tests for service layer. I decided to use testcontainers, so in test I would like to call service, which will work with database in ...
0
votes
0answers
20 views

Ordered starting and waiting for containers

I have two containers in my tests using @Testcontainers with Junit5, a Kafka and a KafkaConnect. @Container private final KafkaContainer kafka = new KafkaContainer() .withNetwork(network) ...
0
votes
0answers
37 views

Error Can not connect to Ryuk in CircleCi

There is config for CircleCI. On the local machine, when you run CircleCI, everything passes. In this case, the server is a lot of mistakes, one of them is java.lang.IllegalStateException: Can not ...
0
votes
3answers
70 views

Configuring Minio server for use with Testcontainers

My application uses Minio for S3-compatible object storage, and I'd like to use the Minio docker image in my integration tests via Testcontainers. For some very basic tests, I run a GenericContainer ...
0
votes
1answer
30 views

How to migrate JDBC URL based testcontainers to Junit 5

I have worked spring boot + testcontainers test based on JUnit 4. Example: @RunWith(SpringRunner.class) @SpringBootTest public Test { ... public void someTest() { ... } ... }...
-1
votes
1answer
50 views

Can't connect to docker via ssh using testcontainer

My task is connected to the container via ssh from tests. I have dockefile: (almost from https://docs.docker.com/engine/examples/running_ssh_service/) FROM ubuntu:18.04 RUN apt-get update RUN apt-...
0
votes
2answers
61 views

Producer#initTransactions doesn't work with KafkaContainer

I try to send messages to Kafka with a transaction. So, I use this code: try (Producer<Void, String> producer = createProducer(kafkaContainerBootstrapServers)) { producer....
1
vote
0answers
52 views

How to test Gitlab-ci Docker + Spring Boot + Testcontainers + Wkhtmltopdf

My question is regarding following problem: I want to test the setup of my Wkhtmltopdf service structure Therfore I want to use Gitlab-ci + Docker and Gitlab-Runners The server framework I am using ...
0
votes
0answers
23 views

Testcontainers : communicating between different networks

I am trying to build tests with containers on separated networks, but that can communicate with each other. The test is built with : A "server" network with two containers (postgres, api server) A "...
0
votes
0answers
35 views

Running Selenide Tests with Docker in Parallel with Testcontainers?

https://github.com/selenide-examples/testcontainers Shows how to run selenide tests standalone with a single annotation from asolntsev. I just struggle to get the tests to execute in Parallel with ...
5
votes
2answers
166 views

How do you include postgresql.conf on docker container when using org.testcontainers

Is it possible to give postgresql testcontainer a custom postgresql.conf file via config? I have included maven dependency <dependency> <groupId>org.testcontainers</...
0
votes
1answer
29 views

bitbucket pipeline with docker container

I have a project that I am building with maven. The test case uses test containers to start up a MS-SQLserver instance. The pipeline is currently failing. The reason being the pipleline image I am ...
1
vote
1answer
101 views

Is it possible to use a local Docker image in a docker-compose file for DockerComposeContainer?

In my docker-compose.yaml file I use the image "my-service" (among other remote images that work fine) version: "2" services: myservice: image: my-service Normally I build the "my-service" ...
0
votes
1answer
17 views

MySQL Integration Test “Query not found”

When running a testcontainers MySQL, @ClassRule public static final MySQLContainer mysql = (MySQLContainer) new MySQLContainer("mysql:5.6").withInitScript("init/test.sql") I get the error "Query not ...
0
votes
1answer
235 views

Integration test problem using test containers and docker “Caused by: java.lang.NullPointerException: containerId was not specified”

I am super new to testcontainers. I am not even sure what I am trying to do make any sense or if there is a better approach for it. Goal: Write an integration test for my MongoDb Repository. I am ...
0
votes
1answer
70 views

How to execute kafka-configs command inside testcontainers kafka image

I'm using testcontainers kafka image which is confluent cp-kafka, I need to amend kafka config using command: ./kafka-configs.sh --alter --entity-name <TOPIC_NAME> --entity-type topics --add-...
0
votes
2answers
55 views

Error when using TestContainers DB via JDBC URL but works with @Rule

I'm trying to use TestContainers for my integration tests. I started using it instantiating objects like: @ClassRule public static PostgreSQLContainer postgres = (PostgreSQLContainer) new ...
0
votes
0answers
46 views

( OracleContainer + MockServer ) java.net.ConnectException: Connection refused: no further information: localhost/0:0:0:0:0:0:0:1:49561

Framework : Play 2.6.x TestContianer : "org.testcontainers" % "oracle-xe" % "1.10.5" Trying to writing testcases for oracle-container by mocking WSClient Cause : When calling internal service by ...
0
votes
1answer
96 views

simulate network outage for database with testcontainers

I am trying to simulate a network outage with testcontainers. I wanted to use a Socat container to expose the port, and then shot it down, and up again. I couldn't manage this as there are no halt. ...
0
votes
2answers
279 views

Spring boot, ElasticSearch and TestContainers integration tests. Connection refused

I create an integration test for retrieving data from elasticsearch. I am using default values for the testContainer so my RestHighLevelClient should have access to the test container but all the ...
0
votes
1answer
57 views

Go get problem when using testcontainer-go

I was trying out the sample of the page https://github.com/testcontainers/testcontainer-go package main import ( "context" "fmt" "net/http" "testing" testcontainer "github.com/...
0
votes
1answer
47 views

Database deadlock after spock method test execuction

I try to write integration test in spock with Spring Boot and testcontainers library. I have created a IntegrationSpec base class for all my integration test like below: @TypeChecked @CompileStatic @...
0
votes
1answer
128 views

Kafka test container flaky tests

Integrated kafka into my spring project. Have written an integration using TestContainer approach but tests fails from time to time. Seems like some problem with the initialisation of kafka server. ...
0
votes
0answers
50 views

How to override spring application properties in test classes? Spring’s @ContextConfiguration breaks when using Kotlin inner classes

I’m currently trying to change some Spring configuration properties in test code (they aren’t static, that’s why). There’s this odd thing when I try to solve my problem with @ContextConfiguration(...
0
votes
0answers
842 views

Cannot connect to the Docker daemon at unix:///var/run/docker.sock on OSX

I've created a Scala project that creates a testcontainer (via com.dimafeng.testcontainers) with two Docker's containers (singularities/datastore-emulator and bigtruedata/gcloud-pubsub-emulator). The ...
1
vote
1answer
315 views

Problem with DB container in TestContainers using SpringBootTest

I have an abstract class BaseIntegrationTest that use TestContainers. The problem is when I'm trying to run a simple DB test like UserRepositoryIntSpec I have an exception, which means that count ...
2
votes
2answers
134 views

Unable to find the path PostgreSQLContainer testContainers

I am unable to find my resource map when using Test Containers, in Postgres version. I am trying something like it: private static PostgreSQLContainer postgresqlContainer = new ...
2
votes
0answers
63 views

“linkablecontainer not found” when using testcontainers

I want to use testcontainers (https://www.testcontainers.org/usage.html) So I imported the corresponding Maven dependencies: <dependency> <groupId>org.testcontainers</groupId> ...
0
votes
2answers
48 views

Detect Docker runtime on host using environment variables

I would like to run tests verifying the correct execution of Flyway migrations using TestContainers. Using JUnit5, I would like to enable these tests only on a host that have a Docker daemon running (...
2
votes
1answer
408 views

How to properly run spock test using testcontainers in spring boot

I have a spring boot app, with test written using spock and testcontainers (mysql). What I've made is working fine, but it doesn't feel right (f.e. becuase @sql goes for each test iteration so I have ...
1
vote
1answer
84 views

Is it possible for a Spring Batch to start a Container with an external app?

Let's say we have a REST app with its REST end-points that we can wrap in a Docker container. Let's say our Spring batch's Item Processor likes to use the above app to get business logic information ...
1
vote
2answers
358 views

Spring Cloud: testing S3 client with TestContainters

I use Spring Cloud's ResourceLoader to access S3, e.g.: public class S3DownUpLoader { private final ResourceLoader resourceLoader; @Autowired public S3DownUpLoader(ResourceLoader resourceLoader) { ...
4
votes
5answers
693 views

Populate a database with TestContainers in a SpringBoot integration test

I am testing TestContainers and I would like to know how to populate a database executing a .sql file to create the structure and add some rows. How to do it? @Rule public PostgreSQLContainer ...
0
votes
1answer
251 views

Cannot access org.openqa.selenium.WrapsDriver Selenide + TestContainers

I am trying to use Selenide 5.0.0 with TestContainers 1.9.1 dependencies { testCompile 'com.codeborne:selenide:5.0.0' testCompile 'org.testcontainers:selenium:1.9.1' } Apparently, these ...
1
vote
0answers
70 views

TestContainers: reuse network from DockerComposeContainer to use in other GenericContainer?

There is a method: org.testcontainers.containers.GenericContainer#withNetwork which I can use to spawn containers with a same network using TestContainers lib. But what about DockerComposeContainer,...
2
votes
1answer
348 views

Using custom DB docker-image with Testcontainers

I'm novice in Testcontainers, so i have a question. I have application on Spring/Hibernate. I have docker-image (h2testbase) with mysql-base (myTestDb) with data. I run that image in docker with -p ...
0
votes
0answers
38 views

OracleTestcontainer starting with random ports

currently OracleContainer return JDBC_URL with random port. Because of this I am not able to connect to the DB from application. Currently my application JDBC_URL configured in a property file and and ...
0
votes
1answer
176 views

Running a single test from a Suite with @ClassRule fails

To create the environment just once and to avoid inheritance I have defined a JUnit Suite class with a @ClassRule: @RunWith(Suite.class) @Suite.SuiteClasses({ ...
0
votes
1answer
450 views

How to run test Containers with spring boot and spock

I want to use test container with spock on my spring boot application. these are my dependencies : dependencies { compile('org.springframework.boot:spring-boot-starter-data-redis') compile('...
0
votes
2answers
324 views

Static container name when running Testcontainers with docker compose

My application consists of a Spring Boot app and a database. I can successfully run them in Docker using docker-compose. I now want to use a similar Docker compose file along with testcontainers to ...
1
vote
1answer
80 views

Starting only one service from a compose file with DockerComposeContainer

Is that possible somehow to run only specific services? Taking the official documentation: https://github.com/testcontainers/testcontainers-java/blob/master/docs/usage/docker_compose.md In the ...
0
votes
0answers
22 views

JUNIT 5 extentions accross classes [duplicate]

On the project we are working on, we do intensively rely on docker containers for testing. (https://www.testcontainers.org/) For speed reasons, I do need to launch a single Docker container for a ...
0
votes
0answers
251 views

Usage of DockerComposeContainer for a remote docker daemon

I am using DockerComposeContainer to deploy a custom docker-compose.yml, which describes the environment used during the integration tests. This has been working great so far. I recently started using ...
1
vote
1answer
41 views

Run database once per Spek suite

Some tests require running a database, for instance, using Test Containers Library. It obviously takes time to boot it up. Is there a way to do this only once per entire Spek suite which spans across ...
0
votes
1answer
322 views

Testcontainers with a company proxy

Each start of different testcontainers will throw com.github.dockerjava.api.exception.InternalServerErrorException: {"message":"Get https://quay.io/v1/_ping: dial tcp x.x.x.x: getsockopt: connection ...
0
votes
1answer
278 views

Testcontainer's Redis container connects to a different container then the one defined in the test

I'm doing integration tests in my Spring Boot app. The app needs a Redis to work with. During development phase, I have a local container of Redis that the app connects to. For the integration tests,...