Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ServiceAMQP = Service{ Name: "amqp", Port: 5672, Protocol: "amqp", SupportSSL: false, } ServiceMQTT = Service{ Name: "mqtt", Port: 1883, Protocol: "tcp", SupportSSL: false, } ServiceREST = Service{ Name: "rest", Port: 9000, Protocol: "http", SupportSSL: false, } ServiceManagement = Service{ Name: "management", Port: 8080, Protocol: "http", SupportSSL: false, } ServiceSMF = Service{ Name: "smf", Port: 55555, Protocol: "tcp", SupportSSL: true, } ServiceSMFSSL = Service{ Name: "smf", Port: 55443, Protocol: "tcps", SupportSSL: true, } )
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container struct {
testcontainers.Container
// contains filtered or unexported fields
}
Container represents a Solace container with additional settings
func Run ¶
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*Container, error)
Run starts a Solace container with the provided image and options
Example ¶
// runSolaceContainer {
ctx := context.Background()
ctr, err := sc.Run(ctx, "solace/solace-pubsub-standard:latest",
sc.WithCredentials("admin", "admin"),
sc.WithServices(sc.ServiceAMQP, sc.ServiceManagement),
testcontainers.WithEnv(map[string]string{
"username_admin_globalaccesslevel": "admin",
"username_admin_password": "admin",
}),
sc.WithShmSize(1<<30),
)
defer func() {
if err := testcontainers.TerminateContainer(ctr); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
fmt.Println(err)
// }
Output: <nil>
Example (WithTopicAndQueue) ¶
ctx := context.Background()
ctr, err := sc.Run(ctx, "solace/solace-pubsub-standard:latest",
sc.WithCredentials("admin", "admin"),
sc.WithVPN("test-vpn"),
sc.WithServices(sc.ServiceAMQP, sc.ServiceManagement, sc.ServiceSMF),
testcontainers.WithEnv(map[string]string{
"username_admin_globalaccesslevel": "admin",
"username_admin_password": "admin",
}),
sc.WithShmSize(1<<30),
sc.WithQueue("TestQueue", "Topic/MyTopic"),
)
defer func() {
if err := testcontainers.TerminateContainer(ctr); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
fmt.Println(err)
// the [testMessagePublishAndConsume] function is responsible for printing the output
// to the console, so be aware of that when adding it to other examples.
err = testMessagePublishAndConsume(ctr, "TestQueue", "Topic/MyTopic")
fmt.Println(err)
Output: <nil> Published message to topic: Topic/MyTopic Received message: Hello from Solace testcontainers! Successfully received message from queue: TestQueue <nil>
func (*Container) BrokerURLFor ¶
BrokerURLFor returns the origin URL for a given service
type Option ¶
type Option func(*options) error
Option is an option for the Solace container.
func WithCredentials ¶
WithCredentials sets the client credentials (username, password)
func WithServices ¶
WithServices configures the services to be exposed with their wait strategies
func WithShmSize ¶
WithShmSize sets the size of the /dev/shm volume
func (Option) Customize ¶
func (o Option) Customize(*testcontainers.GenericContainerRequest) error
Customize is a NOOP. It's defined to satisfy the testcontainers.ContainerCustomizer interface.
Click to show internal directories.
Click to hide internal directories.