🚨 AtomicJar is now part of Docker 🐋! Read the blog

Iván López

VMware
Spain

Bio

Iván is a Software Engineer and Systems Administrator with 20 years of experience. He is a Staff Software Engineer at VMware and a former Micronaut core committer. He discovered Grails and Spring a long time ago and since then he develops almost exclusively using Java and Groovy. He’s also the coordinator of the Madrid Groovy User Group (@madridgug), the former organizer of the Greach Conference and a frequent speaker at conferences like Devoxx, Codemotion, GeeCon, Spring IO, RigaDevDays, JavaCro, SpringOne 2GX, GR8Conf, Greach,…

Q&A

What were your first experiences with Testcontainers?

It was “love at first sight” because I’ve always cared a lot about testing but setting up everything for integration tests was tricky and messy.

What’s your favourite Testcontainers module?

The one I used the most is Postgresql but I’ve written cool tests with Mockserver and LocalStack.

What are your favourite features for Testcontainers?

I really like how easy it is to configure it in my projects and have a real dependency running for my tests in a couple of minutes, just adding some dependency, a few annotations and that’s it!

What’s the most memorable bug you managed to reproduce with a test using Testcontainers?

I have a use case. I needed to sign some OCI artifacts (Containers, Helm Charts,…) simulating the Cosign CLI tool, but in my Java application we are not actually executing nor embedding Cosign CLI. I managed to mimic its behavior to sign the artifacts like Cosign just using plain Java and BouncyCastle. Everything was working properly but I needed to write a proper integration test to make sure that after signing the container with my Java code, Cosign CLI was able to verify the signature.

Using a GenericContainer I was able to run “bitnami/cosign” container (that actually runs the CLI), put that container in the same Docker Network as my Registry that was running in another container during the test. My application pushed the container to the local Registry, signed it and pushed the signature, and then I was able verify it was valid. Everything in a really simple integration test powered by Testcontainers.