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

Integration test using testcontainers((MongoDB issues)) are failing after upgrading to SpringBoot 2.6.6

I have updated SpringBoot version from 2.1.6 to 2.6.6 and after starting integration tests with testcontainers I am receiving below errors: First error is: 13:25:08.793 [main] ERROR o.s.boot.SpringApplication - Application run…
kemoT
  • 63
  • 8
3
votes
0 answers

Testcontainers: Can't get Docker image

I'm trying to write JUnit tests using testcontainers and the problem is with starting the containers. This is my test class: package com.example; import org.junit.After; import org.junit.Before; import org.junit.ClassRule; import…
tomi
  • 373
  • 1
  • 5
  • 16
3
votes
0 answers

RedisContainer keeps waiting during test [Python Testcontainers]

I want to test my endpoints using RedisContainer from tescontainers but I had a problem during testing. Since it does not respond I wrote a simple code to see whether it works fine but when I start the RedisContainer it stucks at waiting stage…
limewmint
  • 35
  • 3
  • 5
3
votes
2 answers

How can I reuse containers during integration tests with quarkus?

I currently have a few integration tests that are running fine, however I'm using the annotation @QuarkusTestResource to launch containers via testcontainers before quarkus is launched and I adapt my properties to the random test container port by…
Tapaka
  • 367
  • 4
  • 17
3
votes
2 answers

SSL error when testing kinesis with localstack + test containers

I'm running into an issue with trying to connect to kinesis running in a localstack container. I made a small example test using testcontainers but I get the same error in my application. This is the error: [kpl-daemon-0003] WARN…
John Mercier
  • 1,637
  • 3
  • 20
  • 44
3
votes
3 answers

Don't want to use DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD with TestContainers

I am doing an integration test with testcontainers and spring-boot and I am having an issue while initializing the scripts. I have 2 scripts: schema.sql and data.sql. When I use DirtiesContext.ClassMode.AFTER_EACH_TEST_METHODit works fine, but it…
Harry Coder
  • 2,429
  • 2
  • 28
  • 32
3
votes
3 answers

How to connect to testcontainers redis correctly during spring boot integration test?

I am writing test for my service in spring boot @Component public class MyService { @Autowired StringRedisTemplate stringRedisTemplate; // a number of other @Autowired dependencies public User getUser(String uuid) { var key…
Mike
  • 173
  • 4
  • 14
3
votes
1 answer

How can i use testcontainer in mac os with out Docker Desktop?

Today, I heard news that the docker desktop will be not free. So, our team has conclusion to delete Docker Desktop and use minikube. Then, we can use docker cli, but, when we use testContainer in Java project(We use intellij) the testContainer not…
jabel123
  • 85
  • 1
  • 7
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
3 answers

Run Quarkus tests with TestContainers using WSL2 + Podman

With the license change for Docker Desktop on Windows, I'm looking for an alternative. Podman + WSL2 seems to do the trick for me. Except for Testcontainers in my Quarkus tests. I'm able to run my tests within WSL2 by starting podman system service…
kava
  • 31
  • 3
3
votes
1 answer

Spring cassandra No node was available to execute the query

I'm writing integration tests for my Cassandra database, I use testcontainers 1.16.2 with Spring boot 2.6.1 and there's strange behaviour: the result of tests depends on which order they are being executed. This is my application.yml: spring: …
Alexey
  • 362
  • 1
  • 5
  • 17
3
votes
2 answers

How to import sql dump file in MySQLContainer in JUnit test containers

I have a test container for Mysql and I need to import the dump file after the container started. I've tried two options below. public class AbstractTest { public static MySQLContainer mySQLContainer = new MySQLContainer<>("mysql:5.7"); …
Alfred Moon
  • 147
  • 1
  • 11
3
votes
1 answer

Options or alternatives to Testcontainers for Spring Boot integration testing in Kubernetes?

I need to setup integration tests in a Spring Boot project using Postgres, Redis and Elasticsearch (at some point later also Kafka will be added). So far I've found two options: H2 Database and Embedded Redis. This could work but we are using some…
Alex
  • 1,336
  • 10
  • 19
3
votes
2 answers

How to configure time zone in Testcontainers MySQL

May I know how do we configure the time zone in Testcontainers MySQL during testing? Also, how can we verify the time zone in Testcontainers MySQL?
user3357926
  • 435
  • 1
  • 4
  • 13
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