1,186 questions
0
votes
1
answer
42
views
Why does `.WithInitScripts` not run my SQL files?
Description
I am using a test Postgres container (from testcontainers) for more accurate integration tests. To prevent repeating code, I want to use my existing SQL migration files to setup the ...
0
votes
1
answer
59
views
Configuring same network for multiple generic containers does not work
I am trying to create multiple containers using testcontainers lib which are sharing the same Network. What do I have right now is the following:
network = Network.newNetwork();
container1 = new ...
0
votes
2
answers
88
views
Spring boot - @ServiceConnection doesn't work with KafkaTestContainer
I'm using Spring boot 3.5.6 and below is my container configuration
package com.transmonix.utils;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org....
0
votes
0
answers
63
views
Testcontainers.CosmosDb takes a long time to be ready
I'm working on an Integration test, where I want to use Testcontainers.CosmosDb, however it takes quite a long time (about 2min) for the CosmosDb to be ready.
var network = new NetworkBuilder()
...
151
votes
24
answers
236k
views
Test Container test cases are failing due to "Could not find a valid Docker environment"
I am very new to using test containers. My test is failing with below exception.
Running com.mastercard.example.testcontainers.testcontainersexampple.DemoControllerTest
2020-04-08 14:27:08.441 INFO ...
1
vote
0
answers
39
views
Conditional data sources in SpringBoot integration test
I have a SpringBoot app and I have added JUnit5 integration tests that use testcontainers:
class ControllerClassTest extends AbstractIntegrationTest {
@ParameterizedTest(name = "{0}")
...
0
votes
0
answers
32
views
Spanner emulator slow connection at start
When using Spanner Emulator with Testcontainers, it starts up pretty quickly (1-2 seconds) but then the connection from Java takes a very long time (even 2 minutes!). I start it up with:
new ...
0
votes
2
answers
1k
views
How to bring up redis cluster using testContainers in java
I'm trying to create a Redis cluster using TestContainers to test my application, which depends on a Redis cluster. Here's what I have tried so far:
Code snippet for starting container:
Network ...
0
votes
0
answers
94
views
Unable to Connect to Azurite Container from Custom Engine Container in Integration Tests
I'm currently working on integration tests for my project, which consists of two main components: an application and an engine. Both components are deployed into Azure Container Apps. The engine ...
5
votes
1
answer
193
views
ServiceBus testcontainer not starting
Trying to create an integrationtest with a 'TestContainer.ServiceBus', however I'm not able to start the container, it just timesout, without not information about the reason.
[Fact]
public async Task ...
1
vote
3
answers
635
views
Kafka Schema Registry failed to connect to Kafka Broker (Testcontainers)
I need to write an integration test for Kafka and Schema Registry working together because of utilizing AVRO serialization.
My Maven configured as following (Apple M2 Max)
% mvn -version
Apache Maven ...
1
vote
1
answer
93
views
.NET - TestContainers many instance PostgreSql conflict
I'm writing integration tests in my .NET Web API. I'm using XUnit for this. I am using factory and collection. And everything works as expected. I run factory there I have used PostgreSql database ...
58
votes
8
answers
68k
views
How to reuse Testcontainers between multiple SpringBootTests?
I'm using TestContainers with Spring Boot to run unit tests for repositories like this:
@Testcontainers
@ExtendWith(SpringExtension.class)
@ActiveProfiles("itest")
@SpringBootTest(classes = ...
0
votes
2
answers
343
views
Test Springboot + SQS + Localstack throws exceptions
I have an application with Springboot and AWS Cloud SQS and I want to test it using Localstack.
All my tests run with a green status successfully, but my terminal is full of errors. The errors are as ...
0
votes
1
answer
99
views
Testcontainers and microservices: how to start a second container that the first is trying to call
I'm writing integration tests using Testcontainers in a Spring Boot application. I am testing the user service, which calls the authentication service in order to encode the password when a user is ...
0
votes
1
answer
151
views
Using TestContainers how do I create a container for each test file?
We are using Testcontainers.PostgreSql for functional testing in an API we are making and currently a new container is being made for each individual test. This is causing problem when running all the ...
2
votes
1
answer
82
views
Testcontainers test isolation for all CRUD operations using Spring
I'm facing a problem where one of my integration tests affects the other. For example this delete test:
class DeleteCustomerIntegrationTest extends AbstractConfigurationTest {
@Test
void ...
0
votes
1
answer
292
views
Testcontainer not running inside docker
I have just migrated my code to Testcontainer (for testing). If I run the test locally with Docker enabled, the test runs fine.
Now, the issue comes when I try to run the same test in Docker [Docker-...
7
votes
2
answers
9k
views
When using Colima to start and run docker containers facing issue when creating container from image testcontainers/ryuk
docker run <ryuk_image_id>
fails because of the following error:
panic: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I have set up the ...
0
votes
1
answer
80
views
How to define a TestConfiguration for TestContainers?
I have multiple test classes that use the mongo test container. Instead of declaring a container using the same code multiple times, I wanted to create a test configuration, to avoid repetitive code. ...
0
votes
1
answer
64
views
.NET elasticsearch testcontainer tests fail in run mode, but succeed in debug mode
I use NUnit and Testcontainers to test my custom method for fetching data from Elasticsearch. The code to interact with elasric is this
using ArticleStorage.Api.Models;
using ArticleStorage.Api.Models....
0
votes
1
answer
186
views
How would I structure my annotation and Spring Configurations so that I can use an annotation to set up a TestContainer test without an abstract class
I want to be able to simply do
@MyTestConfig
class MyTests {
@Autowired SomeJpaRepo repo;
@Test
void findAll() {
assertThatCode(repo::findAll).doesNotThrowAnyExceptions();
}
}
What I ...
1
vote
1
answer
187
views
DBRider(DBUnit) won't insert data into test container in spring boot
Can anyone using DBRider / Test Container in spring boot give advice ?
I've been using DBRider/Testcontainer without any issue, but at some point , it doesn't work out.
It seesm ...
5
votes
3
answers
8k
views
TestContainer: Could not find a working container runtime strategy
I'm using TestContainer PostgresSql module for running jest tests with NodeJS. I installed the module and tried running the out of the box example here, but got the following error:
Could not find a ...
0
votes
2
answers
176
views
How to reset DB after each test class in Testcontainers?
public class AbstractContainerBaseTest {
@ServiceConnection
static final MySQLContainer<?> MY_SQL_CONTAINER = new MySQLContainer<>("mysql:8.0.32")
static {
...