diff --git a/redis/redis_test.go b/redis/redis_test.go index f32adde2..656637d5 100644 --- a/redis/redis_test.go +++ b/redis/redis_test.go @@ -1,6 +1,7 @@ package redis import ( + "os" "testing" "time" @@ -9,6 +10,12 @@ import ( testredis "github.com/gofiber/storage/testhelpers/redis" ) +const ( + // redisImage is the default image used for running Redis in tests. + redisImage = "docker.io/redis:7" + redisImageEnvVar = "TEST_REDIS_IMAGE" +) + // newConfigFromContainer creates a Redis configuration using Testcontainers. // It configures the container based on the provided options and returns a Config // that can be used to connect to the container. @@ -16,6 +23,13 @@ import ( func newConfigFromContainer(t testing.TB, opts ...testredis.Option) Config { t.Helper() + img := redisImage + if imgFromEnv := os.Getenv(redisImageEnvVar); imgFromEnv != "" { + img = imgFromEnv + } + + opts = append(opts, testredis.WithImage(img)) + redisCtr := testredis.Start(t, opts...) cfg := Config{