In Short: Using AmazonS3Client to connect to a local instance of MinIO results in a UnknownHostException thrown because the url is resolved to http://{bucket_name}.localhost:port. Detailed description of the problem: I’m creating an integration test for a Java service that uses AmazonS3Client lib to retrieve content from S3. I’m using MinIO inside a test container to perform the role of Amazon
Tag: testcontainers
Jooq with flyway and testconteiners creates new container per run
I want to use flyway with testcontainers for jooq generation. For this purpose I have 2 plugins So, I see that flyway started tc, applied all scripts and then jooq starts its’s own container and tried to generate entities, but there are nothing. Could you please suggest how to handle this? Answer You have to start the test container first
Data from test with @Transactional are persisting between tests
I have a small problem. I have started writing tests for my small project. The project uses SpringBoot, standard JpaRepository from Spring, as a testing framework I am using Spock and for testing the database, I’m using PostgreSQL container from TestContainers. The problem is, that data between tests is being persisted, despite the @Transacional on each of the tests. The
How to combine Testcontainers with @DataJpaTest avoiding code duplication?
I want to use Testcontainers with @DataJpaTest (and @SpringBootTest) using JUnit 5. I have the basic setup working using the @Testcontainers and @Container annotation like this: See https://github.com/wimdeblauwe/blog-example-code/tree/feature/testcontainers-datajpatest/testcontainers-datajpatest for the full example code (AtleteRepositoryTest, TeamRepositoryTest and TestcontainersDatajpatestApplicationTests). To avoid the repetition of declaring the PostgreSQL container and the dynamic properties, I tried the following: JUnit 5 extension Baeldung has a
Run ES docker image with custom port using testcontainers
I want to run a container tests that running ES image via Docker. After some research I found https://www.testcontainers.org/ and they also have a built-it ES module. Because my development environment using ES in ports 9200 and 9300 I prefer to use another ports for my tests, let’s say 1200 and 1300. Therefore, to run the docker image from CLI