mirror of
https://github.com/gofiber/storage.git
synced 2025-10-08 10:00:32 +08:00
fix: missing eval of redis image from env var
This commit is contained in:
@@ -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{
|
||||
|
Reference in New Issue
Block a user