diff --git a/modules/solace/go.mod b/modules/solace/go.mod index 66ec1f337c..6952c7ccf1 100644 --- a/modules/solace/go.mod +++ b/modules/solace/go.mod @@ -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 @@ -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 diff --git a/modules/solace/solace.go b/modules/solace/solace.go index 8d40c411a7..8cbc4b3e0b 100644 --- a/modules/solace/solace.go +++ b/modules/solace/solace.go @@ -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" @@ -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() @@ -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...), }