Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAnonymousLogin ¶
func WithAnonymousLogin() testcontainers.CustomizeRequestOption
WithAnonymousLogin enables anonymous logins.
func WithCredentials ¶
func WithCredentials(user, password string) testcontainers.CustomizeRequestOption
WithCredentials sets the administrator credentials. The default is artemis:artemis.
func WithExtraArgs ¶
func WithExtraArgs(args string) testcontainers.CustomizeRequestOption
Additional arguments sent to the `artemis create` command. The default is `--http-host 0.0.0.0 --relax-jolokia`. Setting this value will override the default. See the documentation on `artemis create` for available options.
Types ¶
type Container ¶
type Container struct {
testcontainers.Container
// contains filtered or unexported fields
}
Container represents the Artemis container type used in the module.
func Run ¶ added in v0.32.0
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*Container, error)
Run creates an instance of the Artemis container type with a given image
Example ¶
// runArtemisContainer {
ctx := context.Background()
artemisContainer, err := artemis.Run(ctx,
"apache/activemq-artemis:2.30.0",
artemis.WithCredentials("test", "test"),
)
defer func() {
if err := testcontainers.TerminateContainer(artemisContainer); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
if err != nil {
log.Printf("failed to start container: %s", err)
return
}
// }
state, err := artemisContainer.State(ctx)
if err != nil {
log.Printf("failed to get container state: %s", err)
return
}
fmt.Println(state.Running)
// connectToArtemisContainer {
// Get broker endpoint.
host, err := artemisContainer.BrokerEndpoint(ctx)
if err != nil {
log.Printf("failed to get broker endpoint: %s", err)
return
}
// containerUser {
user := artemisContainer.User()
// }
// containerPassword {
pass := artemisContainer.Password()
// }
// Connect to Artemis via STOMP.
conn, err := stomp.Dial("tcp", host, stomp.ConnOpt.Login(user, pass))
if err != nil {
log.Printf("failed to connect to Artemis: %s", err)
return
}
defer func() {
if err := conn.Disconnect(); err != nil {
log.Printf("failed to disconnect from Artemis: %s", err)
}
}()
// }
fmt.Printf("%s:%s\n", user, pass)
Output: true test:test
func RunContainer
deprecated
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*Container, error)
Deprecated: use Run instead. RunContainer creates an instance of the Artemis container type.
func (*Container) BrokerEndpoint ¶
BrokerEndpoint returns the host:port for the combined protocols endpoint. The endpoint accepts CORE, MQTT, AMQP, STOMP, HORNETQ and OPENWIRE protocols.
func (*Container) ConsoleURL ¶
ConsoleURL returns the URL for the management console.