Skip to content

Commit

Permalink
feat: add support for custom redis docker repository (#467)
Browse files Browse the repository at this point in the history
Co-authored-by: Sai Sankeerth <sanpj2292@github.com>
  • Loading branch information
sanpj2292 and Sai Sankeerth committed May 17, 2024
1 parent af06f04 commit 55606f8
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions testhelper/docker/resource/redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,36 @@ func WithEnv(envs ...string) Option {
}
}

// WithRepository is used to specify a custom image that should be pulled from the container registry
func WithRepository(repository string) Option {
return func(rc *redisConfig) {
rc.repository = repository
}
}

type Resource struct {
Addr string
}

type Option func(*redisConfig)

type redisConfig struct {
tag string
envs []string
cmdArgs []string
repository string
tag string
envs []string
cmdArgs []string
}

func Setup(ctx context.Context, pool *dockertest.Pool, d resource.Cleaner, opts ...Option) (*Resource, error) {
conf := redisConfig{
tag: "6",
tag: "6",
repository: "redis",
}
for _, opt := range opts {
opt(&conf)
}
runOptions := &dockertest.RunOptions{
Repository: "redis",
Repository: conf.repository,
Tag: conf.tag,
Env: conf.envs,
Cmd: []string{"redis-server"},
Expand Down

0 comments on commit 55606f8

Please sign in to comment.