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
vote
0answers
51 views

Wait for 0.0.0.0:8080 instead of localhost:8080

In GenericContainer class, it exists a method waitingFor, that waits for status code 200 as reponse from the server. I am running a web application in a container and use 0.0.0.0 as host instead of ...
1
vote
0answers
42 views

Timed out waiting for container port to open (localhost ports: [32773] should be listening)

I am trying to use https://github.com/testcontainers/testcontainers-scala that is inherent from https://www.testcontainers.org/ as the following: final class MessageSpec extends BddSpec with ...
0
votes
1answer
51 views

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 ...
0
votes
0answers
29 views

How to create a TestContainers base test class in Kotlin with JUnit 5

I am trying to use Neo4j TestContainers with Kotlin, Spring Data Neo4j, Spring Boot and JUnit 5. I have a lot of tests that require to use the test container. Ideally, I would like to avoid copying ...
0
votes
0answers
30 views

TestContainers don't remove network, created via docker-compose.yml

I have multimodule maven project. In each module in tests I use TestContainers with docker-compose. I created abstract class with static block: public abstract class AbstractIntegrationTest { ...
0
votes
1answer
36 views

How to overwrite ports defined in application.properties in integration tests after testcontainer started?

Assume I want to integration test code relying on a JPA datasource in a Spring Boot 2.x application with a PostgreSQL testcontainer (great tool for managing Docker containers from within test classes ...
0
votes
1answer
24 views

HBase + TestContainers - Port Remapping

I am trying to use Test Containers to run an integration test against HBase launched in a Docker container. The problem I am running into may be a bit unique to how a client interacts with HBase. ...
1
vote
0answers
25 views

testcontainers-go: p.client.DaemonHost undefined

I am trying to add TestContainers-Go to my project. I use glide and TestNginxLatestReturn example from Github readme file. In glide I put - package: github.com/testcontainers/testcontainers-go ...
0
votes
0answers
21 views

Message group Id is null for FIFO queue

I am using the testcontainers module with localstack for integration testing. We use FIFO queues and set the message group id in the SendMessageRequest for the queue's in our application. While the ...
0
votes
1answer
19 views

SpringBoot Integration testing Sybase and Testcontainers

Is it possible to use a sybase database with Testcontainers to do the integration testing with spring boot? I can not install docker on my local machine.
0
votes
1answer
43 views

Testcontainers and Spring Boot 1.5

We are still using Spring Boot 1.5.x and we want to start using TestContainers. However, all examples are with Spring boot 2.x which is using TestPropertyValues class only available in 2.x. Is it even ...
-1
votes
1answer
111 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
49 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 ...
1
vote
1answer
109 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
27 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
17 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
34 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
46 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
107 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
42 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
56 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
65 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
70 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
27 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
43 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 ...
6
votes
2answers
211 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
38 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
194 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
18 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
384 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
77 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
75 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
64 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
100 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
347 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
68 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
51 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
161 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
63 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
943 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
379 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
152 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
67 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
55 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
464 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
96 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
413 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
847 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
287 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
84 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,...