From f5c11ea2c029cb3d9c51e2ca392ebe8b4d4a0e22 Mon Sep 17 00:00:00 2001 From: Sergio del Amo Caballero Date: Mon, 19 Aug 2024 09:24:45 +0200 Subject: [PATCH] test containers docker disable --- .../2024-08-19-testcontainers-docker-disable.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 posts/2024-08-19-testcontainers-docker-disable.md diff --git a/posts/2024-08-19-testcontainers-docker-disable.md b/posts/2024-08-19-testcontainers-docker-disable.md new file mode 100644 index 0000000..0b1b660 --- /dev/null +++ b/posts/2024-08-19-testcontainers-docker-disable.md @@ -0,0 +1,17 @@ +--- +title: Disable Testcontainers JUnit 5 tests without Docker +summary: [Testcontainers Junit5](https://java.testcontainers.org/test_framework_integration/junit_5/) integration allows you to toggle these tests by annotating them with `@Testcontainers(disabledWithoutDocker = true)` +date_published: 2024-08-19T09:17:50+01:00 +keywords:docker,testcontainers,junit +--- + +# [%title] + +[Testcontainers](https://testcontainers.com) simplifies testing against third-party components such as databases. But sometimes, you want to run your Junit 5 tests and skip those requiring Docker. + +> To run Testcontainers-based tests, you need a Docker-API compatible container runtime, such as using Testcontainers Cloud or installing Docker locally. + +Luckily, [Testcontainers Junit5](https://java.testcontainers.org/test_framework_integration/junit_5/) integration allows you to toggle these tests by annotating them with `@Testcontainers(disabledWithoutDocker = true)`. + +See an [example of a commit in Micronaut Test](https://github.com/micronaut-projects/micronaut-test/pull/1081/commits/47920a39869d0b8978ff58a792f5a7d70f12baa5). +