Using Testcontainers with Redis cache
If you have executed the automated tests available in the sample project in the previous recipe, you may have noticed that the tests using methods that require Redis are failing. The reason is that Redis is not available during the execution of the tests.
In this recipe, we’ll learn how to set up a Redis server hosted as a Docker container using Testcontainers.
Getting ready
In this recipe, we’ll create the tests for the project created in the Using shared cache recipe. If you haven’t completed it yet, use the version I prepared as a starting point for this recipe. You can find it in the book’s GitHub repository at https://github.com/PacktPublishing/Spring-Boot-3.0-Cookbook, in the chapter7/recipe7-4/start
folder.
As we use Testcontainers, you will need Docker installed on your computer.
How to do it…
We like reliable applications. Let’s make our tests work!
- We’ll make all...