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
0
votes
0 answers

Is there a way to configure a docker container (testcontainer) with the mapped port before it starts?

I have a testcontainer that creates a Oryd/Hydra container in a Junit 4 test. @Bean public GenericContainer hydra() { WaitStrategy waitStrategy = Wait.forHttp("/health/ready").forStatusCode(200); GenericContainer hydra = new…
Bassam
  • 146
  • 2
  • 10
0
votes
1 answer

Postgres docker-compose using testcontainers not working

Here is my abstract testcontainers class @Configuration @Testcontainers @ContextConfiguration(initializers = DockerConfig.Initializer.class) public abstract class DockerConfig { static class Initializer implements…
notacorn
  • 3,526
  • 4
  • 30
  • 60
0
votes
1 answer

Unable to run testcontainer from Windows Server 2019 (LinuxKit installed)

Unable to run linux containers from testcontainer in Windows Server 2019 (LinuxKit installed). Getting errors as mentioned below. 2020-07-01 20:12:59.342 ERROR 4936 --- [ main] o.t.d.DockerClientProviderStrategy : Could not find a…
Suresh Raja
  • 411
  • 6
  • 23
0
votes
1 answer

How to use testcontainers in existing application?

CONTEXT: I have an existing Camel application. In order to test it with Spring Boot tools, it is wrapped into the Spring Boot framework and all tests run against this Spring Boot app. Important: This code is used in production, so I am not allowed…
Dmytro Chasovskyi
  • 3,209
  • 4
  • 40
  • 82
0
votes
3 answers

How to populate data in testcontainers?

CONTEXT: I have a non Spring Boot app which I wrap in Spring Boot in order to test functionality. It happened that code had an in-memory database in tests, I want to test against a different database to reproduce the production environment. I…
Dmytro Chasovskyi
  • 3,209
  • 4
  • 40
  • 82
0
votes
2 answers

SpringBoot Test, inject value in configuration

What Im' trying to do: start MongoDB Container from test containers https://github.com/testcontainers/testcontainers-spring-boot/tree/develop/embedded-mongodb Inject MongoDB uri taken from started container into Configuration Run test Here is my…
Capacytron
  • 3,425
  • 6
  • 47
  • 80
0
votes
1 answer

Is there a way to pass docker flags in GenericContainer from test containers

Is there a way to pass those flags from this command in GenericContainer object from test-containers lib ? docker container run \ --publish 9092:9082 \ --detach \ --name h2 \ nemerosa/h2 @ClassRule public static GenericContainer h2db = …
0
votes
1 answer

Container not starting with GenericContainer

I have just started using testcontainers and I am getting into issues. Below is my code: @ClassRule public static GenericContainer redisContainer = new GenericContainer("corporateurl/redis:latest") …
Sachin Jain
  • 97
  • 1
  • 10
0
votes
1 answer

Testcontainers Selenium how to update browser?

I use Testcontainers (1.14.1) with Selenium (4.0.0-alpha-5) and Chrome to run my Java Integration Tests. But when I run my tests my Angular Frontend aren't rendered. As I found out it's because the Chrome Version inside the container is to old. The…
0
votes
1 answer

spring data elastic search Not a valid protocol version: This is not an HTTP port

I have the following elastic-search container configuration in my test case @Container public static GenericContainer container = new GenericContainer<>("elasticsearch:7.7.0") …
Shady Ragab
  • 705
  • 10
  • 26
0
votes
1 answer

What is the correct way to configure DockerComposeContainer with a Junit test?

I am trying to configure a Test container as described on this website. testcontainers I am having trouble configuring it with DockerCompose. I am looking at the docs and I don't see what I am doing wrong. What is the correct way to configure…
slipperypete
  • 5,358
  • 17
  • 59
  • 99
0
votes
1 answer

Integration test with Spring-context doesn't receive RabbitMQ messages

RabbitMQ MessageConsumer doesn't receive the published message I'm writing an integration test which should received a message from a queue and do the processing. But the consumer simply doesn't receive the message. When I manually inject the…
Guerino Rodella
  • 321
  • 4
  • 16
0
votes
1 answer

Is there a way of executing consecutive n number integration-tests over 1 instances of dockercompose (test-containers)

Using DockerComposeContainer from test-containers api in SpringBootApp I have the following issue. The DockerComposeContainer object from test-containers must be annotated with @ClassRule to be started and closed automatically thats give the need…
user11416547
0
votes
1 answer

Getting testcontainers working with marshmallow

I am trying to get the python testcontainer working with marshmallow to run a test but I don't seem to be able to get it working. I always get the connection refused when I run the test. I have created a sqlalchemy engine and tested it, and this…
Paul
  • 264
  • 3
  • 9
0
votes
1 answer

SpringBoot, test containers to test queries sent to external DB

My Spring app has its own DB for persistence. The same app needs to send ad-hoc queries to external databases. Queries are provided by users. App takes SQL query provided by user App takes external database type (postgres / oracle / whatever…