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
3 answers

@DynamicPropertySource not being invoked (Kotlin, Spring Boot and TestContainers)

I'm trying to define a @TestConfiguration class that is executed once before all integration tests to run a MongoDB TestContainer in Kotlin in a Spring Boot project. Here is the code: import…
Marco
  • 321
  • 3
  • 10
3
votes
1 answer

Exposed port 0 is not mapped. testcontainer c#

I have the following code private readonly MsSqlTestcontainer _msSqlTestcontainer; public DbSessionConnectionFactory() { _msSqlTestcontainer = new TestcontainersBuilder() …
Farhad Zamani
  • 5,381
  • 2
  • 16
  • 41
3
votes
1 answer

SpringBoot+Liquibase+TestContainer db - not able to populate db during integration test

I am trying to use TestContainers for my integration tests. What I am trying to do is use sql script to populate with some data, and then also add new data using tests. Below is the test setup: Integration test where I am trying to get the data…
3
votes
1 answer

Testcontainer with VPN on: Can not connect to Ryuk at localhost:49198

I'm using Testcontainer on Unit and Integration test in a Java/maven project. Tests are working as expected, until I run the VPN I'm using to work. With the VPN, I can see the error message "Can not connect to Ryuk at localhost:49198" Here are the…
3
votes
1 answer

Integration test for API that has @Secured

I have a spring REST API that is secured by spring security and Keycloak, and I am using keycloak testcontainers for the integration test. I can add a user to keycloak and get a token to use while testing most of the APIs. The question is, If I…
3
votes
1 answer

Aerospike Testcontainers: 2 namespaces

I'm using official Aerospike Docker image to run it with Testcontainers. I can specify a default namespace as the environment variable. Unfortunately, I cannot create 2 namespaces on container start. Is there any approach to achieve it?
3
votes
2 answers

Ryuk container that is started by Test container store don't stop the singleton container

I have several test nodes, but I run the container as a singleton. @ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @AutoConfigureTestDatabase(replace =…
skyho
  • 1,438
  • 2
  • 20
  • 47
3
votes
1 answer

How to spin off a test container for ArangoDB in GO code?

I'm trying to use https://golang.testcontainers.org to setup a docker container from the image that I specify, while the code is in execution. The container spun out, will be cleaned up before the program terminates, as mentioned in the above…
3
votes
1 answer

Ktor testing Fail to serialize body. Content has type: class ... but OutgoingContent expected

so trying to understand how I can make testing ktor app with testcontainers this is my code package com.app import com.app.base.db.DbFactory import com.app.features.auth.RegisterDTO import com.app.plugins.* import…
Victor Orlyk
  • 1,454
  • 2
  • 15
  • 27
3
votes
1 answer

BitBucket pipelines with testcontainer not working

I face this error when try to run bitbucket pipelines with test container Could not start container java.lang.IllegalStateException: Container did not start correctly. There is no another issues but maybe it's related to Binds?…
puka
  • 83
  • 3
3
votes
2 answers

Reset kafka testcontainers without clearing and recreating the testcontainer after every junit test

I am using kafka testcontainers with JUnit5. Can someone let me know how can I delete data from Kafka testcontainers after each test so that I don't have to destroy and recreate the kafka testcontainer every time. Test Container Version -…
tuk
  • 5,941
  • 14
  • 79
  • 162
3
votes
2 answers

Is it possible to conditionally use test containers vs a locally running Docker container?

My company's application uses test containers for multiple images, plus flyway to setup schemas, etc. Our test suite is robust but long running. So I'm looking for ways to speed up the test suite execution. This is primarily for devs running the…
craigmiller160
  • 5,751
  • 9
  • 41
  • 75
3
votes
1 answer

Testcontainers works locally but fails on build server (DinD)

Our recent move to a jenkins in a docker-image has not been so smooth. We have a (over?)complicated setup where one docker container starts a new one and, previously, shared data with the new container by sharing host-folders. In essence we have…
3
votes
0 answers

No broker/node available in test with Kafka in TestContainers

I am trying to create a bare-bones skeleton integration test for Kafka with TestContainers: just publish message to topic and check it arrives to it (entire setup below). SkeletonTests.kt @Testcontainers class SkeletonTests { @Container private…
Sergei G
  • 1,550
  • 3
  • 24
  • 44
3
votes
2 answers

Micronaut + Vertx + testcontainers

How do I configure Micronaut app using Vert.x and testcontainers? I'm trying: application-test.yml datasources: default: url: jdbc:tc:mysql:8:///db driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver vertx: mysql: …
Ricardo Bocchi
  • 1,551
  • 2
  • 12
  • 12