From d847f68831bcea7d2be8272bd8db88cd56e693d8 Mon Sep 17 00:00:00 2001 From: achettyiitr Date: Fri, 20 Sep 2024 15:00:59 +0530 Subject: [PATCH] chore: scylladb cmd opts --- testhelper/docker/resource/scylla/config.go | 7 +++++++ testhelper/docker/resource/scylla/scylla.go | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/testhelper/docker/resource/scylla/config.go b/testhelper/docker/resource/scylla/config.go index 1e9834d6..58a30c5f 100644 --- a/testhelper/docker/resource/scylla/config.go +++ b/testhelper/docker/resource/scylla/config.go @@ -14,7 +14,14 @@ func WithKeyspace(keyspace string) Option { } } +func WithCmdArg(arg string) Option { + return func(c *config) { + c.cmdArgs = append(c.cmdArgs, arg) + } +} + type config struct { tag string keyspace string + cmdArgs []string } diff --git a/testhelper/docker/resource/scylla/scylla.go b/testhelper/docker/resource/scylla/scylla.go index 3023558c..f7108196 100644 --- a/testhelper/docker/resource/scylla/scylla.go +++ b/testhelper/docker/resource/scylla/scylla.go @@ -26,14 +26,19 @@ func Setup(pool *dockertest.Pool, d resource.Cleaner, opts ...Option) (*Resource opt(c) } - container, err := pool.RunWithOptions(&dockertest.RunOptions{ + runOptions := &dockertest.RunOptions{ Repository: "scylladb/scylla", Tag: c.tag, Env: []string{}, ExposedPorts: []string{"9042/tcp"}, PortBindings: internal.IPv4PortBindings([]string{"9042"}), Cmd: []string{"--smp 1"}, - }, internal.DefaultHostConfig, func(hc *docker.HostConfig) { + } + if len(c.cmdArgs) > 0 { + runOptions.Cmd = append(runOptions.Cmd, c.cmdArgs...) + } + + container, err := pool.RunWithOptions(runOptions, internal.DefaultHostConfig, func(hc *docker.HostConfig) { hc.CPUCount = 1 hc.Memory = 128 * bytesize.MB })