Skip to content

Commit

Permalink
chore: scylladb cmd opts
Browse files Browse the repository at this point in the history
  • Loading branch information
achettyiitr committed Sep 20, 2024
1 parent 1a4a26b commit d847f68
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions testhelper/docker/resource/scylla/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
9 changes: 7 additions & 2 deletions testhelper/docker/resource/scylla/scylla.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down

0 comments on commit d847f68

Please sign in to comment.