From eaa2720b9991706af72c4545008e670e9cd7e955 Mon Sep 17 00:00:00 2001 From: Adam Bouqdib Date: Sat, 5 Aug 2023 17:57:10 +0100 Subject: [PATCH 1/3] feat(modules): add artemis container --- .github/dependabot.yml | 11 ++ .github/workflows/ci.yml | 2 +- docs/modules/artemis.md | 68 ++++++++++++ mkdocs.yml | 1 + modules/artemis/Makefile | 5 + modules/artemis/artemis.go | 107 +++++++++++++++++++ modules/artemis/artemis_test.go | 161 +++++++++++++++++++++++++++++ modules/artemis/example_test.go | 34 ++++++ modules/artemis/go.mod | 45 ++++++++ modules/artemis/go.sum | 176 ++++++++++++++++++++++++++++++++ 10 files changed, 609 insertions(+), 1 deletion(-) create mode 100644 docs/modules/artemis.md create mode 100644 modules/artemis/Makefile create mode 100644 modules/artemis/artemis.go create mode 100644 modules/artemis/artemis_test.go create mode 100644 modules/artemis/example_test.go create mode 100644 modules/artemis/go.mod create mode 100644 modules/artemis/go.sum diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2df814702f..1231cabf86 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -147,6 +147,17 @@ updates: all: patterns: - '*' + - package-ecosystem: gomod + directory: /modules/artemis + schedule: + interval: monthly + day: sunday + open-pull-requests-limit: 3 + rebase-strategy: disabled + groups: + all: + patterns: + - '*' - package-ecosystem: gomod directory: /modules/clickhouse schedule: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4179fb0063..e70e499418 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,7 +86,7 @@ jobs: matrix: go-version: [1.19.x, 1.x] platform: [ubuntu-latest, macos-latest] - module: [clickhouse, compose, couchbase, k3s, localstack, mongodb, mysql, neo4j, postgres, pulsar, redis, redpanda, vault] + module: [artemis, clickhouse, compose, couchbase, k3s, localstack, mongodb, mysql, neo4j, postgres, pulsar, redis, redpanda, vault] exclude: - module: compose go-version: 1.19.x diff --git a/docs/modules/artemis.md b/docs/modules/artemis.md new file mode 100644 index 0000000000..eaf5c52a1e --- /dev/null +++ b/docs/modules/artemis.md @@ -0,0 +1,68 @@ +# Apache ActiveMQ Artemis + +Not available until the next release of testcontainers-go :material-tag: main + +## Introduction + +The Testcontainers module for Artemis. + +## Adding this module to your project dependencies + +Please run the following command to add the Artemis module to your Go dependencies: + +``` +go get github.com/testcontainers/testcontainers-go/modules/artemis +``` + +## Usage example + + +[Creating an Artemis container](../../modules/artemis/example_test.go) inside_block:runContainer + + +## Module reference + +The Artemis module exposes one entrypoint function to create the Artemis container, and this function receives two parameters: + +```golang +func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*ArtemisContainer, error) +``` + +- `context.Context`, the Go context. +- `testcontainers.ContainerCustomizer`, a variadic argument for passing options. + +### Container Options + +When starting the Artemis container, you can pass options in a variadic way to configure it. + +#### Image + +If you need to set a different Artemis Docker image, you can use `testcontainers.WithImage` with a valid Docker image +for Artemis. E.g. `testcontainers.WithImage("docker.io/apache/activemq-artemis:2.30.0")`. + +#### Wait Strategies + +If you need to set a different wait strategy for Artemis, you can use `testcontainers.WithWaitStrategy` with a valid wait strategy +for Artemis. + +!!!info + The default deadline for the wait strategy is 60 seconds. + +At the same time, it's possible to set a wait strategy and a custom deadline with `testcontainers.WithWaitStrategyAndDeadline`. + +#### Docker type modifiers + +If you need an advanced configuration for Artemis, you can leverage the following Docker type modifiers: + +- `testcontainers.WithConfigModifier` +- `testcontainers.WithHostConfigModifier` +- `testcontainers.WithEndpointSettingsModifier` + +Please read the [Create containers: Advanced Settings](../features/creating_container.md#advanced-settings) documentation for more information. + +### Container Methods + +The Artemis container exposes the following methods: + + + diff --git a/mkdocs.yml b/mkdocs.yml index f09b40479d..8f41782a85 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -60,6 +60,7 @@ nav: - SQL: features/wait/sql.md - Modules: - modules/index.md + - modules/artemis.md - modules/clickhouse.md - modules/couchbase.md - modules/k3s.md diff --git a/modules/artemis/Makefile b/modules/artemis/Makefile new file mode 100644 index 0000000000..8b900532a6 --- /dev/null +++ b/modules/artemis/Makefile @@ -0,0 +1,5 @@ +include ../../commons-test.mk + +.PHONY: test +test: + $(MAKE) test-artemis diff --git a/modules/artemis/artemis.go b/modules/artemis/artemis.go new file mode 100644 index 0000000000..7e3cff1ae6 --- /dev/null +++ b/modules/artemis/artemis.go @@ -0,0 +1,107 @@ +package artemis + +import ( + "context" + "fmt" + + "github.com/docker/go-connections/nat" + "github.com/testcontainers/testcontainers-go" + "github.com/testcontainers/testcontainers-go/wait" +) + +const ( + defaultBrokerPort = "61616/tcp" + defaultHTTPPort = "8161/tcp" +) + +// Container represents the Artemis container type used in the module. +type Container struct { + testcontainers.Container + user string + password string +} + +// Username returns the administrator username. +func (c *Container) User() string { + return c.user +} + +// Password returns the administrator password. +func (c *Container) Password() string { + return c.password +} + +// BrokerEndpoint returns the host:port for the combined protocols endpoint. +// The endpoint accepts CORE, MQTT, AMQP, STOMP, HORNETQ and OPENWIRE protocols. +func (c *Container) BrokerEndpoint(ctx context.Context) (string, error) { + return c.PortEndpoint(ctx, nat.Port(defaultBrokerPort), "") +} + +// ConsoleURL returns the URL for the management console. +func (c *Container) ConsoleURL(ctx context.Context) (string, error) { + host, err := c.PortEndpoint(ctx, nat.Port(defaultHTTPPort), "") + if err != nil { + return "", err + } + return fmt.Sprintf("http://%s:%s@%s/console", c.user, c.password, host), nil +} + +// WithCredentials sets the administrator credentials. The default is artemis:artemis. +func WithCredentials(user, password string) testcontainers.CustomizeRequestOption { + return func(req *testcontainers.GenericContainerRequest) { + req.Env["ARTEMIS_USER"] = user + req.Env["ARTEMIS_PASSWORD"] = password + } +} + +// WithAnonymousLogin enables anonymous logins. +func WithAnonymousLogin() testcontainers.CustomizeRequestOption { + return func(req *testcontainers.GenericContainerRequest) { + req.Env["ANONYMOUS_LOGIN"] = "true" + } +} + +// 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. +func WithExtraArgs(args string) testcontainers.CustomizeRequestOption { + return func(req *testcontainers.GenericContainerRequest) { + req.Env["EXTRA_ARGS"] = args + } +} + +// RunContainer creates an instance of the Artemis container type. +func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*Container, error) { + req := testcontainers.ContainerRequest{ + Image: "docker.io/apache/activemq-artemis:2.30.0-alpine", + Env: map[string]string{ + "ARTEMIS_USER": "artemis", + "ARTEMIS_PASSWORD": "artemis", + }, + ExposedPorts: []string{defaultBrokerPort, defaultHTTPPort}, + WaitingFor: wait.ForAll( + wait.ForLog("Server is now live"), + wait.ForLog("REST API available"), + ), + } + + genericContainerReq := testcontainers.GenericContainerRequest{ + ContainerRequest: req, + Started: true, + } + + for _, opt := range opts { + opt.Customize(&genericContainerReq) + } + + container, err := testcontainers.GenericContainer(ctx, genericContainerReq) + if err != nil { + return nil, err + } + + user := req.Env["ARTEMIS_USER"] + password := req.Env["ARTEMIS_PASSWORD"] + + return &Container{Container: container, user: user, password: password}, nil +} diff --git a/modules/artemis/artemis_test.go b/modules/artemis/artemis_test.go new file mode 100644 index 0000000000..7074d234d0 --- /dev/null +++ b/modules/artemis/artemis_test.go @@ -0,0 +1,161 @@ +package artemis_test + +import ( + "context" + "encoding/json" + "net/http" + "testing" + "time" + + "github.com/go-stomp/stomp/v3" + "github.com/testcontainers/testcontainers-go" + "github.com/testcontainers/testcontainers-go/modules/artemis" +) + +func TestArtemis(t *testing.T) { + ctx := context.Background() + + tests := []struct { + name string + opts []testcontainers.ContainerCustomizer + user, pass string + hook func(*testing.T, *artemis.Container) + }{ + { + name: "Default", + user: "artemis", + pass: "artemis", + }, + { + name: "WithCredentials", + opts: []testcontainers.ContainerCustomizer{ + artemis.WithCredentials("test", "test"), + }, + user: "test", + pass: "test", + }, + { + name: "WithAnonymous", + opts: []testcontainers.ContainerCustomizer{ + artemis.WithAnonymousLogin(), + }, + }, + { + name: "WithExtraArgs", + opts: []testcontainers.ContainerCustomizer{ + artemis.WithExtraArgs("--http-host 0.0.0.0 --relax-jolokia --queues ArgsTestQueue"), + }, + user: "artemis", + pass: "artemis", + hook: func(t *testing.T, container *artemis.Container) { + expectQueue(t, container, "ArgsTestQueue") + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + container, err := artemis.RunContainer(ctx, test.opts...) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { + if err := container.Terminate(ctx); err != nil { + t.Fatalf("failed to terminate container: %s", err) + } + }) + + u, err := container.ConsoleURL(ctx) + if err != nil { + t.Fatal(err) + } + + res, err := http.Get(u) + if err != nil { + t.Fatal(err) + } + res.Body.Close() + + if res.StatusCode != http.StatusOK { + t.Error("failed to access console") + } + + if test.user != "" && container.User() != test.user { + t.Fatal("unexpected user") + } + + if test.pass != "" && container.Password() != test.pass { + t.Fatal("unexpected password") + } + + host, err := container.BrokerEndpoint(ctx) + if err != nil { + t.Fatal(err) + } + + var opt []func(*stomp.Conn) error + if test.user != "" || test.pass != "" { + opt = append(opt, stomp.ConnOpt.Login(test.user, test.pass)) + } + + conn, err := stomp.Dial("tcp", host, opt...) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { conn.Disconnect() }) + + sub, err := conn.Subscribe("test", stomp.AckAuto) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { sub.Unsubscribe() }) + + err = conn.Send("test", "", []byte("test")) + if err != nil { + t.Fatal(err) + } + + ticker := time.NewTicker(10 * time.Second) + select { + case <-ticker.C: + t.Fatal("timed out waiting for message") + case msg := <-sub.C: + if string(msg.Body) != "test" { + t.Fatal("received unexpected message bytes") + } + } + + if test.hook != nil { + test.hook(t, container) + } + }) + } +} + +func expectQueue(t *testing.T, container *artemis.Container, queueName string) { + t.Helper() + + u, err := container.ConsoleURL(context.Background()) + if err != nil { + t.Fatal(err) + } + + r, err := http.Get(u + `/jolokia/read/org.apache.activemq.artemis:broker="0.0.0.0"/QueueNames`) + if err != nil { + t.Fatal(err) + } + defer r.Body.Close() + + var res struct{ Value []string } + if err = json.NewDecoder(r.Body).Decode(&res); err != nil { + t.Fatal(err) + } + + for _, v := range res.Value { + if v == queueName { + return + } + } + + t.Fatalf("should contain queue %q", queueName) +} diff --git a/modules/artemis/example_test.go b/modules/artemis/example_test.go new file mode 100644 index 0000000000..f6338c18a5 --- /dev/null +++ b/modules/artemis/example_test.go @@ -0,0 +1,34 @@ +package artemis_test + +import ( + "context" + + "github.com/go-stomp/stomp/v3" + "github.com/testcontainers/testcontainers-go/modules/artemis" +) + +func ExampleRunContainer() { + ctx := context.Background() + + user := "username" + pass := "password" + + // runContainer { + container, err := artemis.RunContainer(ctx, artemis.WithCredentials(user, pass)) + if err != nil { + panic(err) + } + // } + + host, err := container.BrokerEndpoint(ctx) + if err != nil { + panic(err) + } + + conn, err := stomp.Dial("tcp", host, stomp.ConnOpt.Login(user, pass)) + if err != nil { + panic(err) + } + + _ = conn +} diff --git a/modules/artemis/go.mod b/modules/artemis/go.mod new file mode 100644 index 0000000000..2e37f5cd46 --- /dev/null +++ b/modules/artemis/go.mod @@ -0,0 +1,45 @@ +module github.com/testcontainers/testcontainers-go/modules/artemis + +go 1.19 + +require ( + github.com/docker/go-connections v0.4.0 + github.com/go-stomp/stomp/v3 v3.0.5 + github.com/testcontainers/testcontainers-go v0.22.0 +) + +require ( + dario.cat/mergo v1.0.0 // indirect + github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/containerd/containerd v1.7.3 // indirect + github.com/cpuguy83/dockercfg v0.3.1 // indirect + github.com/docker/distribution v2.8.2+incompatible // indirect + github.com/docker/docker v24.0.5+incompatible // indirect + github.com/docker/go-units v0.5.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/klauspost/compress v1.16.0 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/moby/patternmatcher v0.5.0 // indirect + github.com/moby/sys/sequential v0.5.0 // indirect + github.com/moby/term v0.5.0 // indirect + github.com/morikuni/aec v1.0.0 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.0-rc4 // indirect + github.com/opencontainers/runc v1.1.5 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/sirupsen/logrus v1.9.0 // indirect + golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect + golang.org/x/mod v0.9.0 // indirect + golang.org/x/net v0.9.0 // indirect + golang.org/x/sys v0.8.0 // indirect + golang.org/x/tools v0.7.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect + google.golang.org/grpc v1.57.0 // indirect + google.golang.org/protobuf v1.30.0 // indirect +) + +replace github.com/testcontainers/testcontainers-go => ../.. diff --git a/modules/artemis/go.sum b/modules/artemis/go.sum new file mode 100644 index 0000000000..3312751401 --- /dev/null +++ b/modules/artemis/go.sum @@ -0,0 +1,176 @@ +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 h1:EKPd1INOIyr5hWOWhvpmQpY6tKjeG0hT1s3AMC/9fic= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Microsoft/hcsshim v0.10.0-rc.8 h1:YSZVvlIIDD1UxQpJp0h+dnpLUw+TrY0cx8obKsp3bek= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= +github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= +github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= +github.com/containerd/containerd v1.7.3 h1:cKwYKkP1eTj54bP3wCdXXBymmKRQMrWjkLSWZZJDa8o= +github.com/containerd/containerd v1.7.3/go.mod h1:32FOM4/O0RkNg7AjQj3hDzN9cUGtu+HMvaKUNiqCZB8= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoYe9E= +github.com/cpuguy83/dockercfg v0.3.1/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= +github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI= +github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= +github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3smi0k/jho4HLeY= +github.com/docker/docker v24.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/go-stomp/stomp/v3 v3.0.5 h1:yOORvXLqSu0qF4loJjfWrcVE1o0+9cFudclcP0an36Y= +github.com/go-stomp/stomp/v3 v3.0.5/go.mod h1:ztzZej6T2W4Y6FlD+Tb5n7HQP3/O5UNQiuC169pIp10= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.16.0 h1:iULayQNOReoYUe+1qtKOqw9CwJv3aNQu8ivo7lw1HU4= +github.com/klauspost/compress v1.16.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M7DBo= +github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= +github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= +github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= +github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= +github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= +github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.0-rc4 h1:oOxKUJWnFC4YGHCCMNql1x4YaDfYBTS5Y4x/Cgeo1E0= +github.com/opencontainers/image-spec v1.1.0-rc4/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= +github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs= +github.com/opencontainers/runc v1.1.5/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= +github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= +github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea h1:vLCWI/yYrdEHyN2JzIzPO3aaQJHQdp89IZBA/+azVC4= +golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= +golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= From 06d9965131520bdebd9480676106badd039f8778 Mon Sep 17 00:00:00 2001 From: Adam Bouqdib Date: Sun, 13 Aug 2023 15:27:03 +0100 Subject: [PATCH 2/3] chore: improve docs, use assert for tests --- docs/modules/artemis.md | 60 ++++++++++++++++++++++++- modules/artemis/artemis.go | 34 +++++++------- modules/artemis/artemis_test.go | 78 ++++++++++----------------------- modules/artemis/example_test.go | 26 +++++++---- modules/artemis/go.mod | 8 +++- modules/artemis/go.sum | 9 ++-- 6 files changed, 126 insertions(+), 89 deletions(-) diff --git a/docs/modules/artemis.md b/docs/modules/artemis.md index eaf5c52a1e..4a87a254ca 100644 --- a/docs/modules/artemis.md +++ b/docs/modules/artemis.md @@ -17,7 +17,7 @@ go get github.com/testcontainers/testcontainers-go/modules/artemis ## Usage example -[Creating an Artemis container](../../modules/artemis/example_test.go) inside_block:runContainer +[Creating and connecting to an Artemis container](../../modules/artemis/example_test.go) inside_block:ExampleRunContainer ## Module reference @@ -25,7 +25,7 @@ go get github.com/testcontainers/testcontainers-go/modules/artemis The Artemis module exposes one entrypoint function to create the Artemis container, and this function receives two parameters: ```golang -func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*ArtemisContainer, error) +func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*Container, error) ``` - `context.Context`, the Go context. @@ -50,6 +50,33 @@ for Artemis. At the same time, it's possible to set a wait strategy and a custom deadline with `testcontainers.WithWaitStrategyAndDeadline`. +#### Credentials + +If you need to change the default admin credentials (i.e. `artemis:artemis`) use `WithCredentials`. + +```go +container, err := artemis.RunContainer(ctx, artemis.WithCredentials("user", "password")) +``` + +#### Anonymous Login + +If you need to enable anonymous logins (which are disabled by default) use `WithAnonymousLogin`. + +```go +container, err := artemis.RunContainer(ctx, artemis.WithAnonymousLogin()) +``` + +#### Custom Arguments + +If you need to pass custom arguments to the `artemis create` command, use `WithExtraArgs`. +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. + +```go +container, err := artemis.RunContainer(ctx, artemis.WithExtraArgs("--http-host 0.0.0.0 --relax-jolokia --queues ArgsTestQueue")) +``` + #### Docker type modifiers If you need an advanced configuration for Artemis, you can leverage the following Docker type modifiers: @@ -64,5 +91,34 @@ Please read the [Create containers: Advanced Settings](../features/creating_cont The Artemis container exposes the following methods: +#### User +User returns the administrator username. +```go +user := container.User() +``` + +#### Password + +Password returns the administrator password. + +```go +password := container.Password() +``` + +#### BrokerEndpoint + +BrokerEndpoint returns the host:port for the combined protocols endpoint. + +```go +host, err := container.BrokerEndpoint(ctx) +``` + +#### ConsoleURL + +ConsoleURL returns the URL for the management console. + +```go +url, err := container.ConsoleURL(ctx) +``` diff --git a/modules/artemis/artemis.go b/modules/artemis/artemis.go index 7e3cff1ae6..64bc588081 100644 --- a/modules/artemis/artemis.go +++ b/modules/artemis/artemis.go @@ -21,7 +21,7 @@ type Container struct { password string } -// Username returns the administrator username. +// User returns the administrator username. func (c *Container) User() string { return c.user } @@ -73,29 +73,27 @@ func WithExtraArgs(args string) testcontainers.CustomizeRequestOption { // RunContainer creates an instance of the Artemis container type. func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*Container, error) { - req := testcontainers.ContainerRequest{ - Image: "docker.io/apache/activemq-artemis:2.30.0-alpine", - Env: map[string]string{ - "ARTEMIS_USER": "artemis", - "ARTEMIS_PASSWORD": "artemis", + req := testcontainers.GenericContainerRequest{ + ContainerRequest: testcontainers.ContainerRequest{ + Image: "docker.io/apache/activemq-artemis:2.30.0-alpine", + Env: map[string]string{ + "ARTEMIS_USER": "artemis", + "ARTEMIS_PASSWORD": "artemis", + }, + ExposedPorts: []string{defaultBrokerPort, defaultHTTPPort}, + WaitingFor: wait.ForAll( + wait.ForLog("Server is now live"), + wait.ForLog("REST API available"), + ), }, - ExposedPorts: []string{defaultBrokerPort, defaultHTTPPort}, - WaitingFor: wait.ForAll( - wait.ForLog("Server is now live"), - wait.ForLog("REST API available"), - ), - } - - genericContainerReq := testcontainers.GenericContainerRequest{ - ContainerRequest: req, - Started: true, + Started: true, } for _, opt := range opts { - opt.Customize(&genericContainerReq) + opt.Customize(&req) } - container, err := testcontainers.GenericContainer(ctx, genericContainerReq) + container, err := testcontainers.GenericContainer(ctx, req) if err != nil { return nil, err } diff --git a/modules/artemis/artemis_test.go b/modules/artemis/artemis_test.go index 7074d234d0..200d0a8439 100644 --- a/modules/artemis/artemis_test.go +++ b/modules/artemis/artemis_test.go @@ -8,6 +8,8 @@ import ( "time" "github.com/go-stomp/stomp/v3" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/testcontainers/testcontainers-go" "github.com/testcontainers/testcontainers-go/modules/artemis" ) @@ -56,42 +58,27 @@ func TestArtemis(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { container, err := artemis.RunContainer(ctx, test.opts...) - if err != nil { - t.Fatal(err) - } - t.Cleanup(func() { - if err := container.Terminate(ctx); err != nil { - t.Fatalf("failed to terminate container: %s", err) - } - }) + require.NoError(t, err) + t.Cleanup(func() { require.NoError(t, container.Terminate(ctx), "failed to terminate container") }) u, err := container.ConsoleURL(ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) res, err := http.Get(u) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err, "failed to access console") res.Body.Close() + assert.Equal(t, http.StatusOK, res.StatusCode, "failed to access console") - if res.StatusCode != http.StatusOK { - t.Error("failed to access console") + if test.user != "" { + assert.Equal(t, test.user, container.User(), "unexpected user") } - if test.user != "" && container.User() != test.user { - t.Fatal("unexpected user") - } - - if test.pass != "" && container.Password() != test.pass { - t.Fatal("unexpected password") + if test.pass != "" { + assert.Equal(t, test.pass, container.Password(), "unexpected password") } host, err := container.BrokerEndpoint(ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) var opt []func(*stomp.Conn) error if test.user != "" || test.pass != "" { @@ -99,30 +86,22 @@ func TestArtemis(t *testing.T) { } conn, err := stomp.Dial("tcp", host, opt...) - if err != nil { - t.Fatal(err) - } - t.Cleanup(func() { conn.Disconnect() }) + require.NoError(t, err, "failed to connect") + t.Cleanup(func() { require.NoError(t, conn.Disconnect()) }) sub, err := conn.Subscribe("test", stomp.AckAuto) - if err != nil { - t.Fatal(err) - } - t.Cleanup(func() { sub.Unsubscribe() }) + require.NoError(t, err, "failed to subscribe") + t.Cleanup(func() { require.NoError(t, sub.Unsubscribe()) }) err = conn.Send("test", "", []byte("test")) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err, "failed to send") ticker := time.NewTicker(10 * time.Second) select { case <-ticker.C: t.Fatal("timed out waiting for message") case msg := <-sub.C: - if string(msg.Body) != "test" { - t.Fatal("received unexpected message bytes") - } + require.Equal(t, "test", string(msg.Body), "received unexpected message") } if test.hook != nil { @@ -136,26 +115,15 @@ func expectQueue(t *testing.T, container *artemis.Container, queueName string) { t.Helper() u, err := container.ConsoleURL(context.Background()) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) r, err := http.Get(u + `/jolokia/read/org.apache.activemq.artemis:broker="0.0.0.0"/QueueNames`) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err, "failed to request QueueNames") defer r.Body.Close() var res struct{ Value []string } - if err = json.NewDecoder(r.Body).Decode(&res); err != nil { - t.Fatal(err) - } - - for _, v := range res.Value { - if v == queueName { - return - } - } + err = json.NewDecoder(r.Body).Decode(&res) + require.NoError(t, err, "failed to decode QueueNames response") - t.Fatalf("should contain queue %q", queueName) + require.Containsf(t, res.Value, queueName, "should contain queue") } diff --git a/modules/artemis/example_test.go b/modules/artemis/example_test.go index f6338c18a5..5ff7679cac 100644 --- a/modules/artemis/example_test.go +++ b/modules/artemis/example_test.go @@ -10,25 +10,35 @@ import ( func ExampleRunContainer() { ctx := context.Background() - user := "username" - pass := "password" - - // runContainer { - container, err := artemis.RunContainer(ctx, artemis.WithCredentials(user, pass)) + // Run container. + container, err := artemis.RunContainer(ctx) if err != nil { panic(err) } - // } + defer func() { + if err := container.Terminate(ctx); err != nil { + panic(err) + } + }() + // Get broker endpoint. host, err := container.BrokerEndpoint(ctx) if err != nil { panic(err) } + // Get credentials. + user := container.User() + pass := container.Password() + + // Connect to Artemis via STOMP. conn, err := stomp.Dial("tcp", host, stomp.ConnOpt.Login(user, pass)) if err != nil { panic(err) } - - _ = conn + defer func() { + if err := conn.Disconnect(); err != nil { + panic(err) + } + }() } diff --git a/modules/artemis/go.mod b/modules/artemis/go.mod index 2e37f5cd46..b66e149da5 100644 --- a/modules/artemis/go.mod +++ b/modules/artemis/go.mod @@ -5,6 +5,7 @@ go 1.19 require ( github.com/docker/go-connections v0.4.0 github.com/go-stomp/stomp/v3 v3.0.5 + github.com/stretchr/testify v1.8.4 github.com/testcontainers/testcontainers-go v0.22.0 ) @@ -12,9 +13,10 @@ require ( dario.cat/mergo v1.0.0 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/containerd/containerd v1.7.3 // indirect github.com/cpuguy83/dockercfg v0.3.1 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.5+incompatible // indirect github.com/docker/go-units v0.5.0 // indirect @@ -31,15 +33,17 @@ require ( github.com/opencontainers/image-spec v1.1.0-rc4 // indirect github.com/opencontainers/runc v1.1.5 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/sirupsen/logrus v1.9.0 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.9.0 // indirect golang.org/x/net v0.9.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.11.0 // indirect golang.org/x/tools v0.7.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect google.golang.org/grpc v1.57.0 // indirect google.golang.org/protobuf v1.30.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace github.com/testcontainers/testcontainers-go => ../.. diff --git a/modules/artemis/go.sum b/modules/artemis/go.sum index 3312751401..0d4b24f10e 100644 --- a/modules/artemis/go.sum +++ b/modules/artemis/go.sum @@ -7,8 +7,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Microsoft/hcsshim v0.10.0-rc.8 h1:YSZVvlIIDD1UxQpJp0h+dnpLUw+TrY0cx8obKsp3bek= -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= @@ -94,6 +94,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= @@ -139,8 +140,8 @@ golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From d0403242ef6f4d616392eb7e141b27094fbd17aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Mon, 14 Aug 2023 12:48:27 +0200 Subject: [PATCH 3/3] chore: bump Go to 1.20 See https://github.com/testcontainers/testcontainers-go/pull/1497 --- modules/artemis/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/artemis/go.mod b/modules/artemis/go.mod index b66e149da5..f7eb80aa51 100644 --- a/modules/artemis/go.mod +++ b/modules/artemis/go.mod @@ -1,6 +1,6 @@ module github.com/testcontainers/testcontainers-go/modules/artemis -go 1.19 +go 1.20 require ( github.com/docker/go-connections v0.4.0