Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/solace/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ toolchain go1.24.7
require (
github.com/docker/docker v28.5.1+incompatible
github.com/docker/go-connections v0.6.0
github.com/docker/go-units v0.5.0
github.com/stretchr/testify v1.11.1
github.com/testcontainers/testcontainers-go v0.40.0
solace.dev/go/messaging v1.10.0
Expand All @@ -24,7 +25,6 @@ require (
github.com/cpuguy83/dockercfg v0.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/ebitengine/purego v0.8.4 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.3 // indirect
Expand Down
28 changes: 28 additions & 0 deletions modules/solace/solace.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/docker/docker/api/types/container"
"github.com/docker/go-connections/nat"
"github.com/docker/go-units"

"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/wait"
Expand All @@ -26,6 +27,15 @@ type Container struct {
}

// Run starts a Solace container with the provided image and options
//
// The container requires specific ulimits to start successfully:
// - nofile: 1048576 (number of open files)
// - core: -1 (for core dumps)
// - memlock: -1 (for memory locking)
//
// See https://docs.solace.com for more information.
// - https://docs.solace.com/Software-Broker/Managing-Core-Files.htm
// - https://docs.solace.com/Software-Broker/Container-Tasks/Config-Container-Storage.htm?Highlight=ulimit
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*Container, error) {
// Override default options with provided ones
settings := defaultOptions()
Expand Down Expand Up @@ -57,6 +67,24 @@ func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustom
testcontainers.WithExposedPorts(exposedPorts...),
testcontainers.WithHostConfigModifier(func(hc *container.HostConfig) {
hc.ShmSize = settings.shmSize
// Where disk space permits, Solace docs recommends the core file size "rlimit" for event brokers to be "unlimited".
hc.Ulimits = []*units.Ulimit{
{
Name: "nofile",
Soft: 1048576,
Hard: 1048576,
},
{
Name: "core",
Soft: -1,
Hard: -1,
},
{
Name: "memlock",
Soft: -1,
Hard: -1,
},
}
}),
testcontainers.WithWaitStrategy(waitStrategies...),
}
Expand Down
Loading