From 76e16f117c12fd864bffcd0abdd277dfdb628fec Mon Sep 17 00:00:00 2001 From: MitulShah1 Date: Thu, 10 Apr 2025 20:35:39 +0530 Subject: [PATCH 01/11] Implemented Aerospike Test Container --- .github/dependabot.yml | 1 + docs/modules/aerospike.md | 48 +++++++ mkdocs.yml | 1 + modules/aerospike/Makefile | 5 + modules/aerospike/aerospike.go | 87 ++++++++++++ modules/aerospike/aerospike_test.go | 54 ++++++++ modules/aerospike/examples_test.go | 119 ++++++++++++++++ modules/aerospike/go.mod | 68 ++++++++++ modules/aerospike/go.sum | 202 ++++++++++++++++++++++++++++ 9 files changed, 585 insertions(+) create mode 100644 docs/modules/aerospike.md create mode 100644 modules/aerospike/Makefile create mode 100644 modules/aerospike/aerospike.go create mode 100644 modules/aerospike/aerospike_test.go create mode 100644 modules/aerospike/examples_test.go create mode 100644 modules/aerospike/go.mod create mode 100644 modules/aerospike/go.sum diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2efaedd40a..22ef0f554e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -16,6 +16,7 @@ updates: - /examples/nginx - /examples/toxiproxy - /modulegen + - /modules/aerospike - /modules/arangodb - /modules/artemis - /modules/azure diff --git a/docs/modules/aerospike.md b/docs/modules/aerospike.md new file mode 100644 index 0000000000..a17b5bef28 --- /dev/null +++ b/docs/modules/aerospike.md @@ -0,0 +1,48 @@ +# Aerospike + +Not available until the next release of testcontainers-go :material-tag: main + +## Introduction + +The Testcontainers module for Aerospike. + +## Adding this module to your project dependencies + +Please run the following command to add the Aerospike module to your Go dependencies: + +``` +go get github.com/testcontainers/testcontainers-go/modules/aerospike +``` + +## Usage example + + +[Creating a Aerospike container](../../modules/aerospike/examples_test.go) inside_block:runAerospikeContainer + + +## Module Reference + +### Run function + +- Not available until the next release of testcontainers-go :material-tag: main + +The Aerospike module exposes one entrypoint function to create the Aerospike container, and this function receives three parameters: + +```golang +func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*AerospikeContainer, error) +``` + +- `context.Context`, the Go context. +- `string`, the Docker image to use. +- `testcontainers.ContainerCustomizer`, a variadic argument for passing options. + +### Container Options + +When starting the Aerospike container, you can pass options in a variadic way to configure it. + +#### Image + +Use the second argument in the `Run` function to set a valid Docker image. +In example: `Run(context.Background(), "aerospike/aerospike-server:latest")`. + +{% include "../features/common_functional_options.md" %} diff --git a/mkdocs.yml b/mkdocs.yml index e4a3ad5efc..44bf2f2672 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -68,6 +68,7 @@ nav: - Walk: features/wait/walk.md - Modules: - modules/index.md + - modules/aerospike.md - modules/arangodb.md - modules/artemis.md - modules/azure.md diff --git a/modules/aerospike/Makefile b/modules/aerospike/Makefile new file mode 100644 index 0000000000..d125eb29df --- /dev/null +++ b/modules/aerospike/Makefile @@ -0,0 +1,5 @@ +include ../../commons-test.mk + +.PHONY: test +test: + $(MAKE) test-aerospike diff --git a/modules/aerospike/aerospike.go b/modules/aerospike/aerospike.go new file mode 100644 index 0000000000..441cfe9e00 --- /dev/null +++ b/modules/aerospike/aerospike.go @@ -0,0 +1,87 @@ +package aerospike + +import ( + "context" + "fmt" + "time" + + "github.com/testcontainers/testcontainers-go" + "github.com/testcontainers/testcontainers-go/wait" +) + +const ( + port = "3000/tcp" + containerName = "tc_dynamodb_local" +) + +type AerospikeContainer struct { + testcontainers.Container + Host string + Port int +} + +// ConnectionHost returns the host and port of the cassandra container, using the default, native 9000 port, and +// obtaining the host and exposed port from the container +// func (c *AerospikeContainer) ConnectionHost(ctx context.Context) (string, error) { +// host, err := c.Host(ctx) +// if err != nil { +// return "", err +// } + +// port, err := c.MappedPort(ctx, port) +// if err != nil { +// return "", err +// } + +// return host + ":" + port.Port(), nil +// } + +// Run creates an instance of the Aerospike container type +func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*AerospikeContainer, error) { + req := testcontainers.ContainerRequest{ + Image: img, + ExposedPorts: []string{"3000/tcp", "3001/tcp", "3002/tcp", "3003/tcp"}, + Env: map[string]string{ + "AEROSPIKE_CONFIG_FILE": "/etc/aerospike/aerospike.conf", + "NAMESPACE": "test", + }, + WaitingFor: wait.ForAll( + wait.ForLog("migrations: complete"), + wait.ForListeningPort("3000/tcp").WithStartupTimeout(10*time.Second), + wait.ForListeningPort("3001/tcp").WithStartupTimeout(10*time.Second), + wait.ForListeningPort("3002/tcp").WithStartupTimeout(10*time.Second), + ), + } + + genericContainerReq := testcontainers.GenericContainerRequest{ + ContainerRequest: req, + Started: true, + } + + for _, opt := range opts { + if err := opt.Customize(&genericContainerReq); err != nil { + return nil, fmt.Errorf("customize: %w", err) + } + } + + container, err := testcontainers.GenericContainer(ctx, genericContainerReq) + if err != nil { + return nil, fmt.Errorf("failed to start Aerospike container: %w", err) + } + + host, err := container.Host(ctx) + if err != nil { + return nil, fmt.Errorf("failed to get container host: %w", err) + } + + port, err := container.MappedPort(ctx, port) + if err != nil { + return nil, fmt.Errorf("failed to get container port: %w", err) + } + + return &AerospikeContainer{ + Container: container, + Host: host, + Port: port.Int(), + }, nil +} diff --git a/modules/aerospike/aerospike_test.go b/modules/aerospike/aerospike_test.go new file mode 100644 index 0000000000..ee17ee6c9d --- /dev/null +++ b/modules/aerospike/aerospike_test.go @@ -0,0 +1,54 @@ +package aerospike_test + +import ( + "context" + "testing" + "time" + + "github.com/stretchr/testify/require" + "github.com/testcontainers/testcontainers-go" + as "github.com/testcontainers/testcontainers-go/modules/aerospike" +) + +// TestAerospikeDB tests the AerospikeDB container functionality +// It includes tests for starting the container with a valid image, +// applying container customizations, and handling context cancellation. +// It also includes a test for an invalid image to ensure proper error handling. +// The tests use the testcontainers-go library to manage container lifecycle +func TestAeroSpikeDB(t *testing.T) { + t.Run("fails with invalid image", func(t *testing.T) { + ctx := context.Background() + _, err := as.Run(ctx, "invalid-aerospike-image") + require.Error(t, err) + require.Contains(t, err.Error(), "failed to start Aerospike container") + }) + + t.Run("succeeds with valid image", func(t *testing.T) { + ctx := context.Background() + container, err := as.Run(ctx, "aerospike/aerospike-server:latest") + require.NoError(t, err) + require.NotNil(t, container) + defer container.Container.Terminate(ctx) + + require.NotEmpty(t, container.Host) + require.NotEmpty(t, container.Port) + }) + + t.Run("applies container customizations", func(t *testing.T) { + ctx := context.Background() + customEnv := "TEST_ENV=value" + container, err := as.Run(ctx, "aerospike/aerospike-server:latest", + testcontainers.WithEnv(map[string]string{"CUSTOM_ENV": customEnv})) + require.NoError(t, err) + require.NotNil(t, container) + defer container.Container.Terminate(ctx) + }) + + t.Run("respects context cancellation", func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Millisecond) + defer cancel() + + _, err := as.Run(ctx, "aerospike/aerospike-server:latest") + require.Error(t, err) + }) +} diff --git a/modules/aerospike/examples_test.go b/modules/aerospike/examples_test.go new file mode 100644 index 0000000000..8905212bc8 --- /dev/null +++ b/modules/aerospike/examples_test.go @@ -0,0 +1,119 @@ +package aerospike_test + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/aerospike/aerospike-client-go/v8" + "github.com/testcontainers/testcontainers-go" + as "github.com/testcontainers/testcontainers-go/modules/aerospike" +) + +func ExampleRun() { + + ctx := context.Background() + + aerospikedbContainer, err := as.Run(ctx, "aerospike/aerospike-server:latest") + defer func() { + if err := testcontainers.TerminateContainer(aerospikedbContainer.Container); err != nil { + log.Printf("failed to terminate container: %s", err) + } + }() + if err != nil { + log.Printf("failed to start container: %s", err) + return + } + + state, err := aerospikedbContainer.State(ctx) + if err != nil { + log.Printf("failed to get container state: %s", err) + return + } + + fmt.Println(state.Running) + + // Output: + // true +} + +func ExampleRun_usingClient() { + ctx := context.Background() + + aerospikedbContainer, err := as.Run( + ctx, "aerospike/aerospike-server:latest", + ) + defer func() { + if err := testcontainers.TerminateContainer(aerospikedbContainer.Container); err != nil { + log.Printf("failed to terminate container: %s", err) + } + }() + if err != nil { + log.Printf("failed to start container: %s", err) + return + } + + aeroHost := []*aerospike.Host{aerospike.NewHost(aerospikedbContainer.Host, aerospikedbContainer.Port)} + + // connect to the host + cp := aerospike.NewClientPolicy() + cp.Timeout = 10 * time.Second + + // Create a client + client, err := aerospike.NewClientWithPolicyAndHost(cp, aeroHost...) + if err != nil { + log.Printf("Failed to create aerospike client: %v", err) + return + } + + // Close the client + defer client.Close() + + // Create a key + schemaKey, err := aerospike.NewKey("test", "test", "_schema_info") + if err != nil { + log.Printf("Failed to create key: %v", err) + return + } + + version := 1 + description := "test aerospike schema info" + nowStr := time.Now().Format(time.RFC3339) + + // Create schema record + bins := aerospike.BinMap{ + "version": version, + "created_at": nowStr, + "updated_at": nowStr, + "description": description, + } + + // Never expire the schema info + writePolicy := aerospike.NewWritePolicy(0, 0) + + // Store in Aerospike + err = client.Put(writePolicy, schemaKey, bins) + if err != nil { + log.Printf("Failed to put schema info: %v", err) + return + } + + // Get schema record + record, err := client.Get(nil, schemaKey, "version", "created_at", "updated_at", "description") + if err != nil { + log.Printf("Failed to get schema info: %v", err) + return + } + + // Schema exists, check version + existingVersion, _ := record.Bins["version"].(int) + existingDescription, _ := record.Bins["description"].(string) + + fmt.Println(existingVersion) + fmt.Println(existingDescription) + + // Output: + // 1 + // test aerospike schema info +} diff --git a/modules/aerospike/go.mod b/modules/aerospike/go.mod new file mode 100644 index 0000000000..d5ca38aa45 --- /dev/null +++ b/modules/aerospike/go.mod @@ -0,0 +1,68 @@ +module github.com/testcontainers/testcontainers-go/modules/aerospike + +go 1.23.0 + +require ( + github.com/aerospike/aerospike-client-go/v8 v8.2.0 + github.com/stretchr/testify v1.10.0 + github.com/testcontainers/testcontainers-go v0.36.0 +) + +require ( + dario.cat/mergo v1.0.1 // indirect + github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect + github.com/Microsoft/go-winio v0.6.2 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect + github.com/containerd/log v0.1.0 // indirect + github.com/containerd/platforms v0.2.1 // indirect + 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/docker v28.0.1+incompatible // indirect + github.com/docker/go-connections v0.5.0 // indirect + github.com/docker/go-units v0.5.0 // indirect + github.com/ebitengine/purego v0.8.2 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/klauspost/compress v1.17.4 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect + github.com/magiconair/properties v1.8.9 // indirect + github.com/moby/docker-image-spec v1.3.1 // indirect + github.com/moby/patternmatcher v0.6.0 // indirect + github.com/moby/sys/sequential v0.5.0 // indirect + github.com/moby/sys/user v0.1.0 // indirect + github.com/moby/sys/userns v0.1.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.1 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/shirou/gopsutil/v4 v4.25.1 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect + github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad // indirect + github.com/yuin/gopher-lua v1.1.1 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect + go.opentelemetry.io/otel v1.35.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 // indirect + go.opentelemetry.io/otel/metric v1.35.0 // indirect + go.opentelemetry.io/otel/sdk v1.35.0 // indirect + go.opentelemetry.io/otel/trace v1.35.0 // indirect + go.opentelemetry.io/proto/otlp v1.5.0 // indirect + golang.org/x/crypto v0.31.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.31.0 // indirect + golang.org/x/tools v0.28.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250409194420-de1ac958c67a // indirect + google.golang.org/protobuf v1.36.6 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/modules/aerospike/go.sum b/modules/aerospike/go.sum new file mode 100644 index 0000000000..e6a9cea1b7 --- /dev/null +++ b/modules/aerospike/go.sum @@ -0,0 +1,202 @@ +dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= +dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= +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/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= +github.com/aerospike/aerospike-client-go/v8 v8.2.0 h1:6w3X+w5LnmBvQ1X1m4zJH40IWgxZxfMfGhEZxuQlCYo= +github.com/aerospike/aerospike-client-go/v8 v8.2.0/go.mod h1:JmVOIqacquBd0ZjlZ5Dz6bRMSC3LrZCCNojZ/9NS4R0= +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/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= +github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= +github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw= +github.com/cpuguy83/dockercfg v0.3.2 h1:DlJTyZGBDlXqUZ2Dk2Q3xHs/FtnooJJVaad2S9GKorA= +github.com/cpuguy83/dockercfg v0.3.2/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= +github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= +github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= +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/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= +github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/docker/docker v28.0.1+incompatible h1:FCHjSRdXhNRFjlHMTv4jUNlIBbTeRjrWfeFuJp7jpo0= +github.com/docker/docker v28.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= +github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= +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/ebitengine/purego v0.8.2 h1:jPPGWs2sZ1UgOSgD2bClL0MJIqu58nOmIcBuXr62z1I= +github.com/ebitengine/purego v0.8.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg= +github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 h1:VNqngBF40hVlDloBruUehVYC3ArSgIyScOAyMRqBxRg= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1/go.mod h1:RBRO7fro65R6tjKzYgLAFo0t1QEXY1Dp+i/bvpRiqiQ= +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.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4= +github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= +github.com/magiconair/properties v1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a8RkpQM= +github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= +github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= +github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= +github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= +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/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg= +github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU= +github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= +github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= +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/onsi/ginkgo/v2 v2.22.2 h1:/3X8Panh8/WwhU/3Ssa6rCKqPLuAkVY2I0RoyDLySlU= +github.com/onsi/ginkgo/v2 v2.22.2/go.mod h1:oeMosUL+8LtarXBHu/c0bx2D/K9zyQ6uX3cTyztHwsk= +github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= +github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= +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.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= +github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= +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/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/shirou/gopsutil/v4 v4.25.1 h1:QSWkTc+fu9LTAWfkZwZ6j8MSUk4A2LV7rbH0ZqmLjXs= +github.com/shirou/gopsutil/v4 v4.25.1/go.mod h1:RoUCUpndaJFtT+2zsZzzmhvbfGoDCJ7nFXKJf8GqJbI= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/testcontainers/testcontainers-go v0.36.0 h1:YpffyLuHtdp5EUsI5mT4sRw8GZhO/5ozyDT1xWGXt00= +github.com/testcontainers/testcontainers-go v0.36.0/go.mod h1:yk73GVJ0KUZIHUtFna6MO7QS144qYpoY8lEEtU9Hed0= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad h1:W0LEBv82YCGEtcmPA3uNZBI33/qF//HAAs3MawDjRa0= +github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad/go.mod h1:Hy8o65+MXnS6EwGElrSRjUzQDLXreJlzYLlWiHtt8hM= +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/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= +github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= +go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ= +go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 h1:1fTNlAIJZGWLP5FVu0fikVry1IsiUnXjf7QFvoNN3Xw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0/go.mod h1:zjPK58DtkqQFn+YUMbx0M2XV3QgKU0gS9LeGohREyK4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 h1:IeMeyr1aBvBiPVYihXIaeIZba6b8E1bYp7lbdxK8CQg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0/go.mod h1:oVdCUtjq9MK9BlS7TtucsQwUcXcymNiEDjgDD2jMtZU= +go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M= +go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE= +go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY= +go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg= +go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs= +go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc= +go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= +go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4= +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/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +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/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.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +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.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +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-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/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/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +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.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44= +golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +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.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= +golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= +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/api v0.0.0-20250102185135-69823020774d h1:H8tOf8XM88HvKqLTxe755haY6r1fqqzLbEnfrmLXlSA= +google.golang.org/genproto/googleapis/api v0.0.0-20250102185135-69823020774d/go.mod h1:2v7Z7gP2ZUOGsaFyxATQSRoBnKygqVq2Cwnvom7QiqY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250409194420-de1ac958c67a h1:GIqLhp/cYUkuGuiT+vJk8vhOP86L4+SP5j8yXgeVpvI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250409194420-de1ac958c67a/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= +google.golang.org/grpc v1.69.2 h1:U3S9QEtbXC0bYNvRtcoklF3xGtLViumSYxWykJS+7AU= +google.golang.org/grpc v1.69.2/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +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.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.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= From 6d491f1d6a68d0a4b57bd17be618e7b54435713d Mon Sep 17 00:00:00 2001 From: MitulShah1 Date: Thu, 10 Apr 2025 21:05:35 +0530 Subject: [PATCH 02/11] Removed unnecessary code and added doc --- modules/aerospike/aerospike.go | 16 ---------------- modules/aerospike/examples_test.go | 4 ++-- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/modules/aerospike/aerospike.go b/modules/aerospike/aerospike.go index 441cfe9e00..06159a4ba7 100644 --- a/modules/aerospike/aerospike.go +++ b/modules/aerospike/aerospike.go @@ -20,22 +20,6 @@ type AerospikeContainer struct { Port int } -// ConnectionHost returns the host and port of the cassandra container, using the default, native 9000 port, and -// obtaining the host and exposed port from the container -// func (c *AerospikeContainer) ConnectionHost(ctx context.Context) (string, error) { -// host, err := c.Host(ctx) -// if err != nil { -// return "", err -// } - -// port, err := c.MappedPort(ctx, port) -// if err != nil { -// return "", err -// } - -// return host + ":" + port.Port(), nil -// } - // Run creates an instance of the Aerospike container type func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*AerospikeContainer, error) { req := testcontainers.ContainerRequest{ diff --git a/modules/aerospike/examples_test.go b/modules/aerospike/examples_test.go index 8905212bc8..1d0cfcbf31 100644 --- a/modules/aerospike/examples_test.go +++ b/modules/aerospike/examples_test.go @@ -12,7 +12,7 @@ import ( ) func ExampleRun() { - + // runAerospikeContainer { ctx := context.Background() aerospikedbContainer, err := as.Run(ctx, "aerospike/aerospike-server:latest") @@ -25,7 +25,7 @@ func ExampleRun() { log.Printf("failed to start container: %s", err) return } - + // } state, err := aerospikedbContainer.State(ctx) if err != nil { log.Printf("failed to get container state: %s", err) From cc899b2d01bbfe05272e72dad77a2862ccd1f823 Mon Sep 17 00:00:00 2001 From: MitulShah1 Date: Fri, 11 Apr 2025 12:51:13 +0530 Subject: [PATCH 03/11] added suggested changes --- modules/aerospike/aerospike.go | 56 +++++++++++++++++++---------- modules/aerospike/aerospike_test.go | 32 +++++++++++------ modules/aerospike/examples_test.go | 17 ++++++++- 3 files changed, 74 insertions(+), 31 deletions(-) diff --git a/modules/aerospike/aerospike.go b/modules/aerospike/aerospike.go index 06159a4ba7..9d794259e7 100644 --- a/modules/aerospike/aerospike.go +++ b/modules/aerospike/aerospike.go @@ -10,30 +10,41 @@ import ( ) const ( - port = "3000/tcp" - containerName = "tc_dynamodb_local" + // port is the port used for client connections + port = "3000/tcp" + // febricPort is the port used for fabric communication + febricPort = "3001/tcp" + // heartbeatPort is the port used for heartbeat communication + // between nodes in the Aerospike cluster + heartbeatPort = "3002/tcp" + // infoPort is the port used for info commands + infoPort = "3003/tcp" ) +// AerospikeContainer is the Aerospike container type used in the module type AerospikeContainer struct { testcontainers.Container - Host string - Port int +} + +// Deprecated: use Run instead +// RunContainer creates an instance of the Aerospike container type +func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*AerospikeContainer, error) { + return Run(ctx, "aerospike/aerospike-server:latest", opts...) } // Run creates an instance of the Aerospike container type func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*AerospikeContainer, error) { req := testcontainers.ContainerRequest{ Image: img, - ExposedPorts: []string{"3000/tcp", "3001/tcp", "3002/tcp", "3003/tcp"}, + ExposedPorts: []string{port, febricPort, heartbeatPort, infoPort}, Env: map[string]string{ "AEROSPIKE_CONFIG_FILE": "/etc/aerospike/aerospike.conf", - "NAMESPACE": "test", }, WaitingFor: wait.ForAll( wait.ForLog("migrations: complete"), - wait.ForListeningPort("3000/tcp").WithStartupTimeout(10*time.Second), - wait.ForListeningPort("3001/tcp").WithStartupTimeout(10*time.Second), - wait.ForListeningPort("3002/tcp").WithStartupTimeout(10*time.Second), + wait.ForListeningPort(port).WithStartupTimeout(10*time.Second), + wait.ForListeningPort(febricPort).WithStartupTimeout(10*time.Second), + wait.ForListeningPort(heartbeatPort).WithStartupTimeout(10*time.Second), ), } @@ -53,19 +64,26 @@ func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustom return nil, fmt.Errorf("failed to start Aerospike container: %w", err) } - host, err := container.Host(ctx) + return &AerospikeContainer{ + Container: container, + }, nil +} + +// GetHost returns the host of the Aerospike container +func (c *AerospikeContainer) GetHost() (string, error) { + + host, err := c.Host(context.Background()) if err != nil { - return nil, fmt.Errorf("failed to get container host: %w", err) + return "", fmt.Errorf("failed to get container host: %w", err) } + return host, nil +} - port, err := container.MappedPort(ctx, port) +// GetPort returns the port of the Aerospike container +func (c *AerospikeContainer) GetPort() (string, error) { + port, err := c.MappedPort(context.Background(), port) if err != nil { - return nil, fmt.Errorf("failed to get container port: %w", err) + return "", fmt.Errorf("failed to get container port: %w", err) } - - return &AerospikeContainer{ - Container: container, - Host: host, - Port: port.Int(), - }, nil + return port.Port(), nil } diff --git a/modules/aerospike/aerospike_test.go b/modules/aerospike/aerospike_test.go index ee17ee6c9d..5b3310bd4e 100644 --- a/modules/aerospike/aerospike_test.go +++ b/modules/aerospike/aerospike_test.go @@ -10,45 +10,55 @@ import ( as "github.com/testcontainers/testcontainers-go/modules/aerospike" ) -// TestAerospikeDB tests the AerospikeDB container functionality +const ( + aerospikeImage = "aerospike/aerospike-server:latest" +) + +// TestAerospike tests the Aerospike container functionality // It includes tests for starting the container with a valid image, // applying container customizations, and handling context cancellation. // It also includes a test for an invalid image to ensure proper error handling. // The tests use the testcontainers-go library to manage container lifecycle -func TestAeroSpikeDB(t *testing.T) { - t.Run("fails with invalid image", func(t *testing.T) { +func TestAeroSpike(t *testing.T) { + t.Run("fails_with_invalid_image", func(t *testing.T) { ctx := context.Background() _, err := as.Run(ctx, "invalid-aerospike-image") require.Error(t, err) require.Contains(t, err.Error(), "failed to start Aerospike container") }) - t.Run("succeeds with valid image", func(t *testing.T) { + t.Run("succeeds_with_valid_image", func(t *testing.T) { ctx := context.Background() - container, err := as.Run(ctx, "aerospike/aerospike-server:latest") + container, err := as.Run(ctx, aerospikeImage) require.NoError(t, err) require.NotNil(t, container) defer container.Container.Terminate(ctx) - require.NotEmpty(t, container.Host) - require.NotEmpty(t, container.Port) + host, err := container.GetHost() + require.NoError(t, err) + + port, err := container.GetPort() + require.NoError(t, err) + + require.NotEmpty(t, host) + require.NotEmpty(t, port) }) - t.Run("applies container customizations", func(t *testing.T) { + t.Run("applies_container_customizations", func(t *testing.T) { ctx := context.Background() customEnv := "TEST_ENV=value" - container, err := as.Run(ctx, "aerospike/aerospike-server:latest", + container, err := as.Run(ctx, aerospikeImage, testcontainers.WithEnv(map[string]string{"CUSTOM_ENV": customEnv})) require.NoError(t, err) require.NotNil(t, container) defer container.Container.Terminate(ctx) }) - t.Run("respects context cancellation", func(t *testing.T) { + t.Run("respects_context_cancellation", func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 1*time.Millisecond) defer cancel() - _, err := as.Run(ctx, "aerospike/aerospike-server:latest") + _, err := as.Run(ctx, aerospikeImage) require.Error(t, err) }) } diff --git a/modules/aerospike/examples_test.go b/modules/aerospike/examples_test.go index 1d0cfcbf31..c386a51db6 100644 --- a/modules/aerospike/examples_test.go +++ b/modules/aerospike/examples_test.go @@ -53,8 +53,23 @@ func ExampleRun_usingClient() { log.Printf("failed to start container: %s", err) return } + // } + + // Get the host and port + host, err := aerospikedbContainer.Host(ctx) + if err != nil { + log.Printf("failed to get container host: %s", err) + return + } + + // Get the mapped port + port, err := aerospikedbContainer.MappedPort(ctx, "3000/tcp") + if err != nil { + log.Printf("failed to get container port: %s", err) + return + } - aeroHost := []*aerospike.Host{aerospike.NewHost(aerospikedbContainer.Host, aerospikedbContainer.Port)} + aeroHost := []*aerospike.Host{aerospike.NewHost(host, port.Int())} // connect to the host cp := aerospike.NewClientPolicy() From 751f16eb19ff1f14cec947b8cda0362b5b1c9cb4 Mon Sep 17 00:00:00 2001 From: MitulShah1 Date: Fri, 11 Apr 2025 15:01:54 +0530 Subject: [PATCH 04/11] fixed suggested changes --- modules/aerospike/aerospike.go | 47 ++++++++--------------------- modules/aerospike/aerospike_test.go | 4 +-- 2 files changed, 15 insertions(+), 36 deletions(-) diff --git a/modules/aerospike/aerospike.go b/modules/aerospike/aerospike.go index 9d794259e7..ad15b4b601 100644 --- a/modules/aerospike/aerospike.go +++ b/modules/aerospike/aerospike.go @@ -12,8 +12,9 @@ import ( const ( // port is the port used for client connections port = "3000/tcp" - // febricPort is the port used for fabric communication - febricPort = "3001/tcp" + // fabricPort is the port used for Intra-cluster communication port. + // Replica writes, migrations, and other node-to-node communications use the Fabric port. + fabricPort = "3001/tcp" // heartbeatPort is the port used for heartbeat communication // between nodes in the Aerospike cluster heartbeatPort = "3002/tcp" @@ -21,29 +22,23 @@ const ( infoPort = "3003/tcp" ) -// AerospikeContainer is the Aerospike container type used in the module -type AerospikeContainer struct { +// Container is the Aerospike container type used in the module +type Container struct { testcontainers.Container } -// Deprecated: use Run instead -// RunContainer creates an instance of the Aerospike container type -func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*AerospikeContainer, error) { - return Run(ctx, "aerospike/aerospike-server:latest", opts...) -} - // Run creates an instance of the Aerospike container type -func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*AerospikeContainer, error) { +func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*Container, error) { req := testcontainers.ContainerRequest{ Image: img, - ExposedPorts: []string{port, febricPort, heartbeatPort, infoPort}, + ExposedPorts: []string{port, fabricPort, heartbeatPort, infoPort}, Env: map[string]string{ "AEROSPIKE_CONFIG_FILE": "/etc/aerospike/aerospike.conf", }, WaitingFor: wait.ForAll( wait.ForLog("migrations: complete"), wait.ForListeningPort(port).WithStartupTimeout(10*time.Second), - wait.ForListeningPort(febricPort).WithStartupTimeout(10*time.Second), + wait.ForListeningPort(fabricPort).WithStartupTimeout(10*time.Second), wait.ForListeningPort(heartbeatPort).WithStartupTimeout(10*time.Second), ), } @@ -60,30 +55,14 @@ func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustom } container, err := testcontainers.GenericContainer(ctx, genericContainerReq) - if err != nil { - return nil, fmt.Errorf("failed to start Aerospike container: %w", err) + var c *Container + if container != nil { + c = &Container{Container: container} } - return &AerospikeContainer{ - Container: container, - }, nil -} - -// GetHost returns the host of the Aerospike container -func (c *AerospikeContainer) GetHost() (string, error) { - - host, err := c.Host(context.Background()) if err != nil { - return "", fmt.Errorf("failed to get container host: %w", err) + return c, fmt.Errorf("generic container: %w", err) } - return host, nil -} -// GetPort returns the port of the Aerospike container -func (c *AerospikeContainer) GetPort() (string, error) { - port, err := c.MappedPort(context.Background(), port) - if err != nil { - return "", fmt.Errorf("failed to get container port: %w", err) - } - return port.Port(), nil + return c, nil } diff --git a/modules/aerospike/aerospike_test.go b/modules/aerospike/aerospike_test.go index 5b3310bd4e..ad5210df68 100644 --- a/modules/aerospike/aerospike_test.go +++ b/modules/aerospike/aerospike_test.go @@ -34,10 +34,10 @@ func TestAeroSpike(t *testing.T) { require.NotNil(t, container) defer container.Container.Terminate(ctx) - host, err := container.GetHost() + host, err := container.Host(ctx) require.NoError(t, err) - port, err := container.GetPort() + port, err := container.MappedPort(ctx, "3000/tcp") require.NoError(t, err) require.NotEmpty(t, host) From aec7de8d2353e22b4bfab5840af688e602dfd834 Mon Sep 17 00:00:00 2001 From: MitulShah1 Date: Fri, 11 Apr 2025 15:49:53 +0530 Subject: [PATCH 05/11] fixed lint and suggested changes --- docs/modules/aerospike.md | 1 - modules/aerospike/aerospike_test.go | 31 +++++++++++++++++++---------- modules/aerospike/examples_test.go | 21 +++++++++---------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/docs/modules/aerospike.md b/docs/modules/aerospike.md index a17b5bef28..ac57cd2c8e 100644 --- a/docs/modules/aerospike.md +++ b/docs/modules/aerospike.md @@ -45,4 +45,3 @@ When starting the Aerospike container, you can pass options in a variadic way to Use the second argument in the `Run` function to set a valid Docker image. In example: `Run(context.Background(), "aerospike/aerospike-server:latest")`. -{% include "../features/common_functional_options.md" %} diff --git a/modules/aerospike/aerospike_test.go b/modules/aerospike/aerospike_test.go index ad5210df68..a86bea6c3d 100644 --- a/modules/aerospike/aerospike_test.go +++ b/modules/aerospike/aerospike_test.go @@ -6,8 +6,9 @@ import ( "time" "github.com/stretchr/testify/require" + "github.com/testcontainers/testcontainers-go" - as "github.com/testcontainers/testcontainers-go/modules/aerospike" + tcaerospike "github.com/testcontainers/testcontainers-go/modules/aerospike" ) const ( @@ -20,19 +21,23 @@ const ( // It also includes a test for an invalid image to ensure proper error handling. // The tests use the testcontainers-go library to manage container lifecycle func TestAeroSpike(t *testing.T) { - t.Run("fails_with_invalid_image", func(t *testing.T) { + t.Run("invalid-image-fails", func(t *testing.T) { ctx := context.Background() - _, err := as.Run(ctx, "invalid-aerospike-image") + _, err := tcaerospike.Run(ctx, "invalid-aerospike-image") require.Error(t, err) require.Contains(t, err.Error(), "failed to start Aerospike container") }) - t.Run("succeeds_with_valid_image", func(t *testing.T) { + t.Run("valid-image-succeeds", func(t *testing.T) { ctx := context.Background() - container, err := as.Run(ctx, aerospikeImage) + container, err := tcaerospike.Run(ctx, aerospikeImage) require.NoError(t, err) require.NotNil(t, container) - defer container.Container.Terminate(ctx) + + defer func() { + err := container.Terminate(ctx) + require.NoError(t, err) + }() host, err := container.Host(ctx) require.NoError(t, err) @@ -44,21 +49,25 @@ func TestAeroSpike(t *testing.T) { require.NotEmpty(t, port) }) - t.Run("applies_container_customizations", func(t *testing.T) { + t.Run("applies-container-customizations", func(t *testing.T) { ctx := context.Background() customEnv := "TEST_ENV=value" - container, err := as.Run(ctx, aerospikeImage, + container, err := tcaerospike.Run(ctx, aerospikeImage, testcontainers.WithEnv(map[string]string{"CUSTOM_ENV": customEnv})) require.NoError(t, err) require.NotNil(t, container) - defer container.Container.Terminate(ctx) + + defer func() { + err := container.Terminate(ctx) + require.NoError(t, err) + }() }) - t.Run("respects_context_cancellation", func(t *testing.T) { + t.Run("respects-context-cancellation", func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 1*time.Millisecond) defer cancel() - _, err := as.Run(ctx, aerospikeImage) + _, err := tcaerospike.Run(ctx, aerospikeImage) require.Error(t, err) }) } diff --git a/modules/aerospike/examples_test.go b/modules/aerospike/examples_test.go index c386a51db6..b58a027ff3 100644 --- a/modules/aerospike/examples_test.go +++ b/modules/aerospike/examples_test.go @@ -6,16 +6,17 @@ import ( "log" "time" - "github.com/aerospike/aerospike-client-go/v8" + aero "github.com/aerospike/aerospike-client-go/v8" + "github.com/testcontainers/testcontainers-go" - as "github.com/testcontainers/testcontainers-go/modules/aerospike" + tcaerospike "github.com/testcontainers/testcontainers-go/modules/aerospike" ) func ExampleRun() { // runAerospikeContainer { ctx := context.Background() - aerospikedbContainer, err := as.Run(ctx, "aerospike/aerospike-server:latest") + aerospikedbContainer, err := tcaerospike.Run(ctx, "aerospike/aerospike-server:latest") defer func() { if err := testcontainers.TerminateContainer(aerospikedbContainer.Container); err != nil { log.Printf("failed to terminate container: %s", err) @@ -41,7 +42,7 @@ func ExampleRun() { func ExampleRun_usingClient() { ctx := context.Background() - aerospikedbContainer, err := as.Run( + aerospikedbContainer, err := tcaerospike.Run( ctx, "aerospike/aerospike-server:latest", ) defer func() { @@ -69,14 +70,14 @@ func ExampleRun_usingClient() { return } - aeroHost := []*aerospike.Host{aerospike.NewHost(host, port.Int())} + aeroHost := []*aero.Host{aero.NewHost(host, port.Int())} // connect to the host - cp := aerospike.NewClientPolicy() + cp := aero.NewClientPolicy() cp.Timeout = 10 * time.Second // Create a client - client, err := aerospike.NewClientWithPolicyAndHost(cp, aeroHost...) + client, err := aero.NewClientWithPolicyAndHost(cp, aeroHost...) if err != nil { log.Printf("Failed to create aerospike client: %v", err) return @@ -86,7 +87,7 @@ func ExampleRun_usingClient() { defer client.Close() // Create a key - schemaKey, err := aerospike.NewKey("test", "test", "_schema_info") + schemaKey, err := aero.NewKey("test", "test", "_schema_info") if err != nil { log.Printf("Failed to create key: %v", err) return @@ -97,7 +98,7 @@ func ExampleRun_usingClient() { nowStr := time.Now().Format(time.RFC3339) // Create schema record - bins := aerospike.BinMap{ + bins := aero.BinMap{ "version": version, "created_at": nowStr, "updated_at": nowStr, @@ -105,7 +106,7 @@ func ExampleRun_usingClient() { } // Never expire the schema info - writePolicy := aerospike.NewWritePolicy(0, 0) + writePolicy := aero.NewWritePolicy(0, 0) // Store in Aerospike err = client.Put(writePolicy, schemaKey, bins) From c3acbdc9982f2750910a17f1d81ba5498875e954 Mon Sep 17 00:00:00 2001 From: MitulShah1 Date: Fri, 11 Apr 2025 16:02:39 +0530 Subject: [PATCH 06/11] added client example in read me --- docs/modules/aerospike.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/modules/aerospike.md b/docs/modules/aerospike.md index ac57cd2c8e..14b3a45c8c 100644 --- a/docs/modules/aerospike.md +++ b/docs/modules/aerospike.md @@ -45,3 +45,10 @@ When starting the Aerospike container, you can pass options in a variadic way to Use the second argument in the `Run` function to set a valid Docker image. In example: `Run(context.Background(), "aerospike/aerospike-server:latest")`. +## Examples + +### Aerospike Client + + +[Aerospike Client](../../modules/aerospike/examples_test.go) inside_block:usingClient + From 385d796ef13ad67a53c65460d9381aed393d8e41 Mon Sep 17 00:00:00 2001 From: MitulShah1 Date: Fri, 11 Apr 2025 16:09:21 +0530 Subject: [PATCH 07/11] Removed terminate and used CleanupContainer --- modules/aerospike/aerospike_test.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/modules/aerospike/aerospike_test.go b/modules/aerospike/aerospike_test.go index a86bea6c3d..016a543f7a 100644 --- a/modules/aerospike/aerospike_test.go +++ b/modules/aerospike/aerospike_test.go @@ -34,10 +34,7 @@ func TestAeroSpike(t *testing.T) { require.NoError(t, err) require.NotNil(t, container) - defer func() { - err := container.Terminate(ctx) - require.NoError(t, err) - }() + testcontainers.CleanupContainer(t, container) host, err := container.Host(ctx) require.NoError(t, err) @@ -56,11 +53,7 @@ func TestAeroSpike(t *testing.T) { testcontainers.WithEnv(map[string]string{"CUSTOM_ENV": customEnv})) require.NoError(t, err) require.NotNil(t, container) - - defer func() { - err := container.Terminate(ctx) - require.NoError(t, err) - }() + testcontainers.CleanupContainer(t, container) }) t.Run("respects-context-cancellation", func(t *testing.T) { From e2c11aeb90e55069c7742307fb2afb0a37b4fea7 Mon Sep 17 00:00:00 2001 From: MitulShah1 Date: Fri, 11 Apr 2025 16:15:37 +0530 Subject: [PATCH 08/11] fixed read me file --- docs/modules/aerospike.md | 2 ++ modules/aerospike/aerospike_test.go | 9 --------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/docs/modules/aerospike.md b/docs/modules/aerospike.md index 14b3a45c8c..e88f6efb29 100644 --- a/docs/modules/aerospike.md +++ b/docs/modules/aerospike.md @@ -45,6 +45,8 @@ When starting the Aerospike container, you can pass options in a variadic way to Use the second argument in the `Run` function to set a valid Docker image. In example: `Run(context.Background(), "aerospike/aerospike-server:latest")`. +{% include "../features/common_functional_options.md" %} + ## Examples ### Aerospike Client diff --git a/modules/aerospike/aerospike_test.go b/modules/aerospike/aerospike_test.go index 016a543f7a..c3254d8fc6 100644 --- a/modules/aerospike/aerospike_test.go +++ b/modules/aerospike/aerospike_test.go @@ -35,15 +35,6 @@ func TestAeroSpike(t *testing.T) { require.NotNil(t, container) testcontainers.CleanupContainer(t, container) - - host, err := container.Host(ctx) - require.NoError(t, err) - - port, err := container.MappedPort(ctx, "3000/tcp") - require.NoError(t, err) - - require.NotEmpty(t, host) - require.NotEmpty(t, port) }) t.Run("applies-container-customizations", func(t *testing.T) { From 4df753581787f55e5d0f55f28abeec413422648c Mon Sep 17 00:00:00 2001 From: MitulShah1 Date: Fri, 11 Apr 2025 16:38:17 +0530 Subject: [PATCH 09/11] fixed code snippet render issue in docs --- modules/aerospike/examples_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/aerospike/examples_test.go b/modules/aerospike/examples_test.go index b58a027ff3..0fba6ccc5a 100644 --- a/modules/aerospike/examples_test.go +++ b/modules/aerospike/examples_test.go @@ -54,7 +54,6 @@ func ExampleRun_usingClient() { log.Printf("failed to start container: %s", err) return } - // } // Get the host and port host, err := aerospikedbContainer.Host(ctx) From 6e5777d54b7b6b5a3fa07b6876c06acf82f01f92 Mon Sep 17 00:00:00 2001 From: MitulShah1 Date: Fri, 11 Apr 2025 16:52:49 +0530 Subject: [PATCH 10/11] fixed suggested changes --- modules/aerospike/aerospike.go | 1 - modules/aerospike/aerospike_test.go | 19 ++++++++++--------- modules/aerospike/examples_test.go | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/aerospike/aerospike.go b/modules/aerospike/aerospike.go index ad15b4b601..c2d564cd25 100644 --- a/modules/aerospike/aerospike.go +++ b/modules/aerospike/aerospike.go @@ -36,7 +36,6 @@ func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustom "AEROSPIKE_CONFIG_FILE": "/etc/aerospike/aerospike.conf", }, WaitingFor: wait.ForAll( - wait.ForLog("migrations: complete"), wait.ForListeningPort(port).WithStartupTimeout(10*time.Second), wait.ForListeningPort(fabricPort).WithStartupTimeout(10*time.Second), wait.ForListeningPort(heartbeatPort).WithStartupTimeout(10*time.Second), diff --git a/modules/aerospike/aerospike_test.go b/modules/aerospike/aerospike_test.go index c3254d8fc6..a7d26ac0e2 100644 --- a/modules/aerospike/aerospike_test.go +++ b/modules/aerospike/aerospike_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" "github.com/testcontainers/testcontainers-go" - tcaerospike "github.com/testcontainers/testcontainers-go/modules/aerospike" + "github.com/testcontainers/testcontainers-go/modules/aerospike" ) const ( @@ -23,35 +23,36 @@ const ( func TestAeroSpike(t *testing.T) { t.Run("invalid-image-fails", func(t *testing.T) { ctx := context.Background() - _, err := tcaerospike.Run(ctx, "invalid-aerospike-image") + container, err := aerospike.Run(ctx, "invalid-aerospike-image") + testcontainers.CleanupContainer(t, container) require.Error(t, err) require.Contains(t, err.Error(), "failed to start Aerospike container") }) t.Run("valid-image-succeeds", func(t *testing.T) { ctx := context.Background() - container, err := tcaerospike.Run(ctx, aerospikeImage) + container, err := aerospike.Run(ctx, aerospikeImage) + testcontainers.CleanupContainer(t, container) require.NoError(t, err) require.NotNil(t, container) - - testcontainers.CleanupContainer(t, container) }) t.Run("applies-container-customizations", func(t *testing.T) { ctx := context.Background() customEnv := "TEST_ENV=value" - container, err := tcaerospike.Run(ctx, aerospikeImage, + container, err := aerospike.Run(ctx, aerospikeImage, testcontainers.WithEnv(map[string]string{"CUSTOM_ENV": customEnv})) + testcontainers.CleanupContainer(t, container) require.NoError(t, err) require.NotNil(t, container) - testcontainers.CleanupContainer(t, container) + }) t.Run("respects-context-cancellation", func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 1*time.Millisecond) defer cancel() - - _, err := tcaerospike.Run(ctx, aerospikeImage) + container, err := aerospike.Run(ctx, aerospikeImage) + testcontainers.CleanupContainer(t, container) require.Error(t, err) }) } diff --git a/modules/aerospike/examples_test.go b/modules/aerospike/examples_test.go index 0fba6ccc5a..338511f025 100644 --- a/modules/aerospike/examples_test.go +++ b/modules/aerospike/examples_test.go @@ -9,16 +9,16 @@ import ( aero "github.com/aerospike/aerospike-client-go/v8" "github.com/testcontainers/testcontainers-go" - tcaerospike "github.com/testcontainers/testcontainers-go/modules/aerospike" + "github.com/testcontainers/testcontainers-go/modules/aerospike" ) func ExampleRun() { // runAerospikeContainer { ctx := context.Background() - aerospikedbContainer, err := tcaerospike.Run(ctx, "aerospike/aerospike-server:latest") + aerospikeContainer, err := aerospike.Run(ctx, "aerospike/aerospike-server:latest") defer func() { - if err := testcontainers.TerminateContainer(aerospikedbContainer.Container); err != nil { + if err := testcontainers.TerminateContainer(aerospikeContainer); err != nil { log.Printf("failed to terminate container: %s", err) } }() @@ -27,7 +27,7 @@ func ExampleRun() { return } // } - state, err := aerospikedbContainer.State(ctx) + state, err := aerospikeContainer.State(ctx) if err != nil { log.Printf("failed to get container state: %s", err) return @@ -42,11 +42,11 @@ func ExampleRun() { func ExampleRun_usingClient() { ctx := context.Background() - aerospikedbContainer, err := tcaerospike.Run( + aerospikeContainer, err := aerospike.Run( ctx, "aerospike/aerospike-server:latest", ) defer func() { - if err := testcontainers.TerminateContainer(aerospikedbContainer.Container); err != nil { + if err := testcontainers.TerminateContainer(aerospikeContainer); err != nil { log.Printf("failed to terminate container: %s", err) } }() @@ -56,14 +56,14 @@ func ExampleRun_usingClient() { } // Get the host and port - host, err := aerospikedbContainer.Host(ctx) + host, err := aerospikeContainer.Host(ctx) if err != nil { log.Printf("failed to get container host: %s", err) return } // Get the mapped port - port, err := aerospikedbContainer.MappedPort(ctx, "3000/tcp") + port, err := aerospikeContainer.MappedPort(ctx, "3000/tcp") if err != nil { log.Printf("failed to get container port: %s", err) return From 15154883c5270dad38587cfd77f03a8f116b2c24 Mon Sep 17 00:00:00 2001 From: MitulShah1 Date: Fri, 11 Apr 2025 17:13:55 +0530 Subject: [PATCH 11/11] removed unnecessary testcases and reverted log --- modules/aerospike/aerospike.go | 1 + modules/aerospike/aerospike_test.go | 9 --------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/modules/aerospike/aerospike.go b/modules/aerospike/aerospike.go index c2d564cd25..ad15b4b601 100644 --- a/modules/aerospike/aerospike.go +++ b/modules/aerospike/aerospike.go @@ -36,6 +36,7 @@ func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustom "AEROSPIKE_CONFIG_FILE": "/etc/aerospike/aerospike.conf", }, WaitingFor: wait.ForAll( + wait.ForLog("migrations: complete"), wait.ForListeningPort(port).WithStartupTimeout(10*time.Second), wait.ForListeningPort(fabricPort).WithStartupTimeout(10*time.Second), wait.ForListeningPort(heartbeatPort).WithStartupTimeout(10*time.Second), diff --git a/modules/aerospike/aerospike_test.go b/modules/aerospike/aerospike_test.go index a7d26ac0e2..685e0d0724 100644 --- a/modules/aerospike/aerospike_test.go +++ b/modules/aerospike/aerospike_test.go @@ -21,14 +21,6 @@ const ( // It also includes a test for an invalid image to ensure proper error handling. // The tests use the testcontainers-go library to manage container lifecycle func TestAeroSpike(t *testing.T) { - t.Run("invalid-image-fails", func(t *testing.T) { - ctx := context.Background() - container, err := aerospike.Run(ctx, "invalid-aerospike-image") - testcontainers.CleanupContainer(t, container) - require.Error(t, err) - require.Contains(t, err.Error(), "failed to start Aerospike container") - }) - t.Run("valid-image-succeeds", func(t *testing.T) { ctx := context.Background() container, err := aerospike.Run(ctx, aerospikeImage) @@ -45,7 +37,6 @@ func TestAeroSpike(t *testing.T) { testcontainers.CleanupContainer(t, container) require.NoError(t, err) require.NotNil(t, container) - }) t.Run("respects-context-cancellation", func(t *testing.T) {