mirror of
https://github.com/gofiber/storage.git
synced 2025-12-19 00:38:24 +08:00
chore: support for overriding the redis image
This commit is contained in:
@@ -28,6 +28,10 @@ type Config struct {
|
||||
UseAddress bool
|
||||
UseHostPort bool
|
||||
UseURL bool
|
||||
// Image is the image to use for the Redis container
|
||||
//
|
||||
// Optional. Default is "docker.io/redis:7", but could be set to Valkey.
|
||||
Image string
|
||||
}
|
||||
|
||||
// Option is a function that configures a Config
|
||||
@@ -63,6 +67,13 @@ func WithURL(useContainerURI bool) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// WithImage sets the image to use for the Redis container
|
||||
func WithImage(image string) Option {
|
||||
return func(c *Config) {
|
||||
c.Image = image
|
||||
}
|
||||
}
|
||||
|
||||
// Container represents a running Redis container
|
||||
type Container struct {
|
||||
URL string
|
||||
@@ -88,6 +99,10 @@ func Start(t testing.TB, opts ...Option) *Container {
|
||||
img = imgFromEnv
|
||||
}
|
||||
|
||||
if config.Image != "" {
|
||||
img = config.Image
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
tcOpts := []testcontainers.ContainerCustomizer{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user