Skip to content
Advertisement

Tag: testcontainers

AmazonsS3Client throws UnknownHostException if attempting to connect to a local service (MinIO)

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

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

Advertisement