diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3b1a87c7d4..04a24e1020 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -142,6 +142,13 @@ updates: day: sunday open-pull-requests-limit: 3 rebase-strategy: disabled + - package-ecosystem: gomod + directory: /modules/mockserver + schedule: + interval: monthly + day: sunday + open-pull-requests-limit: 3 + rebase-strategy: disabled - package-ecosystem: gomod directory: /modules/mongodb schedule: diff --git a/.github/workflows/ci-test-go.yml b/.github/workflows/ci-test-go.yml index 00ff71bf29..97cbdee663 100644 --- a/.github/workflows/ci-test-go.yml +++ b/.github/workflows/ci-test-go.yml @@ -71,11 +71,11 @@ jobs: - name: golangci-lint # TODO: Remove each example/module once it passes the golangci-lint - if: ${{ inputs.platform == 'ubuntu-latest' && inputs.go-version == '1.20.x' && !contains(fromJSON('["examples/cockroachdb", "examples/toxiproxy", "modules/compose", "modules/pulsar", "modules/redis"]'), inputs.project-directory) }} + if: ${{ inputs.platform == 'ubuntu-latest' && inputs.go-version == '1.20.x' && !contains(fromJSON('["modules/compose"]'), inputs.project-directory) }} uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.54.1 + version: v1.55.2 # Optional: working directory, useful for monorepos working-directory: ${{ inputs.project-directory }} # Optional: golangci-lint command line arguments. @@ -104,9 +104,7 @@ jobs: if: ${{ inputs.run-tests }} working-directory: ./${{ inputs.project-directory }} timeout-minutes: 30 - run: | - go install gotest.tools/gotestsum@latest - make test-unit + run: make test-unit - name: Upload SonarCloud files if: ${{ github.ref_name == 'main' && github.repository_owner == 'testcontainers' && inputs.run-tests && !inputs.rootless-docker }} diff --git a/.github/workflows/ci-windows-trigger.yml b/.github/workflows/ci-windows-trigger.yml index b4d7774870..696549c4f0 100644 --- a/.github/workflows/ci-windows-trigger.yml +++ b/.github/workflows/ci-windows-trigger.yml @@ -4,13 +4,18 @@ on: issue_comment: types: [created] +permissions: + contents: read + jobs: windows-test-command-trigger: + permissions: + pull-requests: write # for peter-evans/slash-command-dispatch to create PR reaction runs-on: ubuntu-22.04 steps: - name: Trigger windows-test command - uses: peter-evans/slash-command-dispatch@v3 + uses: peter-evans/slash-command-dispatch@f996d7b7aae9059759ac55e978cff76d91853301 # v3.0.2 with: token: ${{ secrets.WINDOWS_WORKERS_TOKEN }} # The command to trigger the pipeline: e.g. /windows-test diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index f0931d57b0..9f868aa8f0 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -13,7 +13,7 @@ jobs: timeout-minutes: 30 steps: - name: Create pending status - uses: actions/github-script@v7.0.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | @@ -27,7 +27,7 @@ jobs: }) - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: token: ${{ secrets.GITHUB_TOKEN }} repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} @@ -50,12 +50,10 @@ jobs: - name: go test timeout-minutes: 30 - run: | - go install gotest.tools/gotestsum@latest - gotestsum --format short-verbose --rerun-fails=5 --packages="./..." --junitfile TEST-unit.xml -- -timeout=30m + run: make test-unit - name: Create success status - uses: actions/github-script@v7.0.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 if: success() with: github-token: ${{secrets.GITHUB_TOKEN}} @@ -70,7 +68,7 @@ jobs: }) - name: Create failure status - uses: actions/github-script@v7.0.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 if: failure() with: github-token: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c6f0692c5..8bf4be4ea8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,12 +41,11 @@ jobs: ryuk-disabled: false # The job below is a copy of the job above, but with ryuk disabled. - # It's executed in a secondary stage to avoid concurrency issues. + # It's executed in the first stage to avoid concurrency issues. test-reaper-off: # do not run this job if it's a PR from dependabot that is not approved yet if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.state != 'approved' && github.triggering_actor == 'dependabot[bot]') }} name: "Test with reaper off" - needs: test strategy: matrix: go-version: [1.20.x, 1.x] @@ -61,12 +60,11 @@ jobs: ryuk-disabled: true # The job below is a copy of the job above, but with Docker rootless. - # It's executed in a secondary stage to avoid concurrency issues. + # It's executed in the first stage to avoid concurrency issues. test-rootless-docker: # do not run this job if it's a PR from dependabot that is not approved yet if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.state != 'approved' && github.triggering_actor == 'dependabot[bot]') }} name: "Test with Rootless Docker" - needs: test strategy: matrix: go-version: [1.20.x, 1.x] @@ -106,7 +104,7 @@ jobs: matrix: go-version: [1.20.x, 1.x] platform: [ubuntu-latest, macos-latest] - module: [artemis, cassandra, clickhouse, compose, couchbase, elasticsearch, gcloud, k3s, k6, kafka, localstack, mariadb, mongodb, mssql, mysql, nats, neo4j, postgres, pulsar, rabbitmq, redis, redpanda, vault] + module: [artemis, cassandra, clickhouse, compose, couchbase, elasticsearch, gcloud, k3s, k6, kafka, localstack, mariadb, mockserver, mongodb, mssql, mysql, nats, neo4j, postgres, pulsar, rabbitmq, redis, redpanda, vault] exclude: - go-version: 1.20.x module: compose @@ -138,22 +136,25 @@ jobs: ryuk-disabled: false sonarcloud: + permissions: + contents: read # for actions/checkout to fetch code + pull-requests: read # for sonarsource/sonarcloud-github-action to determine which PR to decorate if: ${{ github.ref_name == 'main' && github.repository_owner == 'testcontainers' }} needs: test-examples runs-on: ubuntu-latest steps: - name: Check out code into the Go module directory - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: # Disabling shallow clone is recommended for improving relevancy of reporting fetch-depth: 0 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 with: name: sonarcloud - name: Analyze with SonarCloud - uses: sonarsource/sonarcloud-github-action@master + uses: sonarsource/sonarcloud-github-action@49e6cd3b187936a73b8280d59ffd9da69df63ec9 # v2.1.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0efa608b4e..0d75b54976 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -20,6 +20,9 @@ on: schedule: - cron: '40 6 * * 5' +permissions: + contents: read + jobs: analyze: name: Analyze diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 95016dfde0..29c2b72ee0 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -6,8 +6,14 @@ on: branches: - main +permissions: + contents: read + jobs: update_release_draft: + permissions: + contents: write # for release-drafter/release-drafter to create a github release + pull-requests: write # for release-drafter/release-drafter to add label to PR runs-on: ubuntu-latest steps: - uses: release-drafter/release-drafter@09c613e259eb8d4e7c81c2cb00618eb5fc4575a7 # v5.19.0 diff --git a/.golangci.yml b/.golangci.yml index 34c05c3176..8adf7e6b0e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,6 +6,7 @@ linters: - gofumpt - misspell - nonamedreturns + - testifylint linters-settings: errorlint: @@ -23,5 +24,20 @@ linters-settings: - standard - default - prefix(github.com/testcontainers) + testifylint: + disable: + - compares + - float-compare + - go-require + enable: + - bool-compare + - empty + - error-is-as + - error-nil + - expected-actual + - len + - require-error + - suite-dont-use-pkg + - suite-extra-assert-call run: timeout: 5m diff --git a/.vscode/.testcontainers-go.code-workspace b/.vscode/.testcontainers-go.code-workspace index 728d8d711d..b09b768264 100644 --- a/.vscode/.testcontainers-go.code-workspace +++ b/.vscode/.testcontainers-go.code-workspace @@ -69,6 +69,10 @@ "name": "module / mariadb", "path": "../modules/mariadb" }, + { + "name": "module / mockserver", + "path": "../modules/mockserver" + }, { "name": "module / mongodb", "path": "../modules/mongodb" diff --git a/Pipfile.lock b/Pipfile.lock index e706f376be..831f0a584f 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -177,11 +177,12 @@ }, "jinja2": { "hashes": [ - "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852", - "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61" + "sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa", + "sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90" ], + "index": "pypi", "markers": "python_version >= '3.7'", - "version": "==3.1.2" + "version": "==3.1.3" }, "markdown": { "hashes": [ diff --git a/commons-test.mk b/commons-test.mk index 6a0606e7d3..e99d62a224 100644 --- a/commons-test.mk +++ b/commons-test.mk @@ -1,4 +1,23 @@ ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) +GOBIN= $(GOPATH)/bin + +define go_install + go install $(1) +endef + +$(GOBIN)/golangci-lint: + $(call go_install,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2) + +$(GOBIN)/gotestsum: + $(call go_install,gotest.tools/gotestsum@latest) + +.PHONY: install +install: $(GOBIN)/golangci-lint $(GOBIN)/gotestsum + +.PHONY: clean +clean: + rm $(GOBIN)/golangci-lint + rm $(GOBIN)/gotestsum .PHONY: dependencies-scan dependencies-scan: @@ -6,11 +25,11 @@ dependencies-scan: go list -json -m all | docker run --rm -i sonatypecommunity/nancy:latest sleuth --skip-update-check .PHONY: lint -lint: +lint: $(GOBIN)/golangci-lint golangci-lint run --out-format=github-actions --path-prefix=. --verbose -c $(ROOT_DIR)/.golangci.yml --fix .PHONY: test-% -test-%: +test-%: $(GOBIN)/gotestsum @echo "Running $* tests..." gotestsum \ --format short-verbose \ @@ -26,8 +45,7 @@ tools: go mod download .PHONY: test-tools -test-tools: - go install gotest.tools/gotestsum@latest +test-tools: $(GOBIN)/gotestsum .PHONY: tools-tidy tools-tidy: diff --git a/docker.go b/docker.go index b9dbef976d..99e8158969 100644 --- a/docker.go +++ b/docker.go @@ -626,7 +626,7 @@ func (c *DockerContainer) CopyToContainer(ctx context.Context, fileContent []byt return err } - err = c.provider.client.CopyToContainer(ctx, c.ID, filepath.Dir(containerFilePath), buffer, types.CopyToContainerOptions{}) + err = c.provider.client.CopyToContainer(ctx, c.ID, "/", buffer, types.CopyToContainerOptions{}) if err != nil { return err } diff --git a/docker_auth_test.go b/docker_auth_test.go index f64c9d0a18..514cf753c7 100644 --- a/docker_auth_test.go +++ b/docker_auth_test.go @@ -29,14 +29,14 @@ func TestGetDockerConfig(t *testing.T) { // Verify that the default docker config file exists before any test in this suite runs. // Then, we can safely run the tests that rely on it. defaultCfg, err := dockercfg.LoadDefaultConfig() - require.Nil(t, err) + require.NoError(t, err) require.NotEmpty(t, defaultCfg) t.Run("without DOCKER_CONFIG env var retrieves default", func(t *testing.T) { t.Setenv("DOCKER_CONFIG", "") cfg, err := getDockerConfig() - require.Nil(t, err) + require.NoError(t, err) require.NotEmpty(t, cfg) assert.Equal(t, defaultCfg, cfg) @@ -46,7 +46,7 @@ func TestGetDockerConfig(t *testing.T) { t.Setenv("DOCKER_CONFIG", filepath.Join(testDockerConfigDirPath, "non-existing")) cfg, err := getDockerConfig() - require.NotNil(t, err) + require.Error(t, err) require.Empty(t, cfg) }) @@ -54,10 +54,10 @@ func TestGetDockerConfig(t *testing.T) { t.Setenv("DOCKER_CONFIG", testDockerConfigDirPath) cfg, err := getDockerConfig() - require.Nil(t, err) + require.NoError(t, err) require.NotEmpty(t, cfg) - assert.Equal(t, 3, len(cfg.AuthConfigs)) + assert.Len(t, cfg.AuthConfigs, 3) authCfgs := cfg.AuthConfigs @@ -82,10 +82,10 @@ func TestGetDockerConfig(t *testing.T) { t.Setenv("DOCKER_CONFIG", testDockerConfigDirPath) cfg, err := getDockerConfig() - require.Nil(t, err) + require.NoError(t, err) require.NotEmpty(t, cfg) - assert.Equal(t, 1, len(cfg.AuthConfigs)) + assert.Len(t, cfg.AuthConfigs, 1) authCfgs := cfg.AuthConfigs @@ -108,7 +108,7 @@ func TestGetDockerConfig(t *testing.T) { }`) registry, cfg, err := DockerImageAuth(context.Background(), exampleAuth+"/my/image:latest") - require.Nil(t, err) + require.NoError(t, err) require.NotEmpty(t, cfg) assert.Equal(t, exampleAuth, registry) @@ -130,7 +130,7 @@ func TestGetDockerConfig(t *testing.T) { }`) registry, cfg, err := DockerImageAuth(context.Background(), imageReg+imagePath) - require.Nil(t, err) + require.NoError(t, err) require.NotEmpty(t, cfg) assert.Equal(t, imageReg, registry) @@ -277,14 +277,14 @@ func TestCreateContainerFromPrivateRegistry(t *testing.T) { ContainerRequest: req, Started: true, }) - require.Nil(t, err) + require.NoError(t, err) terminateContainerOnEnd(t, ctx, redisContainer) } func prepareLocalRegistryWithAuth(t *testing.T) { ctx := context.Background() wd, err := os.Getwd() - assert.NoError(t, err) + require.NoError(t, err) // copyDirectoryToContainer { req := ContainerRequest{ Image: "registry:2", @@ -316,13 +316,13 @@ func prepareLocalRegistryWithAuth(t *testing.T) { } registryC, err := GenericContainer(ctx, genContainerReq) - assert.NoError(t, err) + require.NoError(t, err) t.Cleanup(func() { removeImageFromLocalCache(t, "localhost:5001/redis:5.0-alpine") }) t.Cleanup(func() { - assert.NoError(t, registryC.Terminate(context.Background())) + require.NoError(t, registryC.Terminate(context.Background())) }) _, cancel := context.WithCancel(context.Background()) diff --git a/docker_test.go b/docker_test.go index 80fb02e3df..66c7ae7167 100644 --- a/docker_test.go +++ b/docker_test.go @@ -27,7 +27,7 @@ import ( ) const ( - mysqlImage = "docker.io/mysql:8.0.30" + mysqlImage = "docker.io/mysql:8.0.36" nginxDelayedImage = "docker.io/menedev/delayed-nginx:1.15.2" nginxImage = "docker.io/nginx" nginxAlpineImage = "docker.io/nginx:alpine" @@ -299,7 +299,7 @@ func TestContainerStateAfterTermination(t *testing.T) { } state, err := nginx.State(ctx) - assert.Error(t, err, "expected error from container inspect.") + require.Error(t, err, "expected error from container inspect.") assert.Nil(t, state, "expected nil container inspect.") }) @@ -312,7 +312,7 @@ func TestContainerStateAfterTermination(t *testing.T) { } state, err := nginx.State(ctx) - assert.NoError(t, err, "unexpected error from container inspect before container termination.") + require.NoError(t, err, "unexpected error from container inspect before container termination.") assert.NotNil(t, state, "unexpected nil container inspect before container termination.") @@ -323,7 +323,7 @@ func TestContainerStateAfterTermination(t *testing.T) { } state, err = nginx.State(ctx) - assert.Error(t, err, "expected error from container inspect after container termination.") + require.Error(t, err, "expected error from container inspect after container termination.") assert.NotNil(t, state, "unexpected nil container inspect after container termination.") }) @@ -508,7 +508,10 @@ func TestContainerCreation(t *testing.T) { fmt.Printf("%v", networkAliases) t.Errorf("Expected number of connected networks %d. Got %d.", 0, len(networkAliases)) } - if len(networkAliases["bridge"]) != 0 { + + if os.Getenv("XDG_RUNTIME_DIR") != "" { + t.Log("[Docker Rootless] do not assert that the container should have zero aliases in the bridge network") + } else if len(networkAliases["bridge"]) != 0 { t.Errorf("Expected number of aliases for 'bridge' network %d. Got %d.", 0, len(networkAliases["bridge"])) } } @@ -1261,7 +1264,7 @@ func TestContainerCustomPlatformImage(t *testing.T) { terminateContainerOnEnd(t, ctx, c) - assert.Error(t, err) + require.Error(t, err) }) t.Run("specific platform should be propagated", func(t *testing.T) { @@ -1271,7 +1274,7 @@ func TestContainerCustomPlatformImage(t *testing.T) { c, err := GenericContainer(ctx, GenericContainerRequest{ ProviderType: providerType, ContainerRequest: ContainerRequest{ - Image: "docker.io/mysql:5.7", + Image: "docker.io/mysql:8.0.36", ImagePlatform: "linux/amd64", }, Started: false, @@ -1285,10 +1288,10 @@ func TestContainerCustomPlatformImage(t *testing.T) { defer dockerCli.Close() ctr, err := dockerCli.ContainerInspect(ctx, c.GetContainerID()) - assert.NoError(t, err) + require.NoError(t, err) img, _, err := dockerCli.ImageInspectWithRaw(ctx, ctr.Image) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, "linux", img.Os) assert.Equal(t, "amd64", img.Architecture) }) @@ -1335,27 +1338,44 @@ func readHostname(tb testing.TB, containerId string) string { func TestDockerContainerCopyFileToContainer(t *testing.T) { ctx := context.Background() - nginxC, err := GenericContainer(ctx, GenericContainerRequest{ - ProviderType: providerType, - ContainerRequest: ContainerRequest{ - Image: nginxImage, - ExposedPorts: []string{nginxDefaultPort}, - WaitingFor: wait.ForListeningPort(nginxDefaultPort), + tests := []struct { + name string + copiedFileName string + }{ + { + name: "success copy", + copiedFileName: "/hello_copy.sh", }, - Started: true, - }) + { + name: "success copy with dir", + copiedFileName: "/test/hello_copy.sh", + }, + } - require.NoError(t, err) - terminateContainerOnEnd(t, ctx, nginxC) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + nginxC, err := GenericContainer(ctx, GenericContainerRequest{ + ProviderType: providerType, + ContainerRequest: ContainerRequest{ + Image: nginxImage, + ExposedPorts: []string{nginxDefaultPort}, + WaitingFor: wait.ForListeningPort(nginxDefaultPort), + }, + Started: true, + }) - copiedFileName := "hello_copy.sh" - _ = nginxC.CopyFileToContainer(ctx, filepath.Join(".", "testdata", "hello.sh"), "/"+copiedFileName, 700) - c, _, err := nginxC.Exec(ctx, []string{"bash", copiedFileName}) - if err != nil { - t.Fatal(err) - } - if c != 0 { - t.Fatalf("File %s should exist, expected return code 0, got %v", copiedFileName, c) + require.NoError(t, err) + terminateContainerOnEnd(t, ctx, nginxC) + + _ = nginxC.CopyFileToContainer(ctx, filepath.Join(".", "testdata", "hello.sh"), tc.copiedFileName, 700) + c, _, err := nginxC.Exec(ctx, []string{"bash", tc.copiedFileName}) + if err != nil { + t.Fatal(err) + } + if c != 0 { + t.Fatalf("File %s should exist, expected return code 0, got %v", tc.copiedFileName, c) + } + }) } } @@ -1461,7 +1481,7 @@ func TestDockerCreateContainerWithDirs(t *testing.T) { hostDirName := "testdata" abs, err := filepath.Abs(filepath.Join(".", hostDirName)) - assert.Nil(t, err) + require.NoError(t, err) tests := []struct { name string @@ -1532,32 +1552,51 @@ func TestDockerCreateContainerWithDirs(t *testing.T) { func TestDockerContainerCopyToContainer(t *testing.T) { ctx := context.Background() - nginxC, err := GenericContainer(ctx, GenericContainerRequest{ - ProviderType: providerType, - ContainerRequest: ContainerRequest{ - Image: nginxImage, - ExposedPorts: []string{nginxDefaultPort}, - WaitingFor: wait.ForListeningPort(nginxDefaultPort), + tests := []struct { + name string + copiedFileName string + }{ + { + name: "success copy", + copiedFileName: "hello_copy.sh", }, - Started: true, - }) + { + name: "success copy with dir", + copiedFileName: "/test/hello_copy.sh", + }, + } - require.NoError(t, err) - terminateContainerOnEnd(t, ctx, nginxC) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + nginxC, err := GenericContainer(ctx, GenericContainerRequest{ + ProviderType: providerType, + ContainerRequest: ContainerRequest{ + Image: nginxImage, + ExposedPorts: []string{nginxDefaultPort}, + WaitingFor: wait.ForListeningPort(nginxDefaultPort), + }, + Started: true, + }) - copiedFileName := "hello_copy.sh" + require.NoError(t, err) + terminateContainerOnEnd(t, ctx, nginxC) - fileContent, err := os.ReadFile(filepath.Join(".", "testdata", "hello.sh")) - if err != nil { - t.Fatal(err) - } - _ = nginxC.CopyToContainer(ctx, fileContent, "/"+copiedFileName, 700) - c, _, err := nginxC.Exec(ctx, []string{"bash", copiedFileName}) - if err != nil { - t.Fatal(err) - } - if c != 0 { - t.Fatalf("File %s should exist, expected return code 0, got %v", copiedFileName, c) + fileContent, err := os.ReadFile(filepath.Join(".", "testdata", "hello.sh")) + if err != nil { + t.Fatal(err) + } + err = nginxC.CopyToContainer(ctx, fileContent, tc.copiedFileName, 700) + if err != nil { + t.Fatal(err) + } + c, _, err := nginxC.Exec(ctx, []string{"bash", tc.copiedFileName}) + if err != nil { + t.Fatal(err) + } + if c != 0 { + t.Fatalf("File %s should exist, expected return code 0, got %v", tc.copiedFileName, c) + } + }) } } @@ -1962,7 +2001,7 @@ func TestDockerProviderFindContainerByName(t *testing.T) { terminateContainerOnEnd(t, ctx, c2) c, err := provider.findContainerByName(ctx, "test") - assert.NoError(t, err) + require.NoError(t, err) require.NotNil(t, c) assert.Contains(t, c.Names, c1Name) } @@ -2013,9 +2052,9 @@ func TestImageBuiltFromDockerfile_KeepBuiltImage(t *testing.T) { require.NoError(t, err, "terminate container should not fail") _, _, err = cli.ImageInspectWithRaw(ctx, containerImage) if tt.keepBuiltImage { - assert.Nil(t, err, "image should still exist") + require.NoError(t, err, "image should still exist") } else { - assert.NotNil(t, err, "image should not exist anymore") + require.Error(t, err, "image should not exist anymore") } }) } diff --git a/docs/features/build_from_dockerfile.md b/docs/features/build_from_dockerfile.md index dd2628dfc8..19ad060d2e 100644 --- a/docs/features/build_from_dockerfile.md +++ b/docs/features/build_from_dockerfile.md @@ -17,7 +17,7 @@ image will be built with a random name and tag. If your Dockerfile expects build args: ```Dockerfile -FROM alpine +FROM alpine@sha256:51b67269f354137895d43f3b3d810bfacd3945438e94dc5ac55fdac340352f48 ARG FOO diff --git a/docs/features/image_name_substitution.md b/docs/features/image_name_substitution.md index 59693d3fcb..08e9e1d6a0 100644 --- a/docs/features/image_name_substitution.md +++ b/docs/features/image_name_substitution.md @@ -26,7 +26,7 @@ Consider this if: * Developers and CI machines need to use different image names. For example, developers are able to pull images from Docker Hub, but CI machines need to pull from a private registry. * Your private registry has copies of images from Docker Hub where the names are predictable, and just adding a prefix is enough. - For example, `registry.mycompany.com/mirror/mysql:8.0.24` can be derived from the original Docker Hub image name (`mysql:8.0.24`) with a consistent prefix string: `registry.mycompany.com/mirror` + For example, `registry.mycompany.com/mirror/mysql:8.0.36` can be derived from the original Docker Hub image name (`mysql:8.0.36`) with a consistent prefix string: `registry.mycompany.com/mirror` In this case, image name references in code are **unchanged**. i.e. you would leave as-is: diff --git a/docs/features/wait/log.md b/docs/features/wait/log.md index 6aaeb1988c..66c418b284 100644 --- a/docs/features/wait/log.md +++ b/docs/features/wait/log.md @@ -10,7 +10,7 @@ The Log wait strategy will check if a string occurs in the container logs for a ```golang req := ContainerRequest{ - Image: "docker.io/mysql:8.0.30", + Image: "docker.io/mysql:8.0.36", ExposedPorts: []string{"3306/tcp", "33060/tcp"}, Env: map[string]string{ "MYSQL_ROOT_PASSWORD": "password", @@ -24,7 +24,7 @@ Using a regular expression: ```golang req := ContainerRequest{ - Image: "docker.io/mysql:8.0.30", + Image: "docker.io/mysql:8.0.36", ExposedPorts: []string{"3306/tcp", "33060/tcp"}, Env: map[string]string{ "MYSQL_ROOT_PASSWORD": "password", diff --git a/docs/features/wait/multi.md b/docs/features/wait/multi.md index 62a2e26894..bfd053955b 100644 --- a/docs/features/wait/multi.md +++ b/docs/features/wait/multi.md @@ -9,7 +9,7 @@ Available Options: ```golang req := ContainerRequest{ - Image: "docker.io/mysql:8.0.30", + Image: "docker.io/mysql:8.0.36", ExposedPorts: []string{"3306/tcp", "33060/tcp"}, Env: map[string]string{ "MYSQL_ROOT_PASSWORD": "password", diff --git a/docs/modules/mockserver.md b/docs/modules/mockserver.md new file mode 100644 index 0000000000..30c8520ecc --- /dev/null +++ b/docs/modules/mockserver.md @@ -0,0 +1,58 @@ +# MockServer + +Not available until the next release of testcontainers-go :material-tag: main + +## Introduction + +The Testcontainers module for MockServer. MockServer can be used to mock HTTP services by matching requests against user-defined expectations. + +## Adding this module to your project dependencies + +Please run the following command to add the MockServer module to your Go dependencies: + +``` +go get github.com/testcontainers/testcontainers-go/modules/mockserver +``` + +## Usage example + + +[Creating a MockServer container](../../modules/mockserver/examples_test.go) inside_block:runMockServerContainer + + +## Module reference + +The MockServer module exposes one entrypoint function to create the MockServer container, and this function receives two parameters: + +```golang +func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*MockServerContainer, error) +``` + +- `context.Context`, the Go context. +- `testcontainers.ContainerCustomizer`, a variadic argument for passing options. + +### Container Options + +When starting the MockServer container, you can pass options in a variadic way to configure it. + +#### Image + +If you need to set a different MockServer Docker image, you can use `testcontainers.WithImage` with a valid Docker image +for MockServer. E.g. `testcontainers.WithImage("mockserver/mockserver:5.15.0")`. + +{% include "../features/common_functional_options.md" %} + +### Container Methods + +The MockServer container exposes the following methods: + +#### URL + +The `URL` method returns the url string to connect to the MockServer container. +It returns a string with the format `http://:`. + +It can be use to configure a MockServer client (`github.com/BraspagDevelopers/mock-server-client`), e.g.: + + +[Using URL with the MockServer client](../../modules/mockserver/examples_test.go) inside_block:connectToMockServer + diff --git a/docs/modules/mysql.md b/docs/modules/mysql.md index fbbef2b7d9..5fbaa1bd49 100644 --- a/docs/modules/mysql.md +++ b/docs/modules/mysql.md @@ -42,7 +42,7 @@ When starting the MySQL container, you can pass options in a variadic way to con #### Image If you need to set a different MySQL Docker image, you can use `testcontainers.WithImage` with a valid Docker image -for MySQL. E.g. `testcontainers.WithImage("mysql:5.6")`. +for MySQL. E.g. `testcontainers.WithImage("mysql:8.0.36")`. By default, the container will use the following Docker image: diff --git a/docs/modules/redpanda.md b/docs/modules/redpanda.md index c7d8cd36d9..ad2223ce83 100644 --- a/docs/modules/redpanda.md +++ b/docs/modules/redpanda.md @@ -51,6 +51,26 @@ for Redpanda. E.g. `testcontainers.WithImage("docker.redpanda.com/redpandadata/r If you need to enable TLS use `WithTLS` with a valid PEM encoded certificate and key. +#### Additional Listener + +There are scenarios where additional listeners are needed, for example if you +want to consume/from another container in the same network + +You can use the `WithListener` option to add a listener to the Redpanda container. + +[Register additional listener](../../modules/redpanda/redpanda_test.go) inside_block:withListenerRP + + +Container defined in the same network + +[Start Kcat container](../../modules/redpanda/redpanda_test.go) inside_block:withListenerKcat + + +Produce messages using the new registered listener + +[Produce/consume via registered listener](../../modules/redpanda/redpanda_test.go) inside_block:withListenerExec + + ### Container Methods The Redpanda container exposes the following methods: diff --git a/examples/cockroachdb/cockroachdb_test.go b/examples/cockroachdb/cockroachdb_test.go index 38706d9737..50e9c1e0ad 100644 --- a/examples/cockroachdb/cockroachdb_test.go +++ b/examples/cockroachdb/cockroachdb_test.go @@ -8,6 +8,7 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) // Task represents a unit of work to complete. We're going to be using this in @@ -16,12 +17,12 @@ import ( type task struct { ID string `json:"id"` Description string `json:"description"` - DateDue *time.Time `json:"date_due,string"` - DateCreated time.Time `json:"date_created,string"` + DateDue *time.Time `json:"date_due"` + DateCreated time.Time `json:"date_created"` DateUpdated time.Time `json:"date_updated"` } -func initCockroachDB(ctx context.Context, db sql.DB) error { +func initCockroachDB(ctx context.Context, db *sql.DB) error { // Actual SQL for initializing the database should probably live elsewhere const query = `CREATE DATABASE projectmanagement; CREATE TABLE projectmanagement.task( @@ -31,11 +32,10 @@ func initCockroachDB(ctx context.Context, db sql.DB) error { date_created timestamp with time zone not null, date_updated timestamp with time zone not null);` _, err := db.ExecContext(ctx, query) - return err } -func truncateCockroachDB(ctx context.Context, db sql.DB) error { +func truncateCockroachDB(ctx context.Context, db *sql.DB) error { const query = `TRUNCATE projectmanagement.task` _, err := db.ExecContext(ctx, query) return err @@ -49,9 +49,7 @@ func TestIntegrationDBInsertSelect(t *testing.T) { ctx := context.Background() cdbContainer, err := startContainer(ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) t.Cleanup(func() { if err := cdbContainer.Terminate(ctx); err != nil { t.Fatalf("failed to terminate container: %s", err) @@ -59,16 +57,13 @@ func TestIntegrationDBInsertSelect(t *testing.T) { }) db, err := sql.Open("pgx", cdbContainer.URI+"/projectmanagement") - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) defer db.Close() - err = initCockroachDB(ctx, *db) - if err != nil { - t.Fatal(err) - } - defer truncateCockroachDB(ctx, *db) + require.NoError(t, initCockroachDB(ctx, db)) + defer func(t *testing.T, ctx context.Context, db *sql.DB) { + require.NoError(t, truncateCockroachDB(ctx, db)) + }(t, ctx, db) now := time.Now() @@ -84,9 +79,7 @@ func TestIntegrationDBInsertSelect(t *testing.T) { tsk.DateDue, tsk.DateCreated, tsk.DateUpdated) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) // Select data savedTsk := task{ID: tsk.ID} @@ -95,10 +88,7 @@ func TestIntegrationDBInsertSelect(t *testing.T) { where id = $1` row := db.QueryRowContext(ctx, findQuery, tsk.ID) err = row.Scan(&savedTsk.Description, &savedTsk.DateDue, &savedTsk.DateCreated, &savedTsk.DateUpdated) - if err != nil { - t.Fatal(err) - } - + require.NoError(t, err) assert.Equal(t, tsk.ID, savedTsk.ID) assert.Equal(t, tsk.Description, savedTsk.Description) assert.Equal(t, tsk.DateDue, savedTsk.DateDue) diff --git a/examples/cockroachdb/go.mod b/examples/cockroachdb/go.mod index 39ef4c9517..f3f0b94406 100644 --- a/examples/cockroachdb/go.mod +++ b/examples/cockroachdb/go.mod @@ -23,7 +23,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.7+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -58,8 +58,7 @@ require ( golang.org/x/crypto v0.17.0 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect diff --git a/examples/cockroachdb/go.sum b/examples/cockroachdb/go.sum index bff199cb9d..55d7c18a4c 100644 --- a/examples/cockroachdb/go.sum +++ b/examples/cockroachdb/go.sum @@ -38,8 +38,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -265,7 +265,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -299,8 +298,9 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= diff --git a/examples/consul/go.mod b/examples/consul/go.mod index e312ea03d1..30cd5ef6da 100644 --- a/examples/consul/go.mod +++ b/examples/consul/go.mod @@ -19,7 +19,7 @@ require ( github.com/cpuguy83/dockercfg v0.3.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.7+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/fatih/color v1.14.1 // indirect github.com/go-ole/go-ole v1.2.6 // indirect @@ -58,8 +58,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect golang.org/x/mod v0.12.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/examples/consul/go.sum b/examples/consul/go.sum index 4f1c604a67..ecb5722989 100644 --- a/examples/consul/go.sum +++ b/examples/consul/go.sum @@ -48,8 +48,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -284,7 +284,6 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -326,8 +325,9 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= diff --git a/examples/nginx/go.mod b/examples/nginx/go.mod index e0be5d5133..df77fcf717 100644 --- a/examples/nginx/go.mod +++ b/examples/nginx/go.mod @@ -17,7 +17,7 @@ require ( github.com/cpuguy83/dockercfg v0.3.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.7+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -43,8 +43,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/examples/nginx/go.sum b/examples/nginx/go.sum index 4b2eb8de73..50c11e3c1e 100644 --- a/examples/nginx/go.sum +++ b/examples/nginx/go.sum @@ -30,8 +30,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -136,7 +136,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -158,8 +157,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/examples/toxiproxy/go.mod b/examples/toxiproxy/go.mod index d282977074..8781a3a005 100644 --- a/examples/toxiproxy/go.mod +++ b/examples/toxiproxy/go.mod @@ -22,7 +22,7 @@ require ( github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.7+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -47,8 +47,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/examples/toxiproxy/go.sum b/examples/toxiproxy/go.sum index d392d850de..66ac76e5ef 100644 --- a/examples/toxiproxy/go.sum +++ b/examples/toxiproxy/go.sum @@ -36,8 +36,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -148,7 +148,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -170,8 +169,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/file.go b/file.go index 509da643d4..76844bd6d7 100644 --- a/file.go +++ b/file.go @@ -117,7 +117,7 @@ func tarFile(fileContent []byte, basePath string, fileMode int64) (*bytes.Buffer tw := tar.NewWriter(zr) hdr := &tar.Header{ - Name: filepath.Base(basePath), + Name: basePath, Mode: fileMode, Size: int64(len(fileContent)), } diff --git a/file_test.go b/file_test.go index 41c25d095f..367e4833bc 100644 --- a/file_test.go +++ b/file_test.go @@ -44,9 +44,9 @@ func Test_IsDir(t *testing.T) { t.Run(test.filepath, func(t *testing.T) { result, err := isDir(test.filepath) if test.err != nil { - assert.NotNil(t, err, "expected error") + require.Error(t, err, "expected error") } else { - assert.Nil(t, err, "not expected error") + require.NoError(t, err, "not expected error") } assert.Equal(t, test.expected, result) }) @@ -71,7 +71,7 @@ func Test_TarDir(t *testing.T) { src := originalSrc if test.abs { absSrc, err := filepath.Abs(src) - require.Nil(t, err) + require.NoError(t, err) src = absSrc } diff --git a/from_dockerfile_test.go b/from_dockerfile_test.go index 2418bb8efa..0e3a4ff10d 100644 --- a/from_dockerfile_test.go +++ b/from_dockerfile_test.go @@ -34,11 +34,11 @@ func TestBuildImageFromDockerfile(t *testing.T) { }, // } }) - assert.Nil(t, err) + require.NoError(t, err) assert.Equal(t, "test-repo:test-tag", tag) _, _, err = cli.ImageInspectWithRaw(ctx, tag) - assert.Nil(t, err) + require.NoError(t, err) t.Cleanup(func() { _, err := cli.ImageRemove(ctx, tag, types.ImageRemoveOptions{ @@ -69,11 +69,11 @@ func TestBuildImageFromDockerfile_NoRepo(t *testing.T) { Repo: "test-repo", }, }) - assert.Nil(t, err) + require.NoError(t, err) assert.True(t, strings.HasPrefix(tag, "test-repo:")) _, _, err = cli.ImageInspectWithRaw(ctx, tag) - assert.Nil(t, err) + require.NoError(t, err) t.Cleanup(func() { _, err := cli.ImageRemove(ctx, tag, types.ImageRemoveOptions{ @@ -104,11 +104,11 @@ func TestBuildImageFromDockerfile_NoTag(t *testing.T) { Tag: "test-tag", }, }) - assert.Nil(t, err) + require.NoError(t, err) assert.True(t, strings.HasSuffix(tag, ":test-tag")) _, _, err = cli.ImageInspectWithRaw(ctx, tag) - assert.Nil(t, err) + require.NoError(t, err) t.Cleanup(func() { _, err := cli.ImageRemove(ctx, tag, types.ImageRemoveOptions{ @@ -213,6 +213,4 @@ func TestBuildImageFromDockerfile_TargetDoesNotExist(t *testing.T) { Started: true, }) require.Error(t, err) - - assert.Contains(t, err.Error(), "failed to reach build target target-foo in Dockerfile") } diff --git a/go.mod b/go.mod index 70513c9561..9d69776dd7 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/containerd/containerd v1.7.11 github.com/cpuguy83/dockercfg v0.3.1 github.com/docker/docker v24.0.7+incompatible - github.com/docker/go-connections v0.4.0 + github.com/docker/go-connections v0.5.0 github.com/docker/go-units v0.5.0 github.com/google/uuid v1.5.0 github.com/magiconair/properties v1.8.7 @@ -18,7 +18,7 @@ require ( github.com/shirou/gopsutil/v3 v3.23.12 github.com/stretchr/testify v1.8.4 golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea - golang.org/x/sys v0.15.0 + golang.org/x/sys v0.16.0 ) require ( @@ -48,7 +48,6 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect diff --git a/go.sum b/go.sum index d782f30c54..76b17ae37c 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -146,7 +146,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -168,8 +167,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/internal/core/docker_host_test.go b/internal/core/docker_host_test.go index 485a38cc94..e5e3a94e83 100644 --- a/internal/core/docker_host_test.go +++ b/internal/core/docker_host_test.go @@ -146,7 +146,7 @@ func TestExtractDockerHost(t *testing.T) { setupTestcontainersProperties(t, content) socket, err := testcontainersHostFromProperties(context.Background()) - require.Nil(t, err) + require.NoError(t, err) assert.Equal(t, testRemoteHost, socket) }) @@ -165,10 +165,10 @@ func TestExtractDockerHost(t *testing.T) { tmpSocket := filepath.Join(tmpDir, "docker.sock") t.Setenv("DOCKER_HOST", tmpSocket) err := createTmpDockerSocket(tmpDir) - require.Nil(t, err) + require.NoError(t, err) socket, err := dockerHostFromEnv(context.Background()) - require.Nil(t, err) + require.NoError(t, err) assert.Equal(t, tmpSocket, socket) }) @@ -187,10 +187,10 @@ func TestExtractDockerHost(t *testing.T) { tmpSocket := filepath.Join(tmpDir, "docker.sock") t.Setenv("TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE", tmpSocket) err := createTmpDockerSocket(tmpDir) - require.Nil(t, err) + require.NoError(t, err) socket, err := dockerSocketOverridePath(context.Background()) - require.Nil(t, err) + require.NoError(t, err) assert.Equal(t, tmpSocket, socket) }) @@ -208,7 +208,7 @@ func TestExtractDockerHost(t *testing.T) { ctx := context.Background() socket, err := dockerHostFromContext(context.WithValue(ctx, DockerHostContextKey, DockerSocketSchema+"/this/is/a/sample.sock")) - require.Nil(t, err) + require.NoError(t, err) assert.Equal(t, "/this/is/a/sample.sock", socket) }) @@ -232,7 +232,7 @@ func TestExtractDockerHost(t *testing.T) { tmpSocket := setupDockerSocket(t) socket, err := dockerSocketPath(context.Background()) - require.Nil(t, err) + require.NoError(t, err) assert.Equal(t, tmpSocket, socket) }) @@ -243,7 +243,7 @@ func TestExtractDockerHost(t *testing.T) { setupTestcontainersProperties(t, content) socket, err := dockerHostFromProperties(context.Background()) - require.Nil(t, err) + require.NoError(t, err) assert.Equal(t, tmpSocket, socket) }) @@ -426,7 +426,7 @@ func TestInAContainer(t *testing.T) { f := filepath.Join(tmpDir, ".dockerenv-b") testFile, err := os.Create(f) - assert.NoError(t, err) + require.NoError(t, err) defer testFile.Close() assert.True(t, inAContainer(f)) @@ -472,7 +472,7 @@ func setupDockerSocket(t *testing.T) string { tmpDir := t.TempDir() tmpSocket := filepath.Join(tmpDir, "docker.sock") err := createTmpDockerSocket(filepath.Dir(tmpSocket)) - require.Nil(t, err) + require.NoError(t, err) DockerSocketPath = tmpSocket DockerSocketPathWithSchema = tmpSchema + tmpSocket @@ -503,7 +503,7 @@ func setupTestcontainersProperties(t *testing.T, content string) { tmpDir := t.TempDir() homeDir := filepath.Join(tmpDir, "home") err := createTmpDir(homeDir) - require.Nil(t, err) + require.NoError(t, err) t.Setenv("HOME", homeDir) t.Setenv("USERPROFILE", homeDir) // Windows support diff --git a/internal/core/docker_rootless_test.go b/internal/core/docker_rootless_test.go index 983643e833..ef018eda53 100644 --- a/internal/core/docker_rootless_test.go +++ b/internal/core/docker_rootless_test.go @@ -96,10 +96,10 @@ func TestRootlessDockerSocketPath(t *testing.T) { tmpDir := t.TempDir() t.Setenv("XDG_RUNTIME_DIR", tmpDir) err := createTmpDockerSocket(tmpDir) - require.Nil(t, err) + require.NoError(t, err) socketPath, err := rootlessDockerSocketPath(context.Background()) - require.Nil(t, err) + require.NoError(t, err) assert.NotEmpty(t, socketPath) }) @@ -114,11 +114,11 @@ func TestRootlessDockerSocketPath(t *testing.T) { runDir := filepath.Join(tmpDir, ".docker", "run") err := createTmpDockerSocket(runDir) - require.Nil(t, err) + require.NoError(t, err) t.Setenv("HOME", tmpDir) socketPath, err := rootlessDockerSocketPath(context.Background()) - require.Nil(t, err) + require.NoError(t, err) assert.Equal(t, DockerSocketSchema+runDir+"/docker.sock", socketPath) }) @@ -133,11 +133,11 @@ func TestRootlessDockerSocketPath(t *testing.T) { desktopDir := filepath.Join(tmpDir, ".docker", "desktop") err := createTmpDockerSocket(desktopDir) - require.Nil(t, err) + require.NoError(t, err) t.Setenv("HOME", tmpDir) socketPath, err := rootlessDockerSocketPath(context.Background()) - require.Nil(t, err) + require.NoError(t, err) assert.Equal(t, DockerSocketSchema+desktopDir+"/docker.sock", socketPath) }) @@ -151,7 +151,7 @@ func TestRootlessDockerSocketPath(t *testing.T) { homeDir := filepath.Join(tmpDir, "home") err := createTmpDir(homeDir) - require.Nil(t, err) + require.NoError(t, err) t.Setenv("HOME", homeDir) baseRunDir = tmpDir @@ -163,10 +163,10 @@ func TestRootlessDockerSocketPath(t *testing.T) { uid := os.Getuid() runDir := filepath.Join(tmpDir, "user", fmt.Sprintf("%d", uid)) err = createTmpDockerSocket(runDir) - require.Nil(t, err) + require.NoError(t, err) socketPath, err := rootlessDockerSocketPath(context.Background()) - require.Nil(t, err) + require.NoError(t, err) assert.Equal(t, DockerSocketSchema+runDir+"/docker.sock", socketPath) }) @@ -178,14 +178,14 @@ func TestRootlessDockerSocketPath(t *testing.T) { setupRootlessNotFound(t) socketPath, err := rootlessDockerSocketPath(context.Background()) - assert.ErrorIs(t, err, ErrRootlessDockerNotFound) + require.ErrorIs(t, err, ErrRootlessDockerNotFound) assert.Empty(t, socketPath) // the wrapped error includes all the locations that were checked - assert.ErrorContains(t, err, ErrRootlessDockerNotFoundXDGRuntimeDir.Error()) - assert.ErrorContains(t, err, ErrRootlessDockerNotFoundHomeRunDir.Error()) - assert.ErrorContains(t, err, ErrRootlessDockerNotFoundHomeDesktopDir.Error()) - assert.ErrorContains(t, err, ErrRootlessDockerNotFoundRunDir.Error()) + require.ErrorContains(t, err, ErrRootlessDockerNotFoundXDGRuntimeDir.Error()) + require.ErrorContains(t, err, ErrRootlessDockerNotFoundHomeRunDir.Error()) + require.ErrorContains(t, err, ErrRootlessDockerNotFoundHomeDesktopDir.Error()) + require.ErrorContains(t, err, ErrRootlessDockerNotFoundRunDir.Error()) }) } @@ -199,21 +199,21 @@ func setupRootlessNotFound(t *testing.T) { xdgRuntimeDir := filepath.Join(tmpDir, "xdg-runtime-dir") err := createTmpDir(xdgRuntimeDir) - require.Nil(t, err) + require.NoError(t, err) t.Setenv("XDG_RUNTIME_DIR", xdgRuntimeDir) homeDir := filepath.Join(tmpDir, "home") err = createTmpDir(homeDir) - require.Nil(t, err) + require.NoError(t, err) t.Setenv("HOME", homeDir) homeRunDir := filepath.Join(homeDir, ".docker", "run") err = createTmpDir(homeRunDir) - require.Nil(t, err) + require.NoError(t, err) baseRunDir = tmpDir uid := os.Getuid() runDir := filepath.Join(tmpDir, "run", "user", fmt.Sprintf("%d", uid)) err = createTmpDir(runDir) - require.Nil(t, err) + require.NoError(t, err) } diff --git a/lifecycle_test.go b/lifecycle_test.go index a1489dc83a..f3fe8e18d8 100644 --- a/lifecycle_test.go +++ b/lifecycle_test.go @@ -23,7 +23,7 @@ func TestPreCreateModifierHook(t *testing.T) { ctx := context.Background() provider, err := NewDockerProvider() - require.Nil(t, err) + require.NoError(t, err) defer provider.Close() t.Run("No exposed ports", func(t *testing.T) { @@ -71,7 +71,7 @@ func TestPreCreateModifierHook(t *testing.T) { inputNetworkingConfig := &network.NetworkingConfig{} err = provider.preCreateContainerHook(ctx, req, inputConfig, inputHostConfig, inputNetworkingConfig) - require.Nil(t, err) + require.NoError(t, err) // assertions @@ -151,7 +151,7 @@ func TestPreCreateModifierHook(t *testing.T) { inputNetworkingConfig := &network.NetworkingConfig{} err = provider.preCreateContainerHook(ctx, req, inputConfig, inputHostConfig, inputNetworkingConfig) - require.Nil(t, err) + require.NoError(t, err) // assertions @@ -192,7 +192,7 @@ func TestPreCreateModifierHook(t *testing.T) { inputNetworkingConfig := &network.NetworkingConfig{} err = provider.preCreateContainerHook(ctx, req, inputConfig, inputHostConfig, inputNetworkingConfig) - require.Nil(t, err) + require.NoError(t, err) // assertions @@ -209,7 +209,7 @@ func TestPreCreateModifierHook(t *testing.T) { net, err := provider.CreateNetwork(ctx, NetworkRequest{ Name: networkName, }) - require.Nil(t, err) + require.NoError(t, err) defer func() { err := net.Remove(ctx) if err != nil { @@ -220,7 +220,7 @@ func TestPreCreateModifierHook(t *testing.T) { dockerNetwork, err := provider.GetNetwork(ctx, NetworkRequest{ Name: networkName, }) - require.Nil(t, err) + require.NoError(t, err) req := ContainerRequest{ Image: nginxAlpineImage, // alpine image does expose port 80 @@ -238,7 +238,7 @@ func TestPreCreateModifierHook(t *testing.T) { inputNetworkingConfig := &network.NetworkingConfig{} err = provider.preCreateContainerHook(ctx, req, inputConfig, inputHostConfig, inputNetworkingConfig) - require.Nil(t, err) + require.NoError(t, err) // assertions @@ -261,7 +261,7 @@ func TestPreCreateModifierHook(t *testing.T) { net, err := provider.CreateNetwork(ctx, NetworkRequest{ Name: networkName, }) - require.Nil(t, err) + require.NoError(t, err) defer func() { err := net.Remove(ctx) if err != nil { @@ -272,7 +272,7 @@ func TestPreCreateModifierHook(t *testing.T) { dockerNetwork, err := provider.GetNetwork(ctx, NetworkRequest{ Name: networkName, }) - require.Nil(t, err) + require.NoError(t, err) req := ContainerRequest{ Image: nginxAlpineImage, // alpine image does expose port 80 @@ -287,7 +287,7 @@ func TestPreCreateModifierHook(t *testing.T) { inputNetworkingConfig := &network.NetworkingConfig{} err = provider.preCreateContainerHook(ctx, req, inputConfig, inputHostConfig, inputNetworkingConfig) - require.Nil(t, err) + require.NoError(t, err) // assertions @@ -328,11 +328,11 @@ func TestPreCreateModifierHook(t *testing.T) { inputNetworkingConfig := &network.NetworkingConfig{} err = provider.preCreateContainerHook(ctx, req, inputConfig, inputHostConfig, inputNetworkingConfig) - require.Nil(t, err) + require.NoError(t, err) // assertions - assert.Equal(t, inputHostConfig.PortBindings["80/tcp"][0].HostIP, "localhost") - assert.Equal(t, inputHostConfig.PortBindings["80/tcp"][0].HostPort, "8080") + assert.Equal(t, "localhost", inputHostConfig.PortBindings["80/tcp"][0].HostIP) + assert.Equal(t, "8080", inputHostConfig.PortBindings["80/tcp"][0].HostPort) }) } @@ -553,18 +553,18 @@ func TestLifecycleHooks(t *testing.T) { Reuse: tt.reuse, Started: true, }) - require.Nil(t, err) + require.NoError(t, err) require.NotNil(t, c) duration := 1 * time.Second err = c.Stop(ctx, &duration) - require.Nil(t, err) + require.NoError(t, err) err = c.Start(ctx) - require.Nil(t, err) + require.NoError(t, err) err = c.Terminate(ctx) - require.Nil(t, err) + require.NoError(t, err) lifecycleHooksIsHonouredFn(t, ctx, prints) }) @@ -600,18 +600,18 @@ func TestLifecycleHooks_WithDefaultLogger(t *testing.T) { ContainerRequest: req, Started: true, }) - require.Nil(t, err) + require.NoError(t, err) require.NotNil(t, c) duration := 1 * time.Second err = c.Stop(ctx, &duration) - require.Nil(t, err) + require.NoError(t, err) err = c.Start(ctx) - require.Nil(t, err) + require.NoError(t, err) err = c.Terminate(ctx) - require.Nil(t, err) + require.NoError(t, err) require.Equal(t, 12, len(dl.data)) } @@ -766,18 +766,18 @@ func TestLifecycleHooks_WithMultipleHooks(t *testing.T) { ContainerRequest: req, Started: true, }) - require.Nil(t, err) + require.NoError(t, err) require.NotNil(t, c) duration := 1 * time.Second err = c.Stop(ctx, &duration) - require.Nil(t, err) + require.NoError(t, err) err = c.Start(ctx) - require.Nil(t, err) + require.NoError(t, err) err = c.Terminate(ctx) - require.Nil(t, err) + require.NoError(t, err) require.Equal(t, 24, len(dl.data)) } diff --git a/logconsumer_test.go b/logconsumer_test.go index 3c0bef4a6c..8dc067da07 100644 --- a/logconsumer_test.go +++ b/logconsumer_test.go @@ -99,7 +99,7 @@ func Test_LogConsumerGetsCalled(t *testing.T) { case <-time.After(5 * time.Second): t.Fatal("never received final log message") } - assert.Nil(t, c.StopLogProducer()) + require.NoError(t, c.StopLogProducer()) assert.Equal(t, []string{"ready\n", "echo hello\n", "echo there\n"}, g.Msgs) terminateContainerOnEnd(t, ctx, c) @@ -162,7 +162,7 @@ func Test_ShouldRecognizeLogTypes(t *testing.T) { require.NoError(t, err) <-g.Ack - assert.Nil(t, c.StopLogProducer()) + require.NoError(t, c.StopLogProducer()) assert.Equal(t, map[string]string{ StdoutLog: "echo this-is-stdout\n", @@ -217,11 +217,11 @@ func Test_MultipleLogConsumers(t *testing.T) { <-first.Done <-second.Done - assert.Nil(t, c.StopLogProducer()) + require.NoError(t, c.StopLogProducer()) assert.Equal(t, []string{"ready\n", "echo mlem\n"}, first.Msgs) assert.Equal(t, []string{"ready\n", "echo mlem\n"}, second.Msgs) - assert.Nil(t, c.Terminate(ctx)) + require.NoError(t, c.Terminate(ctx)) } func Test_StartStop(t *testing.T) { @@ -256,23 +256,23 @@ func Test_StartStop(t *testing.T) { require.NoError(t, c.StopLogProducer(), "nothing should happen even if the producer is not started") require.NoError(t, c.StartLogProducer(ctx)) - require.Equal(t, <-g.Accepted, "ready\n") + require.Equal(t, "ready\n", <-g.Accepted) require.Error(t, c.StartLogProducer(ctx), "log producer is already started") _, err = http.Get(ep + "/stdout?echo=mlem") require.NoError(t, err) - require.Equal(t, <-g.Accepted, "echo mlem\n") + require.Equal(t, "echo mlem\n", <-g.Accepted) require.NoError(t, c.StopLogProducer()) require.NoError(t, c.StartLogProducer(ctx)) - require.Equal(t, <-g.Accepted, "ready\n") - require.Equal(t, <-g.Accepted, "echo mlem\n") + require.Equal(t, "ready\n", <-g.Accepted) + require.Equal(t, "echo mlem\n", <-g.Accepted) _, err = http.Get(ep + "/stdout?echo=mlem2") require.NoError(t, err) - require.Equal(t, <-g.Accepted, "echo mlem2\n") + require.Equal(t, "echo mlem2\n", <-g.Accepted) _, err = http.Get(ep + "/stdout?echo=" + lastMessage) require.NoError(t, err) @@ -287,7 +287,7 @@ func Test_StartStop(t *testing.T) { "echo mlem\n", "echo mlem2\n", }, g.Msgs) - assert.Nil(t, c.Terminate(ctx)) + require.NoError(t, c.Terminate(ctx)) } func TestContainerLogWithErrClosed(t *testing.T) { diff --git a/mkdocs.yml b/mkdocs.yml index 9ae1d2c553..6a52e22cab 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -74,6 +74,7 @@ nav: - modules/kafka.md - modules/localstack.md - modules/mariadb.md + - modules/mockserver.md - modules/mongodb.md - modules/mssql.md - modules/mysql.md diff --git a/modulegen/_template/ci.yml.tmpl b/modulegen/_template/ci.yml.tmpl index dacf6bb49a..9cbe9b0a6e 100644 --- a/modulegen/_template/ci.yml.tmpl +++ b/modulegen/_template/ci.yml.tmpl @@ -41,12 +41,11 @@ jobs: ryuk-disabled: false # The job below is a copy of the job above, but with ryuk disabled. - # It's executed in a secondary stage to avoid concurrency issues. + # It's executed in the first stage to avoid concurrency issues. test-reaper-off: # do not run this job if it's a PR from dependabot that is not approved yet if: {{ "${{ !(github.event_name == 'pull_request' && github.event.pull_request.state != 'approved' && github.triggering_actor == 'dependabot[bot]') }}" }} name: "Test with reaper off" - needs: test strategy: matrix: go-version: [1.20.x, 1.x] @@ -61,12 +60,11 @@ jobs: ryuk-disabled: true # The job below is a copy of the job above, but with Docker rootless. - # It's executed in a secondary stage to avoid concurrency issues. + # It's executed in the first stage to avoid concurrency issues. test-rootless-docker: # do not run this job if it's a PR from dependabot that is not approved yet if: {{ "${{ !(github.event_name == 'pull_request' && github.event.pull_request.state != 'approved' && github.triggering_actor == 'dependabot[bot]') }}" }} name: "Test with Rootless Docker" - needs: test strategy: matrix: go-version: [1.20.x, 1.x] @@ -138,22 +136,25 @@ jobs: ryuk-disabled: false sonarcloud: + permissions: + contents: read # for actions/checkout to fetch code + pull-requests: read # for sonarsource/sonarcloud-github-action to determine which PR to decorate if: {{ "${{ github.ref_name == 'main' && github.repository_owner == 'testcontainers' }}" }} needs: test-examples runs-on: ubuntu-latest steps: - name: Check out code into the Go module directory - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: # Disabling shallow clone is recommended for improving relevancy of reporting fetch-depth: 0 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 with: name: sonarcloud - name: Analyze with SonarCloud - uses: sonarsource/sonarcloud-github-action@master + uses: sonarsource/sonarcloud-github-action@49e6cd3b187936a73b8280d59ffd9da69df63ec9 # v2.1.1 env: GITHUB_TOKEN: {{ "${{ secrets.GITHUB_TOKEN }}" }} SONAR_TOKEN: {{ "${{ secrets.SONAR_TOKEN }}" }} diff --git a/modulegen/context_test.go b/modulegen/context_test.go index e9d03f19ce..08458171ce 100644 --- a/modulegen/context_test.go +++ b/modulegen/context_test.go @@ -53,7 +53,7 @@ func TestExamplesHasDependabotEntry(t *testing.T) { for _, exampleUpdate := range exampleUpdates { dependabotDir := "/examples/" + example - assert.Equal(t, exampleUpdate.Schedule.Interval, "monthly") + assert.Equal(t, "monthly", exampleUpdate.Schedule.Interval) if dependabotDir == exampleUpdate.Directory { found = true @@ -86,7 +86,7 @@ func TestModulesHasDependabotEntry(t *testing.T) { for _, moduleUpdate := range moduleUpdates { dependabotDir := "/modules/" + module - assert.Equal(t, moduleUpdate.Schedule.Interval, "monthly") + assert.Equal(t, "monthly", moduleUpdate.Schedule.Interval) if dependabotDir == moduleUpdate.Directory { found = true diff --git a/modulegen/internal/main.go b/modulegen/internal/main.go index df2916a86d..6832c66c42 100644 --- a/modulegen/internal/main.go +++ b/modulegen/internal/main.go @@ -34,17 +34,22 @@ func Generate(moduleVar context.TestcontainersModuleVar, isModule bool) error { } cmdDir := filepath.Join(ctx.RootDir, tcModule.ParentDir(), tcModule.Lower()) - err = tools.GoModTidy(cmdDir) - if err != nil { - return fmt.Errorf(">> error synchronizing the dependencies: %w", err) + lintCmds := []func(string) error{ + tools.GoModTidy, + tools.GoVet, + tools.MakeLint, } - err = tools.GoVet(cmdDir) - if err != nil { - return fmt.Errorf(">> error checking generated code: %w", err) + + for _, lintCmd := range lintCmds { + err = lintCmd(cmdDir) + if err != nil { + return err + } } - fmt.Println("Please go to", cmdDir, "directory to check the results, where 'go mod tidy' and 'go vet' was executed to synchronize the dependencies") - fmt.Println("Commit the modified files and submit a pull request to include them into the project") + fmt.Println("Please go to", cmdDir, "directory to check the results, where 'go mod tidy', 'go vet' and 'make lint' were executed.") + fmt.Println("🙏 Commit the modified files and submit a pull request to include them into the project.") + fmt.Println("Remember to run 'make lint' before submitting the pull request.") fmt.Println("Thanks!") return nil } diff --git a/modulegen/internal/tools/exec.go b/modulegen/internal/tools/exec.go index 5d5136ddaa..726c2daccb 100644 --- a/modulegen/internal/tools/exec.go +++ b/modulegen/internal/tools/exec.go @@ -1,15 +1,29 @@ package tools import ( + "fmt" "os/exec" ) func GoModTidy(cmdDir string) error { - return runGoCommand(cmdDir, "mod", "tidy") + if err := runGoCommand(cmdDir, "mod", "tidy"); err != nil { + return fmt.Errorf(">> error synchronizing the dependencies: %w", err) + } + return nil } func GoVet(cmdDir string) error { - return runGoCommand(cmdDir, "vet", "./...") + if err := runGoCommand(cmdDir, "vet", "./..."); err != nil { + return fmt.Errorf(">> error checking generated code: %w", err) + } + return nil +} + +func MakeLint(cmdDir string) error { + if err := runMakeCommand(cmdDir, "lint"); err != nil { + return fmt.Errorf(">> error synchronizing the dependencies: %w", err) + } + return nil } func runGoCommand(cmdDir string, args ...string) error { @@ -17,3 +31,9 @@ func runGoCommand(cmdDir string, args ...string) error { cmd.Dir = cmdDir return cmd.Run() } + +func runMakeCommand(cmdDir string, args ...string) error { + cmd := exec.Command("make", args...) + cmd.Dir = cmdDir + return cmd.Run() +} diff --git a/modulegen/main_test.go b/modulegen/main_test.go index 8c0f45dd3f..f861a8d3ac 100644 --- a/modulegen/main_test.go +++ b/modulegen/main_test.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/testcontainers/testcontainers-go/modulegen/internal" "github.com/testcontainers/testcontainers-go/modulegen/internal/context" @@ -160,14 +161,14 @@ func TestGenerateWrongModuleName(t *testing.T) { githubWorkflowsTmp := tmpCtx.GithubWorkflowsDir() err := os.MkdirAll(examplesTmp, 0o777) - assert.Nil(t, err) + require.NoError(t, err) err = os.MkdirAll(examplesDocTmp, 0o777) - assert.Nil(t, err) + require.NoError(t, err) err = os.MkdirAll(githubWorkflowsTmp, 0o777) - assert.Nil(t, err) + require.NoError(t, err) err = copyInitialMkdocsConfig(t, tmpCtx) - assert.Nil(t, err) + require.NoError(t, err) tests := []struct { name string @@ -191,7 +192,7 @@ func TestGenerateWrongModuleName(t *testing.T) { } err = internal.GenerateFiles(tmpCtx, module) - assert.Error(t, err) + require.Error(t, err) } } @@ -202,14 +203,14 @@ func TestGenerateWrongModuleTitle(t *testing.T) { githubWorkflowsTmp := tmpCtx.GithubWorkflowsDir() err := os.MkdirAll(examplesTmp, 0o777) - assert.Nil(t, err) + require.NoError(t, err) err = os.MkdirAll(examplesDocTmp, 0o777) - assert.Nil(t, err) + require.NoError(t, err) err = os.MkdirAll(githubWorkflowsTmp, 0o777) - assert.Nil(t, err) + require.NoError(t, err) err = copyInitialMkdocsConfig(t, tmpCtx) - assert.Nil(t, err) + require.NoError(t, err) tests := []struct { title string @@ -234,7 +235,7 @@ func TestGenerateWrongModuleTitle(t *testing.T) { } err = internal.GenerateFiles(tmpCtx, module) - assert.Error(t, err) + require.Error(t, err) } } @@ -245,23 +246,23 @@ func TestGenerate(t *testing.T) { githubWorkflowsTmp := tmpCtx.GithubWorkflowsDir() err := os.MkdirAll(examplesTmp, 0o777) - assert.Nil(t, err) + require.NoError(t, err) err = os.MkdirAll(examplesDocTmp, 0o777) - assert.Nil(t, err) + require.NoError(t, err) err = os.MkdirAll(githubWorkflowsTmp, 0o777) - assert.Nil(t, err) + require.NoError(t, err) err = copyInitialMkdocsConfig(t, tmpCtx) - assert.Nil(t, err) + require.NoError(t, err) originalConfig, err := mkdocs.ReadConfig(tmpCtx.MkdocsConfigFile()) - assert.Nil(t, err) + require.NoError(t, err) err = copyInitialDependabotConfig(t, tmpCtx) - assert.Nil(t, err) + require.NoError(t, err) originalDependabotConfigUpdates, err := dependabot.GetUpdates(tmpCtx.DependabotConfigFile()) - assert.Nil(t, err) + require.NoError(t, err) module := context.TestcontainersModule{ Name: "foodb4tw", @@ -272,21 +273,21 @@ func TestGenerate(t *testing.T) { moduleNameLower := module.Lower() err = internal.GenerateFiles(tmpCtx, module) - assert.Nil(t, err) + require.NoError(t, err) moduleDirPath := filepath.Join(examplesTmp, moduleNameLower) moduleDirFileInfo, err := os.Stat(moduleDirPath) - assert.Nil(t, err) // error nil implies the file exist + require.NoError(t, err) // error nil implies the file exist assert.True(t, moduleDirFileInfo.IsDir()) moduleDocFile := filepath.Join(examplesDocTmp, moduleNameLower+".md") _, err = os.Stat(moduleDocFile) - assert.Nil(t, err) // error nil implies the file exist + require.NoError(t, err) // error nil implies the file exist mainWorkflowFile := filepath.Join(githubWorkflowsTmp, "ci.yml") _, err = os.Stat(mainWorkflowFile) - assert.Nil(t, err) // error nil implies the file exist + require.NoError(t, err) // error nil implies the file exist assertModuleDocContent(t, module, moduleDocFile) assertModuleGithubWorkflowContent(t, module, mainWorkflowFile) @@ -308,23 +309,23 @@ func TestGenerateModule(t *testing.T) { githubWorkflowsTmp := tmpCtx.GithubWorkflowsDir() err := os.MkdirAll(modulesTmp, 0o777) - assert.Nil(t, err) + require.NoError(t, err) err = os.MkdirAll(modulesDocTmp, 0o777) - assert.Nil(t, err) + require.NoError(t, err) err = os.MkdirAll(githubWorkflowsTmp, 0o777) - assert.Nil(t, err) + require.NoError(t, err) err = copyInitialMkdocsConfig(t, tmpCtx) - assert.Nil(t, err) + require.NoError(t, err) originalConfig, err := mkdocs.ReadConfig(tmpCtx.MkdocsConfigFile()) - assert.Nil(t, err) + require.NoError(t, err) err = copyInitialDependabotConfig(t, tmpCtx) - assert.Nil(t, err) + require.NoError(t, err) originalDependabotConfigUpdates, err := dependabot.GetUpdates(tmpCtx.DependabotConfigFile()) - assert.Nil(t, err) + require.NoError(t, err) module := context.TestcontainersModule{ Name: "foodb", @@ -335,21 +336,21 @@ func TestGenerateModule(t *testing.T) { moduleNameLower := module.Lower() err = internal.GenerateFiles(tmpCtx, module) - assert.Nil(t, err) + require.NoError(t, err) moduleDirPath := filepath.Join(modulesTmp, moduleNameLower) moduleDirFileInfo, err := os.Stat(moduleDirPath) - assert.Nil(t, err) // error nil implies the file exist + require.NoError(t, err) // error nil implies the file exist assert.True(t, moduleDirFileInfo.IsDir()) moduleDocFile := filepath.Join(modulesDocTmp, moduleNameLower+".md") _, err = os.Stat(moduleDocFile) - assert.Nil(t, err) // error nil implies the file exist + require.NoError(t, err) // error nil implies the file exist mainWorkflowFile := filepath.Join(githubWorkflowsTmp, "ci.yml") _, err = os.Stat(mainWorkflowFile) - assert.Nil(t, err) // error nil implies the file exist + require.NoError(t, err) // error nil implies the file exist assertModuleDocContent(t, module, moduleDocFile) assertModuleGithubWorkflowContent(t, module, mainWorkflowFile) @@ -367,9 +368,9 @@ func TestGenerateModule(t *testing.T) { // assert content in the Dependabot descriptor file func assertDependabotUpdates(t *testing.T, module context.TestcontainersModule, originalConfigUpdates dependabot.Updates, tmpCtx context.Context) { modules, err := dependabot.GetUpdates(tmpCtx.DependabotConfigFile()) - assert.Nil(t, err) + require.NoError(t, err) - assert.Equal(t, len(originalConfigUpdates)+1, len(modules)) + assert.Len(t, modules, len(originalConfigUpdates)+1) // the module should be in the dependabot updates found := false @@ -398,22 +399,22 @@ func assertDependabotUpdates(t *testing.T, module context.TestcontainersModule, // assert content module file in the docs func assertModuleDocContent(t *testing.T, module context.TestcontainersModule, moduleDocFile string) { content, err := os.ReadFile(moduleDocFile) - assert.Nil(t, err) + require.NoError(t, err) lower := module.Lower() title := module.Title() data := sanitiseContent(content) assert.Equal(t, data[0], "# "+title) - assert.Equal(t, data[2], `Not available until the next release of testcontainers-go :material-tag: main`) - assert.Equal(t, data[4], "## Introduction") + assert.Equal(t, `Not available until the next release of testcontainers-go :material-tag: main`, data[2]) + assert.Equal(t, "## Introduction", data[4]) assert.Equal(t, data[6], "The Testcontainers module for "+title+".") - assert.Equal(t, data[8], "## Adding this module to your project dependencies") + assert.Equal(t, "## Adding this module to your project dependencies", data[8]) assert.Equal(t, data[10], "Please run the following command to add the "+title+" module to your Go dependencies:") assert.Equal(t, data[13], "go get github.com/testcontainers/testcontainers-go/"+module.ParentDir()+"/"+lower) - assert.Equal(t, data[18], "") + assert.Equal(t, "", data[18]) assert.Equal(t, data[19], "[Creating a "+title+" container](../../"+module.ParentDir()+"/"+lower+"/examples_test.go) inside_block:run"+title+"Container") - assert.Equal(t, data[20], "") + assert.Equal(t, "", data[20]) assert.Equal(t, data[24], "The "+title+" module exposes one entrypoint function to create the "+title+" container, and this function receives two parameters:") assert.True(t, strings.HasSuffix(data[27], "(*"+title+"Container, error)")) assert.Equal(t, "for "+title+". E.g. `testcontainers.WithImage(\""+module.Image+"\")`.", data[40]) @@ -422,7 +423,7 @@ func assertModuleDocContent(t *testing.T, module context.TestcontainersModule, m // assert content module test func assertExamplesTestContent(t *testing.T, module context.TestcontainersModule, examplesTestFile string) { content, err := os.ReadFile(examplesTestFile) - assert.Nil(t, err) + require.NoError(t, err) lower := module.Lower() entrypoint := module.Entrypoint() @@ -430,20 +431,20 @@ func assertExamplesTestContent(t *testing.T, module context.TestcontainersModule data := sanitiseContent(content) assert.Equal(t, data[0], "package "+lower+"_test") - assert.Equal(t, data[6], "\t\"github.com/testcontainers/testcontainers-go\"") + assert.Equal(t, "\t\"github.com/testcontainers/testcontainers-go\"", data[6]) assert.Equal(t, data[7], "\t\"github.com/testcontainers/testcontainers-go/modules/"+lower+"\"") assert.Equal(t, data[10], "func Example"+entrypoint+"() {") assert.Equal(t, data[11], "\t// run"+title+"Container {") assert.Equal(t, data[14], "\t"+lower+"Container, err := "+lower+"."+entrypoint+"(ctx, testcontainers.WithImage(\""+module.Image+"\"))") - assert.Equal(t, data[32], "\tfmt.Println(state.Running)") - assert.Equal(t, data[34], "\t// Output:") - assert.Equal(t, data[35], "\t// true") + assert.Equal(t, "\tfmt.Println(state.Running)", data[32]) + assert.Equal(t, "\t// Output:", data[34]) + assert.Equal(t, "\t// true", data[35]) } // assert content module test func assertModuleTestContent(t *testing.T, module context.TestcontainersModule, exampleTestFile string) { content, err := os.ReadFile(exampleTestFile) - assert.Nil(t, err) + require.NoError(t, err) data := sanitiseContent(content) assert.Equal(t, data[0], "package "+module.Lower()) @@ -454,7 +455,7 @@ func assertModuleTestContent(t *testing.T, module context.TestcontainersModule, // assert content module func assertModuleContent(t *testing.T, module context.TestcontainersModule, exampleFile string) { content, err := os.ReadFile(exampleFile) - assert.Nil(t, err) + require.NoError(t, err) lower := module.Lower() containerName := module.ContainerName() @@ -474,24 +475,24 @@ func assertModuleContent(t *testing.T, module context.TestcontainersModule, exam // assert content GitHub workflow for the module func assertModuleGithubWorkflowContent(t *testing.T, module context.TestcontainersModule, moduleWorkflowFile string) { content, err := os.ReadFile(moduleWorkflowFile) - assert.Nil(t, err) + require.NoError(t, err) data := sanitiseContent(content) ctx := getTestRootContext(t) modulesList, err := ctx.GetModules() - assert.Nil(t, err) - assert.Equal(t, " module: ["+strings.Join(modulesList, ", ")+"]", data[108]) + require.NoError(t, err) + assert.Equal(t, " module: ["+strings.Join(modulesList, ", ")+"]", data[106]) examplesList, err := ctx.GetExamples() - assert.Nil(t, err) - assert.Equal(t, " module: ["+strings.Join(examplesList, ", ")+"]", data[128]) + require.NoError(t, err) + assert.Equal(t, " module: ["+strings.Join(examplesList, ", ")+"]", data[126]) } // assert content go.mod func assertGoModContent(t *testing.T, module context.TestcontainersModule, tcVersion string, goModFile string) { content, err := os.ReadFile(goModFile) - assert.Nil(t, err) + require.NoError(t, err) data := sanitiseContent(content) assert.Equal(t, "module github.com/testcontainers/testcontainers-go/"+module.ParentDir()+"/"+module.Lower(), data[0]) @@ -502,7 +503,7 @@ func assertGoModContent(t *testing.T, module context.TestcontainersModule, tcVer // assert content Makefile func assertMakefileContent(t *testing.T, module context.TestcontainersModule, makefile string) { content, err := os.ReadFile(makefile) - assert.Nil(t, err) + require.NoError(t, err) data := sanitiseContent(content) assert.Equal(t, data[4], "\t$(MAKE) test-"+module.Lower()) @@ -511,7 +512,7 @@ func assertMakefileContent(t *testing.T, module context.TestcontainersModule, ma // assert content in the nav items from mkdocs.yml func assertMkdocsNavItems(t *testing.T, module context.TestcontainersModule, originalConfig *mkdocs.Config, tmpCtx context.Context) { config, err := mkdocs.ReadConfig(tmpCtx.MkdocsConfigFile()) - assert.Nil(t, err) + require.NoError(t, err) parentDir := module.ParentDir() @@ -522,7 +523,7 @@ func assertMkdocsNavItems(t *testing.T, module context.TestcontainersModule, ori expectedEntries = originalConfig.Nav[3].Modules } - assert.Equal(t, len(expectedEntries)+1, len(navItems)) + assert.Len(t, navItems, len(expectedEntries)+1) // the module should be in the nav found := false diff --git a/modulegen/mkdocs_test.go b/modulegen/mkdocs_test.go index 358a0ce96f..5fcf7c93ba 100644 --- a/modulegen/mkdocs_test.go +++ b/modulegen/mkdocs_test.go @@ -51,9 +51,9 @@ func TestReadMkDocsConfig(t *testing.T) { // nav bar nav := config.Nav assert.Equal(t, "index.md", nav[0].Home) - assert.Greater(t, len(nav[2].Features), 0) - assert.Greater(t, len(nav[3].Modules), 0) - assert.Greater(t, len(nav[4].Examples), 0) + assert.NotEmpty(t, nav[2].Features) + assert.NotEmpty(t, nav[3].Modules) + assert.NotEmpty(t, nav[4].Examples) } func TestNavItems(t *testing.T) { @@ -64,7 +64,7 @@ func TestNavItems(t *testing.T) { require.NoError(t, err) // we have to remove the index.md file from the examples docs - assert.Equal(t, len(examplesDocs)-1, len(examples)) + assert.Len(t, examples, len(examplesDocs)-1) // all example modules exist in the documentation for _, example := range examples { diff --git a/modules/artemis/go.mod b/modules/artemis/go.mod index 07397458c2..4ef173309c 100644 --- a/modules/artemis/go.mod +++ b/modules/artemis/go.mod @@ -3,7 +3,7 @@ module github.com/testcontainers/testcontainers-go/modules/artemis go 1.20 require ( - github.com/docker/go-connections v0.4.0 + github.com/docker/go-connections v0.5.0 github.com/go-stomp/stomp/v3 v3.0.5 github.com/stretchr/testify v1.8.4 github.com/testcontainers/testcontainers-go v0.27.0 @@ -47,8 +47,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/artemis/go.sum b/modules/artemis/go.sum index f3f18edda9..3a9a2b4e88 100644 --- a/modules/artemis/go.sum +++ b/modules/artemis/go.sum @@ -30,8 +30,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -146,7 +146,6 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -171,8 +170,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/cassandra/cassandra_test.go b/modules/cassandra/cassandra_test.go index 621692c482..11e47ccb55 100644 --- a/modules/cassandra/cassandra_test.go +++ b/modules/cassandra/cassandra_test.go @@ -7,6 +7,7 @@ import ( "github.com/gocql/gocql" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) type Test struct { @@ -24,13 +25,13 @@ func TestCassandra(t *testing.T) { // Clean up the container after the test is complete t.Cleanup(func() { - assert.NoError(t, container.Terminate(ctx)) + require.NoError(t, container.Terminate(ctx)) }) // connectionString { connectionHost, err := container.ConnectionHost(ctx) // } - assert.NoError(t, err) + require.NoError(t, err) cluster := gocql.NewCluster(connectionHost) session, err := cluster.CreateSession() @@ -41,16 +42,16 @@ func TestCassandra(t *testing.T) { // perform assertions err = session.Query("CREATE KEYSPACE test_keyspace WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 1}").Exec() - assert.NoError(t, err) + require.NoError(t, err) err = session.Query("CREATE TABLE test_keyspace.test_table (id int PRIMARY KEY, name text)").Exec() - assert.NoError(t, err) + require.NoError(t, err) err = session.Query("INSERT INTO test_keyspace.test_table (id, name) VALUES (1, 'NAME')").Exec() - assert.NoError(t, err) + require.NoError(t, err) var test Test err = session.Query("SELECT id, name FROM test_keyspace.test_table WHERE id=1").Scan(&test.Id, &test.Name) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, Test{Id: 1, Name: "NAME"}, test) } @@ -64,11 +65,11 @@ func TestCassandraWithConfigFile(t *testing.T) { // Clean up the container after the test is complete t.Cleanup(func() { - assert.NoError(t, container.Terminate(ctx)) + require.NoError(t, container.Terminate(ctx)) }) connectionHost, err := container.ConnectionHost(ctx) - assert.NoError(t, err) + require.NoError(t, err) cluster := gocql.NewCluster(connectionHost) session, err := cluster.CreateSession() @@ -79,7 +80,7 @@ func TestCassandraWithConfigFile(t *testing.T) { var result string err = session.Query("SELECT cluster_name FROM system.local").Scan(&result) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, "My Cluster", result) } @@ -96,13 +97,13 @@ func TestCassandraWithInitScripts(t *testing.T) { // Clean up the container after the test is complete t.Cleanup(func() { - assert.NoError(t, container.Terminate(ctx)) + require.NoError(t, container.Terminate(ctx)) }) // connectionHost { connectionHost, err := container.ConnectionHost(ctx) // } - assert.NoError(t, err) + require.NoError(t, err) cluster := gocql.NewCluster(connectionHost) session, err := cluster.CreateSession() @@ -113,7 +114,7 @@ func TestCassandraWithInitScripts(t *testing.T) { var test Test err = session.Query("SELECT id, name FROM test_keyspace.test_table WHERE id=1").Scan(&test.Id, &test.Name) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, Test{Id: 1, Name: "NAME"}, test) }) @@ -127,11 +128,11 @@ func TestCassandraWithInitScripts(t *testing.T) { // Clean up the container after the test is complete t.Cleanup(func() { - assert.NoError(t, container.Terminate(ctx)) + require.NoError(t, container.Terminate(ctx)) }) connectionHost, err := container.ConnectionHost(ctx) - assert.NoError(t, err) + require.NoError(t, err) cluster := gocql.NewCluster(connectionHost) session, err := cluster.CreateSession() @@ -142,7 +143,7 @@ func TestCassandraWithInitScripts(t *testing.T) { var test Test err = session.Query("SELECT id, name FROM init_sh_keyspace.test_table WHERE id=1").Scan(&test.Id, &test.Name) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, Test{Id: 1, Name: "NAME"}, test) }) } diff --git a/modules/cassandra/go.mod b/modules/cassandra/go.mod index 431727b356..73c70737a0 100644 --- a/modules/cassandra/go.mod +++ b/modules/cassandra/go.mod @@ -3,7 +3,7 @@ module github.com/testcontainers/testcontainers-go/modules/cassandra go 1.20 require ( - github.com/docker/go-connections v0.4.0 + github.com/docker/go-connections v0.5.0 github.com/gocql/gocql v1.6.0 github.com/stretchr/testify v1.8.4 github.com/testcontainers/testcontainers-go v0.27.0 @@ -49,8 +49,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/cassandra/go.sum b/modules/cassandra/go.sum index 3fbe3b6227..f1d7f67ca9 100644 --- a/modules/cassandra/go.sum +++ b/modules/cassandra/go.sum @@ -34,8 +34,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -151,7 +151,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -173,8 +172,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/clickhouse/clickhouse_test.go b/modules/clickhouse/clickhouse_test.go index ea2670388b..c503218abf 100644 --- a/modules/clickhouse/clickhouse_test.go +++ b/modules/clickhouse/clickhouse_test.go @@ -9,6 +9,7 @@ import ( "github.com/ClickHouse/clickhouse-go/v2/lib/driver" "github.com/cenkalti/backoff/v4" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/testcontainers/testcontainers-go" ) @@ -33,11 +34,11 @@ func TestClickHouseDefaultConfig(t *testing.T) { // Clean up the container after the test is complete t.Cleanup(func() { - assert.NoError(t, container.Terminate(ctx)) + require.NoError(t, container.Terminate(ctx)) }) connectionHost, err := container.ConnectionHost(ctx) - assert.NoError(t, err) + require.NoError(t, err) conn, err := ch.Open(&ch.Options{ Addr: []string{connectionHost}, @@ -47,12 +48,12 @@ func TestClickHouseDefaultConfig(t *testing.T) { Password: container.password, }, }) - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, conn) defer conn.Close() err = conn.Ping(context.Background()) - assert.NoError(t, err) + require.NoError(t, err) } func TestClickHouseConnectionHost(t *testing.T) { @@ -69,13 +70,13 @@ func TestClickHouseConnectionHost(t *testing.T) { // Clean up the container after the test is complete t.Cleanup(func() { - assert.NoError(t, container.Terminate(ctx)) + require.NoError(t, container.Terminate(ctx)) }) // connectionHost { connectionHost, err := container.ConnectionHost(ctx) // } - assert.NoError(t, err) + require.NoError(t, err) conn, err := ch.Open(&ch.Options{ Addr: []string{connectionHost}, @@ -85,13 +86,13 @@ func TestClickHouseConnectionHost(t *testing.T) { Password: password, }, }) - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, conn) defer conn.Close() // perform assertions data, err := performCRUD(conn) - assert.NoError(t, err) + require.NoError(t, err) assert.Len(t, data, 1) } @@ -105,25 +106,25 @@ func TestClickHouseDSN(t *testing.T) { // Clean up the container after the test is complete t.Cleanup(func() { - assert.NoError(t, container.Terminate(ctx)) + require.NoError(t, container.Terminate(ctx)) }) // connectionString { connectionString, err := container.ConnectionString(ctx, "debug=true") // } - assert.NoError(t, err) + require.NoError(t, err) opts, err := ch.ParseDSN(connectionString) - assert.NoError(t, err) + require.NoError(t, err) conn, err := ch.Open(opts) - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, conn) defer conn.Close() // perform assertions data, err := performCRUD(conn) - assert.NoError(t, err) + require.NoError(t, err) assert.Len(t, data, 1) } @@ -144,11 +145,11 @@ func TestClickHouseWithInitScripts(t *testing.T) { // Clean up the container after the test is complete t.Cleanup(func() { - assert.NoError(t, container.Terminate(ctx)) + require.NoError(t, container.Terminate(ctx)) }) connectionHost, err := container.ConnectionHost(ctx) - assert.NoError(t, err) + require.NoError(t, err) conn, err := ch.Open(&ch.Options{ Addr: []string{connectionHost}, @@ -158,13 +159,13 @@ func TestClickHouseWithInitScripts(t *testing.T) { Password: password, }, }) - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, conn) defer conn.Close() // perform assertions data, err := getAllRows(conn) - assert.NoError(t, err) + require.NoError(t, err) assert.Len(t, data, 1) } @@ -192,11 +193,11 @@ func TestClickHouseWithConfigFile(t *testing.T) { // Clean up the container after the test is complete t.Cleanup(func() { - assert.NoError(t, container.Terminate(ctx)) + require.NoError(t, container.Terminate(ctx)) }) connectionHost, err := container.ConnectionHost(ctx) - assert.NoError(t, err) + require.NoError(t, err) conn, err := ch.Open(&ch.Options{ Addr: []string{connectionHost}, @@ -206,13 +207,13 @@ func TestClickHouseWithConfigFile(t *testing.T) { // Password: password, // --> password is not required }, }) - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, conn) defer conn.Close() // perform assertions data, err := performCRUD(conn) - assert.NoError(t, err) + require.NoError(t, err) assert.Len(t, data, 1) }) } diff --git a/modules/clickhouse/go.mod b/modules/clickhouse/go.mod index 9f5adc82c3..8074e9867f 100644 --- a/modules/clickhouse/go.mod +++ b/modules/clickhouse/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/ClickHouse/clickhouse-go/v2 v2.17.1 github.com/cenkalti/backoff/v4 v4.2.1 - github.com/docker/go-connections v0.4.0 + github.com/docker/go-connections v0.5.0 github.com/stretchr/testify v1.8.4 github.com/testcontainers/testcontainers-go v0.27.0 ) @@ -57,8 +57,8 @@ require ( go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.19.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/clickhouse/go.sum b/modules/clickhouse/go.sum index b0c23be07c..9afa945970 100644 --- a/modules/clickhouse/go.sum +++ b/modules/clickhouse/go.sum @@ -36,8 +36,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -176,7 +176,6 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= 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= @@ -201,14 +200,16 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= 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= diff --git a/modules/compose/go.mod b/modules/compose/go.mod index 0ef92f0491..8f16883411 100644 --- a/modules/compose/go.mod +++ b/modules/compose/go.mod @@ -54,7 +54,7 @@ require ( github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker-credential-helpers v0.7.0 // indirect github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-metrics v0.0.1 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/emicklei/go-restful/v3 v3.10.1 // indirect @@ -162,7 +162,7 @@ require ( golang.org/x/mod v0.11.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.11.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect diff --git a/modules/compose/go.sum b/modules/compose/go.sum index 611a7fb23f..03c2b260e9 100644 --- a/modules/compose/go.sum +++ b/modules/compose/go.sum @@ -137,8 +137,9 @@ github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryef github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c/go.mod h1:CADgU4DSXK5QUlFslkQu2yW2TKzFZcXq/leZfM0UH5Q= -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-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= +github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c h1:+pKlWGMw7gf6bQ+oDZB4KHQFypsfjYlq/C4rfL7D3g8= github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= @@ -619,8 +620,9 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= diff --git a/modules/compose/testdata/docker-compose-complex.yml b/modules/compose/testdata/docker-compose-complex.yml index 8185d87643..46a674ca04 100644 --- a/modules/compose/testdata/docker-compose-complex.yml +++ b/modules/compose/testdata/docker-compose-complex.yml @@ -5,7 +5,7 @@ services: ports: - "9080:80" mysql: - image: docker.io/mysql:8 + image: docker.io/mysql:8.0.36 environment: - MYSQL_DATABASE=db - MYSQL_ROOT_PASSWORD=my-secret-pw diff --git a/modules/compose/testdata/docker-compose-override.yml b/modules/compose/testdata/docker-compose-override.yml index 94d2188d78..b721aec403 100644 --- a/modules/compose/testdata/docker-compose-override.yml +++ b/modules/compose/testdata/docker-compose-override.yml @@ -8,7 +8,7 @@ services: ports: - "9080:80" mysql: - image: docker.io/mysql:8 + image: docker.io/mysql:8.0.36 environment: MYSQL_RANDOM_ROOT_PASSWORD: Y ports: diff --git a/modules/couchbase/go.mod b/modules/couchbase/go.mod index b2c3f97f9f..3b2eaf08fa 100644 --- a/modules/couchbase/go.mod +++ b/modules/couchbase/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/couchbase/gocb/v2 v2.7.0 - github.com/docker/go-connections v0.4.0 + github.com/docker/go-connections v0.5.0 github.com/testcontainers/testcontainers-go v0.27.0 github.com/tidwall/gjson v1.17.0 ) @@ -56,7 +56,7 @@ require ( golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect diff --git a/modules/couchbase/go.sum b/modules/couchbase/go.sum index 22b6eb6df8..4857e86d37 100644 --- a/modules/couchbase/go.sum +++ b/modules/couchbase/go.sum @@ -47,8 +47,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -233,8 +233,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/elasticsearch/go.mod b/modules/elasticsearch/go.mod index ceeac93526..36e4bbf31f 100644 --- a/modules/elasticsearch/go.mod +++ b/modules/elasticsearch/go.mod @@ -21,7 +21,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.7+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/elastic/elastic-transport-go/v8 v8.3.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect @@ -48,8 +48,7 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.13.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/elasticsearch/go.sum b/modules/elasticsearch/go.sum index 06f60e3ed0..db9538c6a9 100644 --- a/modules/elasticsearch/go.sum +++ b/modules/elasticsearch/go.sum @@ -30,8 +30,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -143,7 +143,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -165,8 +164,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/gcloud/go.mod b/modules/gcloud/go.mod index ec441ef4ae..a4dca2fc9e 100644 --- a/modules/gcloud/go.mod +++ b/modules/gcloud/go.mod @@ -8,15 +8,15 @@ require ( cloud.google.com/go/datastore v1.15.0 cloud.google.com/go/firestore v1.14.0 cloud.google.com/go/pubsub v1.33.0 - cloud.google.com/go/spanner v1.54.0 - github.com/docker/go-connections v0.4.0 + cloud.google.com/go/spanner v1.55.0 + github.com/docker/go-connections v0.5.0 github.com/testcontainers/testcontainers-go v0.27.0 - google.golang.org/api v0.154.0 + google.golang.org/api v0.156.0 google.golang.org/grpc v1.60.1 ) require ( - cloud.google.com/go v0.110.10 // indirect + cloud.google.com/go v0.111.0 // indirect cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.5 // indirect @@ -88,22 +88,22 @@ require ( go.opentelemetry.io/otel v1.21.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - golang.org/x/crypto v0.17.0 // indirect + golang.org/x/crypto v0.18.0 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.19.0 // indirect - golang.org/x/oauth2 v0.15.0 // indirect - golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/oauth2 v0.16.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.10.0 // indirect - golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect - google.golang.org/protobuf v1.31.0 // indirect + google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/protobuf v1.32.0 // indirect ) replace github.com/testcontainers/testcontainers-go => ../.. diff --git a/modules/gcloud/go.sum b/modules/gcloud/go.sum index 743521ee0b..8777287b4f 100644 --- a/modules/gcloud/go.sum +++ b/modules/gcloud/go.sum @@ -1,6 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.110.10 h1:LXy9GEO+timppncPIAZoOj3l58LIU9k+kn48AN7IO3Y= -cloud.google.com/go v0.110.10/go.mod h1:v1OoFqYxiBkUrruItNM3eT4lLByNjxmJSV/xDKJNnic= +cloud.google.com/go v0.111.0 h1:YHLKNupSD1KqjDbQ3+LVdQ81h/UJbJyZG203cEfnQgM= +cloud.google.com/go v0.111.0/go.mod h1:0mibmpKP1TyOOFYQY5izo0LnT+ecvOQ0Sg3OdmMiNRU= cloud.google.com/go/bigquery v1.57.1 h1:FiULdbbzUxWD0Y4ZGPSVCDLvqRSyCIO6zKV7E2nf5uA= cloud.google.com/go/bigquery v1.57.1/go.mod h1:iYzC0tGVWt1jqSzBHqCr3lrRn0u13E8e+AqowBsDgug= cloud.google.com/go/bigtable v1.21.0 h1:BFN4jhkA9ULYYV2Ug7AeOtetVLnN2jKuIq5TcRc5C38= @@ -21,8 +21,8 @@ cloud.google.com/go/longrunning v0.5.4 h1:w8xEcbZodnA2BbW6sVirkkoC+1gP8wS57EUUgG cloud.google.com/go/longrunning v0.5.4/go.mod h1:zqNVncI0BOP8ST6XQD1+VcvuShMmq7+xFSzOL++V0dI= cloud.google.com/go/pubsub v1.33.0 h1:6SPCPvWav64tj0sVX/+npCBKhUi/UjJehy9op/V3p2g= cloud.google.com/go/pubsub v1.33.0/go.mod h1:f+w71I33OMyxf9VpMVcZbnG5KSUkCOUHYpFd5U1GdRc= -cloud.google.com/go/spanner v1.54.0 h1:ttU+lhARPF/iZE3OkCpmfsemCz9mLaqBhGPd3Qub2sQ= -cloud.google.com/go/spanner v1.54.0/go.mod h1:wZvSQVBgngF0Gq86fKup6KIYmN2be7uOKjtK97X+bQU= +cloud.google.com/go/spanner v1.55.0 h1:YF/A/k73EMYCjp8wcJTpkE+TcrWutHRlsCtlRSfWS64= +cloud.google.com/go/spanner v1.55.0/go.mod h1:HXEznMUVhC+PC+HDyo9YFG2Ajj5BQDkcbqB9Z2Ffxi0= cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= @@ -75,8 +75,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -253,14 +253,15 @@ go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= 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.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 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= @@ -284,19 +285,19 @@ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= -golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= +golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ= +golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 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= @@ -318,8 +319,9 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -345,11 +347,11 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T 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= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= gonum.org/v1/gonum v0.11.0 h1:f1IJhK4Km5tBJmaiJXtk/PkL4cdVX6J+tGiM187uT5E= -google.golang.org/api v0.154.0 h1:X7QkVKZBskztmpPKWQXgjJRPA2dJYrL6r+sYPRLj050= -google.golang.org/api v0.154.0/go.mod h1:qhSMkM85hgqiokIYsrRyKxrjfBeIhgl4Z2JmeRkYylc= +google.golang.org/api v0.156.0 h1:yloYcGbBtVYjLKQe4enCunxvwn3s2w/XPrrhVf6MsvQ= +google.golang.org/api v0.156.0/go.mod h1:bUSmn4KFO0Q+69zo9CNIDp4Psi6BqM0np0CbzKRSiSY= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= @@ -357,12 +359,12 @@ google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f h1:Vn+VyHU5guc9KjB5KrjI2q0wCOWEOIh0OEsleqakHJg= -google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f/go.mod h1:nWSwAFPb+qfNJXsoeO3Io7zf4tMSfN8EA8RlDA04GhY= -google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f h1:2yNACc1O40tTnrsbk9Cv6oxiW8pxI/pXj0wRtdlYmgY= -google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f/go.mod h1:Uy9bTZJqmfrw2rIBxgGLnamc78euZULUBrLZ9XTITKI= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 h1:DC7wcm+i+P1rN3Ff07vL+OndGg5OhNddHyTA+ocPqYE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4/go.mod h1:eJVxU6o+4G1PSczBr85xmyvSNYAKvAYgkub40YGomFM= +google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos= +google.golang.org/genproto v0.0.0-20231212172506-995d672761c0/go.mod h1:l/k7rMz0vFTBPy+tFSGvXEd3z+BcoG1k7EHbqm+YBsY= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -382,8 +384,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba 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.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 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= diff --git a/modules/k3s/go.mod b/modules/k3s/go.mod index 58cf5b8a48..53e94088d0 100644 --- a/modules/k3s/go.mod +++ b/modules/k3s/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/docker/docker v24.0.7+incompatible - github.com/docker/go-connections v0.4.0 + github.com/docker/go-connections v0.5.0 github.com/testcontainers/testcontainers-go v0.27.0 gopkg.in/yaml.v3 v3.0.1 k8s.io/api v0.29.0 @@ -65,7 +65,7 @@ require ( golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.10.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect diff --git a/modules/k3s/go.sum b/modules/k3s/go.sum index 3f9926ba9b..6214d34b44 100644 --- a/modules/k3s/go.sum +++ b/modules/k3s/go.sum @@ -31,8 +31,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -205,8 +205,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= diff --git a/modules/k6/go.mod b/modules/k6/go.mod index 400cefcbf1..835243e906 100644 --- a/modules/k6/go.mod +++ b/modules/k6/go.mod @@ -17,7 +17,7 @@ require ( github.com/containerd/log v0.1.0 // indirect github.com/cpuguy83/dockercfg v0.3.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -43,8 +43,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/k6/go.sum b/modules/k6/go.sum index 4b2eb8de73..50c11e3c1e 100644 --- a/modules/k6/go.sum +++ b/modules/k6/go.sum @@ -30,8 +30,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -136,7 +136,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -158,8 +157,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/kafka/go.mod b/modules/kafka/go.mod index cbf4f5e3d8..1e14305a32 100644 --- a/modules/kafka/go.mod +++ b/modules/kafka/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/IBM/sarama v1.42.1 - github.com/docker/go-connections v0.4.0 + github.com/docker/go-connections v0.5.0 github.com/testcontainers/testcontainers-go v0.27.0 golang.org/x/mod v0.14.0 ) @@ -61,7 +61,7 @@ require ( golang.org/x/crypto v0.17.0 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.13.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/kafka/go.sum b/modules/kafka/go.sum index f474b72ad1..ae6ae75af6 100644 --- a/modules/kafka/go.sum +++ b/modules/kafka/go.sum @@ -32,8 +32,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -213,8 +213,9 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= diff --git a/modules/localstack/go.mod b/modules/localstack/go.mod index 36cab6113c..0515e34d00 100644 --- a/modules/localstack/go.mod +++ b/modules/localstack/go.mod @@ -3,13 +3,13 @@ module github.com/testcontainers/testcontainers-go/modules/localstack go 1.20 require ( - github.com/aws/aws-sdk-go v1.48.13 - github.com/aws/aws-sdk-go-v2 v1.24.0 - github.com/aws/aws-sdk-go-v2/config v1.25.10 - github.com/aws/aws-sdk-go-v2/credentials v1.16.13 + github.com/aws/aws-sdk-go v1.49.19 + github.com/aws/aws-sdk-go-v2 v1.24.1 + github.com/aws/aws-sdk-go-v2/config v1.26.3 + github.com/aws/aws-sdk-go-v2/credentials v1.16.14 github.com/aws/aws-sdk-go-v2/service/s3 v1.47.7 github.com/docker/docker v24.0.7+incompatible - github.com/docker/go-connections v0.4.0 + github.com/docker/go-connections v0.5.0 github.com/stretchr/testify v1.8.4 github.com/testcontainers/testcontainers-go v0.27.0 golang.org/x/mod v0.12.0 @@ -21,18 +21,18 @@ require ( github.com/Microsoft/go-winio v0.6.1 // indirect github.com/Microsoft/hcsshim v0.11.4 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.10 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.9 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.9 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2 // indirect github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.9 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 // indirect github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.9 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.9 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10 // indirect github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.9 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.18.5 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.5 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.26.6 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.18.6 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.6 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 // indirect github.com/aws/smithy-go v1.19.0 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/containerd/containerd v1.7.11 // indirect @@ -66,8 +66,7 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/localstack/go.sum b/modules/localstack/go.sum index 19e898fd97..91fc430a9e 100644 --- a/modules/localstack/go.sum +++ b/modules/localstack/go.sum @@ -8,42 +8,42 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w= -github.com/aws/aws-sdk-go v1.48.13 h1:6N4GTme6MpxfCisWf5pql8k3TBORiKTmbeutZCDXlG8= -github.com/aws/aws-sdk-go v1.48.13/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= -github.com/aws/aws-sdk-go-v2 v1.24.0 h1:890+mqQ+hTpNuw0gGP6/4akolQkSToDJgHfQE7AwGuk= -github.com/aws/aws-sdk-go-v2 v1.24.0/go.mod h1:LNh45Br1YAkEKaAqvmE1m8FUx6a5b/V0oAKV7of29b4= +github.com/aws/aws-sdk-go v1.49.19 h1:oZryiqeQpeJsIcAmZlp86duMu/s/DJ43qyfwa51qmLg= +github.com/aws/aws-sdk-go v1.49.19/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go-v2 v1.24.1 h1:xAojnj+ktS95YZlDf0zxWBkbFtymPeDP+rvUQIH3uAU= +github.com/aws/aws-sdk-go-v2 v1.24.1/go.mod h1:LNh45Br1YAkEKaAqvmE1m8FUx6a5b/V0oAKV7of29b4= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 h1:OCs21ST2LrepDfD3lwlQiOqIGp6JiEUqG84GzTDoyJs= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4/go.mod h1:usURWEKSNNAcAZuzRn/9ZYPT8aZQkR7xcCtunK/LkJo= -github.com/aws/aws-sdk-go-v2/config v1.25.10 h1:qw/e8emDtNufTkrAU86DlQ18DruMyyM7ttW6Lgwp4v0= -github.com/aws/aws-sdk-go-v2/config v1.25.10/go.mod h1:203YiAtb6XyoGxXMPsUVwEcuxCiTQY/r8P27IDjfvMc= -github.com/aws/aws-sdk-go-v2/credentials v1.16.13 h1:WLABQ4Cp4vXtXfOWOS3MEZKr6AAYUpMczLhgKtAjQ/8= -github.com/aws/aws-sdk-go-v2/credentials v1.16.13/go.mod h1:Qg6x82FXwW0sJHzYruxGiuApNo31UEtJvXVSZAXeWiw= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.10 h1:w98BT5w+ao1/r5sUuiH6JkVzjowOKeOJRHERyy1vh58= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.10/go.mod h1:K2WGI7vUvkIv1HoNbfBA1bvIZ+9kL3YVmWxeKuLQsiw= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.9 h1:v+HbZaCGmOwnTTVS86Fleq0vPzOd7tnJGbFhP0stNLs= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.9/go.mod h1:Xjqy+Nyj7VDLBtCMkQYOw1QYfAEZCVLrfI0ezve8wd4= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.9 h1:N94sVhRACtXyVcjXxrwK1SKFIJrA9pOJ5yu2eSHnmls= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.9/go.mod h1:hqamLz7g1/4EJP+GH5NBhcUMLjW+gKLQabgyz6/7WAU= -github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1 h1:uR9lXYjdPX0xY+NhvaJ4dD8rpSRz5VY81ccIIoNG+lw= -github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1/go.mod h1:6fQQgfuGmw8Al/3M2IgIllycxV7ZW7WCdVSqfBeUiCY= +github.com/aws/aws-sdk-go-v2/config v1.26.3 h1:dKuc2jdp10y13dEEvPqWxqLoc0vF3Z9FC45MvuQSxOA= +github.com/aws/aws-sdk-go-v2/config v1.26.3/go.mod h1:Bxgi+DeeswYofcYO0XyGClwlrq3DZEXli0kLf4hkGA0= +github.com/aws/aws-sdk-go-v2/credentials v1.16.14 h1:mMDTwwYO9A0/JbOCOG7EOZHtYM+o7OfGWfu0toa23VE= +github.com/aws/aws-sdk-go-v2/credentials v1.16.14/go.mod h1:cniAUh3ErQPHtCQGPT5ouvSAQ0od8caTO9OOuufZOAE= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11 h1:c5I5iH+DZcH3xOIMlz3/tCKJDaHFwYEmxvlh2fAcFo8= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11/go.mod h1:cRrYDYAMUohBJUtUnOhydaMHtiK/1NZ0Otc9lIb6O0Y= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 h1:vF+Zgd9s+H4vOXd5BMaPWykta2a6Ih0AKLq/X6NYKn4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10/go.mod h1:6BkRjejp/GR4411UGqkX8+wFMbFbqsUIimfK4XjOKR4= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 h1:nYPe006ktcqUji8S2mqXf9c/7NdiKriOwMvWQHgYztw= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10/go.mod h1:6UV4SZkVvmODfXKql4LCbaZUpF7HO2BX38FgBf9ZOLw= +github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2 h1:GrSw8s0Gs/5zZ0SX+gX4zQjRnRsMJDJ2sLur1gRBhEM= +github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2/go.mod h1:6fQQgfuGmw8Al/3M2IgIllycxV7ZW7WCdVSqfBeUiCY= github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.9 h1:ugD6qzjYtB7zM5PN/ZIeaAIyefPaD82G8+SJopgvUpw= github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.9/go.mod h1:YD0aYBWCrPENpHolhKw2XDlTIWae2GKXT1T4o6N6hiM= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 h1:/b31bi3YVNlkzkBrm9LfpaKoaYZUxIAj4sHfOTmLfqw= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4/go.mod h1:2aGXHFmbInwgP9ZfpmdIfOELL79zhdNYNmReK8qDfdQ= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.9 h1:/90OR2XbSYfXucBMJ4U14wrjlfleq/0SB6dZDPncgmo= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.9/go.mod h1:dN/Of9/fNZet7UrQQ6kTDo/VSwKPIq94vjlU16bRARc= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.9 h1:Nf2sHxjMJR8CSImIVCONRi4g0Su3J+TSTbS7G0pUeMU= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.9/go.mod h1:idky4TER38YIjr2cADF1/ugFMKvZV7p//pVeV5LZbF0= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10 h1:DBYTXwIGQSGs9w4jKm60F5dmCQ3EEruxdc0MFh+3EY4= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10/go.mod h1:wohMUQiFdzo0NtxbBg0mSRGZ4vL3n0dKjLTINdcIino= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.9 h1:iEAeF6YC3l4FzlJPP9H3Ko1TXpdjdqWffxXjp8SY6uk= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.9/go.mod h1:kjsXoK23q9Z/tLBrckZLLyvjhZoS+AGrzqzUfEClvMM= github.com/aws/aws-sdk-go-v2/service/s3 v1.47.7 h1:o0ASbVwUAIrfp/WcCac+6jioZt4Hd8k/1X8u7GJ/QeM= github.com/aws/aws-sdk-go-v2/service/s3 v1.47.7/go.mod h1:vADO6Jn+Rq4nDtfwNjhgR84qkZwiC6FqCaXdw/kYwjA= -github.com/aws/aws-sdk-go-v2/service/sso v1.18.5 h1:ldSFWz9tEHAwHNmjx2Cvy1MjP5/L9kNoR0skc6wyOOM= -github.com/aws/aws-sdk-go-v2/service/sso v1.18.5/go.mod h1:CaFfXLYL376jgbP7VKC96uFcU8Rlavak0UlAwk1Dlhc= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.5 h1:2k9KmFawS63euAkY4/ixVNsYYwrwnd5fIvgEKkfZFNM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.5/go.mod h1:W+nd4wWDVkSUIox9bacmkBP5NMFQeTJ/xqNabpzSR38= -github.com/aws/aws-sdk-go-v2/service/sts v1.26.6 h1:HJeiuZ2fldpd0WqngyMR6KW7ofkXNLyOaHwEIGm39Cs= -github.com/aws/aws-sdk-go-v2/service/sts v1.26.6/go.mod h1:XX5gh4CB7wAs4KhcF46G6C8a2i7eupU19dcAAE+EydU= +github.com/aws/aws-sdk-go-v2/service/sso v1.18.6 h1:dGrs+Q/WzhsiUKh82SfTVN66QzyulXuMDTV/G8ZxOac= +github.com/aws/aws-sdk-go-v2/service/sso v1.18.6/go.mod h1:+mJNDdF+qiUlNKNC3fxn74WWNN+sOiGOEImje+3ScPM= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.6 h1:Yf2MIo9x+0tyv76GljxzqA3WtC5mw7NmazD2chwjxE4= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.6/go.mod h1:ykf3COxYI0UJmxcfcxcVuz7b6uADi1FkiUz6Eb7AgM8= +github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 h1:NzO4Vrau795RkUdSHKEwiR01FaGzGOH1EETJ+5QHnm0= +github.com/aws/aws-sdk-go-v2/service/sts v1.26.7/go.mod h1:6h2YuIoxaMSCFf5fi1EgZAwdfkGMgDY+DVfa61uLe4U= github.com/aws/smithy-go v1.19.0 h1:KWFKQV80DpP3vJrrA9sVAHQ5gc2z8i4EzrLhLlWXcBM= github.com/aws/smithy-go v1.19.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= @@ -68,8 +68,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -181,7 +181,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -203,8 +202,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/localstack/localstack_test.go b/modules/localstack/localstack_test.go index 4d65018722..b8268c388e 100644 --- a/modules/localstack/localstack_test.go +++ b/modules/localstack/localstack_test.go @@ -42,7 +42,7 @@ func TestConfigureDockerHost(t *testing.T) { req.Env[tt.envVar] = "foo" reason, err := configureDockerHost(req, tt.envVar) - assert.Nil(t, err) + require.NoError(t, err) assert.Equal(t, "explicitly as environment variable", reason) }) @@ -57,19 +57,19 @@ func TestConfigureDockerHost(t *testing.T) { } reason, err := configureDockerHost(req, tt.envVar) - assert.Nil(t, err) + require.NoError(t, err) assert.Equal(t, "to match last network alias on container with non-default network", reason) assert.Equal(t, "foo3", req.Env[tt.envVar]) }) t.Run("HOSTNAME_EXTERNAL matches the daemon host because there are no aliases", func(t *testing.T) { dockerProvider, err := testcontainers.NewDockerProvider() - assert.Nil(t, err) + require.NoError(t, err) defer dockerProvider.Close() // because the daemon host could be a remote one, we need to get it from the provider expectedDaemonHost, err := dockerProvider.DaemonHost(context.Background()) - assert.Nil(t, err) + require.NoError(t, err) req := generateContainerRequest() @@ -77,7 +77,7 @@ func TestConfigureDockerHost(t *testing.T) { req.NetworkAliases = map[string][]string{} reason, err := configureDockerHost(req, tt.envVar) - assert.Nil(t, err) + require.NoError(t, err) assert.Equal(t, "to match host-routable address for container", reason) assert.Equal(t, expectedDaemonHost, req.Env[tt.envVar]) }) @@ -124,11 +124,11 @@ func TestRunContainer(t *testing.T) { ) t.Run("Localstack:"+tt.version+" - multiple services exposed on same port", func(t *testing.T) { - require.Nil(t, err) + require.NoError(t, err) assert.NotNil(t, container) rawPorts, err := container.Ports(ctx) - require.Nil(t, err) + require.NoError(t, err) ports := 0 // only one port is exposed among all the ports in the container @@ -147,7 +147,7 @@ func TestStartWithoutOverride(t *testing.T) { ctx := context.Background() container, err := RunContainer(ctx) - require.Nil(t, err) + require.NoError(t, err) assert.NotNil(t, container) } @@ -156,7 +156,7 @@ func TestStartV2WithNetwork(t *testing.T) { // withCustomContainerRequest { nw, err := network.New(ctx) - require.Nil(t, err) + require.NoError(t, err) localstack, err := RunContainer( ctx, @@ -169,7 +169,7 @@ func TestStartV2WithNetwork(t *testing.T) { }), ) // } - require.Nil(t, err) + require.NoError(t, err) assert.NotNil(t, localstack) networkName := nw.Name @@ -201,6 +201,6 @@ func TestStartV2WithNetwork(t *testing.T) { }, Started: true, }) - require.Nil(t, err) + require.NoError(t, err) assert.NotNil(t, cli) } diff --git a/modules/localstack/v1/s3_test.go b/modules/localstack/v1/s3_test.go index 212a0d1a43..2ab12c704b 100644 --- a/modules/localstack/v1/s3_test.go +++ b/modules/localstack/v1/s3_test.go @@ -63,10 +63,10 @@ func TestS3(t *testing.T) { ctx := context.Background() container, err := localstack.RunContainer(ctx) - require.Nil(t, err) + require.NoError(t, err) session, err := awsSession(ctx, container) - require.Nil(t, err) + require.NoError(t, err) s3Uploader := s3manager.NewUploader(session) @@ -80,7 +80,7 @@ func TestS3(t *testing.T) { outputBucket, err := s3API.CreateBucket(&s3.CreateBucketInput{ Bucket: aws.String(bucketName), }) - require.Nil(t, err) + require.NoError(t, err) assert.NotNil(t, outputBucket) // put object @@ -94,16 +94,16 @@ func TestS3(t *testing.T) { ContentType: aws.String("application/text"), ContentDisposition: aws.String("attachment"), }) - require.Nil(t, err) + require.NoError(t, err) assert.NotNil(t, outputObject) t.Run("List Buckets", func(t *testing.T) { output, err := s3API.ListBuckets(nil) - require.Nil(t, err) + require.NoError(t, err) assert.NotNil(t, output) buckets := output.Buckets - assert.Equal(t, 1, len(buckets)) + assert.Len(t, buckets, 1) assert.Equal(t, bucketName, *buckets[0].Name) }) @@ -111,12 +111,12 @@ func TestS3(t *testing.T) { output, err := s3API.ListObjects(&s3.ListObjectsInput{ Bucket: aws.String(bucketName), }) - require.Nil(t, err) + require.NoError(t, err) assert.NotNil(t, output) objects := output.Contents - assert.Equal(t, 1, len(objects)) + assert.Len(t, objects, 1) assert.Equal(t, s3Key1, *objects[0].Key) assert.Equal(t, int64(len(body1)), *objects[0].Size) }) diff --git a/modules/localstack/v2/s3_test.go b/modules/localstack/v2/s3_test.go index 861546170d..6acb7240c4 100644 --- a/modules/localstack/v2/s3_test.go +++ b/modules/localstack/v2/s3_test.go @@ -74,10 +74,10 @@ func TestS3(t *testing.T) { ctx := context.Background() container, err := localstack.RunContainer(ctx) - require.Nil(t, err) + require.NoError(t, err) s3Client, err := s3Client(ctx, container) - require.Nil(t, err) + require.NoError(t, err) t.Run("S3 operations", func(t *testing.T) { bucketName := "localstack-bucket" @@ -86,7 +86,7 @@ func TestS3(t *testing.T) { outputBucket, err := s3Client.CreateBucket(ctx, &s3.CreateBucketInput{ Bucket: aws.String(bucketName), }) - require.Nil(t, err) + require.NoError(t, err) assert.NotNil(t, outputBucket) // put object @@ -100,16 +100,16 @@ func TestS3(t *testing.T) { ContentType: aws.String("application/text"), ContentDisposition: aws.String("attachment"), }) - require.Nil(t, err) + require.NoError(t, err) assert.NotNil(t, outputObject) t.Run("List Buckets", func(t *testing.T) { output, err := s3Client.ListBuckets(ctx, &s3.ListBucketsInput{}) - require.Nil(t, err) + require.NoError(t, err) assert.NotNil(t, output) buckets := output.Buckets - assert.Equal(t, 1, len(buckets)) + assert.Len(t, buckets, 1) assert.Equal(t, bucketName, *buckets[0].Name) }) @@ -117,12 +117,12 @@ func TestS3(t *testing.T) { output, err := s3Client.ListObjectsV2(ctx, &s3.ListObjectsV2Input{ Bucket: aws.String(bucketName), }) - require.Nil(t, err) + require.NoError(t, err) assert.NotNil(t, output) objects := output.Contents - assert.Equal(t, 1, len(objects)) + assert.Len(t, objects, 1) assert.Equal(t, s3Key1, *objects[0].Key) assert.Equal(t, aws.Int64(int64(len(body1))), objects[0].Size) }) diff --git a/modules/mariadb/go.mod b/modules/mariadb/go.mod index 9e5eb07e4c..a2f2b04a78 100644 --- a/modules/mariadb/go.mod +++ b/modules/mariadb/go.mod @@ -18,7 +18,7 @@ require ( github.com/cpuguy83/dockercfg v0.3.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.7+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -44,8 +44,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/mariadb/go.sum b/modules/mariadb/go.sum index 40bd62c5f5..bc02cdd8b4 100644 --- a/modules/mariadb/go.sum +++ b/modules/mariadb/go.sum @@ -30,8 +30,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -138,7 +138,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -160,8 +159,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/mariadb/testdata/my.cnf b/modules/mariadb/testdata/my.cnf index c5e11ebb49..3db92faa9c 100644 --- a/modules/mariadb/testdata/my.cnf +++ b/modules/mariadb/testdata/my.cnf @@ -10,7 +10,7 @@ read_buffer_size = 256K read_rnd_buffer_size = 256K net_buffer_length = 2K thread_stack = 512K -skip-host-cache +host_cache_size=0 skip-name-resolve # Don't listen on a TCP/IP port at all. This can be a security enhancement, diff --git a/modules/mockserver/Makefile b/modules/mockserver/Makefile new file mode 100644 index 0000000000..8323cc42f4 --- /dev/null +++ b/modules/mockserver/Makefile @@ -0,0 +1,5 @@ +include ../../commons-test.mk + +.PHONY: test +test: + $(MAKE) test-mockserver diff --git a/modules/mockserver/coverage.out b/modules/mockserver/coverage.out new file mode 100644 index 0000000000..5f02b11199 --- /dev/null +++ b/modules/mockserver/coverage.out @@ -0,0 +1 @@ +mode: set diff --git a/modules/mockserver/examples_test.go b/modules/mockserver/examples_test.go new file mode 100644 index 0000000000..e890bf6cdd --- /dev/null +++ b/modules/mockserver/examples_test.go @@ -0,0 +1,101 @@ +package mockserver_test + +import ( + "context" + "fmt" + "io" + "net/http" + "strings" + + client "github.com/BraspagDevelopers/mock-server-client" + + "github.com/testcontainers/testcontainers-go" + "github.com/testcontainers/testcontainers-go/modules/mockserver" +) + +func ExampleRunContainer() { + // runMockServerContainer { + ctx := context.Background() + + mockserverContainer, err := mockserver.RunContainer(ctx, testcontainers.WithImage("mockserver/mockserver:5.15.0")) + if err != nil { + panic(err) + } + + // Clean up the container + defer func() { + if err := mockserverContainer.Terminate(ctx); err != nil { + panic(err) + } + }() + // } + + state, err := mockserverContainer.State(ctx) + if err != nil { + panic(err) + } + + fmt.Println(state.Running) + + // Output: + // true +} + +func ExampleRunContainer_connect() { + // connectToMockServer { + ctx := context.Background() + + mockserverContainer, err := mockserver.RunContainer(ctx, testcontainers.WithImage("mockserver/mockserver:5.15.0")) + if err != nil { + panic(err) + } + + // Clean up the container + defer func() { + if err := mockserverContainer.Terminate(ctx); err != nil { + panic(err) + } + }() + + url, err := mockserverContainer.URL(ctx) + if err != nil { + panic(err) + } + ms := client.NewClientURL(url) + // } + + requestMatcher := client.RequestMatcher{ + Method: http.MethodPost, + Path: "/api/categories", + } + requestMatcher = requestMatcher.WithJSONFields(map[string]interface{}{"name": "Tools"}) + err = ms.RegisterExpectation(client.NewExpectation(requestMatcher).WithResponse(client.NewResponseOK().WithJSONBody(map[string]any{"test": "value"}))) + if err != nil { + panic(err) + } + + httpClient := &http.Client{} + resp, err := httpClient.Post(url+"/api/categories", "application/json", strings.NewReader(`{"name": "Tools"}`)) + if err != nil { + panic(err) + } + + buf, err := io.ReadAll(resp.Body) + if err != nil { + panic(err) + } + resp.Body.Close() + + fmt.Println(resp.StatusCode) + fmt.Println(string(buf)) + + err = ms.Verify(requestMatcher, client.Once()) + fmt.Println(err == nil) + + // Output: + // 200 + // { + // "test" : "value" + // } + // true +} diff --git a/modules/mockserver/go.mod b/modules/mockserver/go.mod new file mode 100644 index 0000000000..4ef3d67680 --- /dev/null +++ b/modules/mockserver/go.mod @@ -0,0 +1,56 @@ +module github.com/testcontainers/testcontainers-go/modules/mockserver + +go 1.20 + +require ( + github.com/BraspagDevelopers/mock-server-client v0.2.2 + github.com/testcontainers/testcontainers-go v0.27.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/Microsoft/hcsshim v0.11.4 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect + github.com/containerd/containerd v1.7.11 // indirect + github.com/containerd/log v0.1.0 // indirect + github.com/cpuguy83/dockercfg v0.3.1 // indirect + github.com/docker/distribution v2.8.2+incompatible // indirect + github.com/docker/docker v24.0.7+incompatible // indirect + github.com/docker/go-connections v0.5.0 // indirect + github.com/docker/go-units v0.5.0 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect + github.com/go-resty/resty/v2 v2.3.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/uuid v1.5.0 // indirect + github.com/klauspost/compress v1.16.0 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/moby/patternmatcher v0.6.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-rc5 // indirect + github.com/opencontainers/runc v1.1.5 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/shirou/gopsutil/v3 v3.23.12 // indirect + github.com/shoenig/go-m1cpu v0.1.6 // 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/yusufpapurcu/wmi v1.2.3 // indirect + golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect + golang.org/x/mod v0.11.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/tools v0.10.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/grpc v1.58.3 // indirect + google.golang.org/protobuf v1.31.0 // indirect +) + +replace github.com/testcontainers/testcontainers-go => ../.. diff --git a/modules/mockserver/go.sum b/modules/mockserver/go.sum new file mode 100644 index 0000000000..be13f15fe5 --- /dev/null +++ b/modules/mockserver/go.sum @@ -0,0 +1,199 @@ +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-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= +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/BraspagDevelopers/mock-server-client v0.2.2 h1:Zro0OonNeaDwkkQGIxeJQfYweNKZ+m+8QIlDZAFRc/4= +github.com/BraspagDevelopers/mock-server-client v0.2.2/go.mod h1:LHulrZSfbCNeS/CoycaWdhE495FnyeI3iXm6+4Zjz5c= +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.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= +github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w= +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= +github.com/containerd/containerd v1.7.11 h1:lfGKw3eU35sjV0aG2eYZTiwFEY1pCzxdzicHP3SZILw= +github.com/containerd/containerd v1.7.11/go.mod h1:5UluHxHTX2rdvYuZ5OJTC5m/KJNs0Zs9wVoJm9zf5ZE= +github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= +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/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.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= +github.com/docker/docker v24.0.7+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.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-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-resty/resty/v2 v2.3.0 h1:JOOeAvjSlapTT92p8xiS19Zxev1neGikoHsXJeOq8So= +github.com/go-resty/resty/v2 v2.3.0/go.mod h1:UpN9CgLZNsv4e9XG50UU8xdI0F43UQ4HmxLBDwaroHU= +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/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.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.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/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +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.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +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/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-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= +github.com/opencontainers/image-spec v1.1.0-rc5/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/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/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/shirou/gopsutil/v3 v3.23.12 h1:z90NtUkp3bMtmICZKpC4+WaknU1eXtp5vtbQ11DgpE4= +github.com/shirou/gopsutil/v3 v3.23.12/go.mod h1:1FrWgea594Jp7qmjHUUPlJDTPgcsb9mGnXDxavtikzM= +github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= +github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= +github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= +github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= +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.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.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +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.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +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/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/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/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= +github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +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.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= +golang.org/x/mod v0.11.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-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +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.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +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-20190916202348-b4ddaad3f8a3/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-20200323222414-85ca7c5b95cd/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-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/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-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/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +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.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +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.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg= +golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= +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-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +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.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +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= diff --git a/modules/mockserver/mockserver.go b/modules/mockserver/mockserver.go new file mode 100644 index 0000000000..37ebc1b1b5 --- /dev/null +++ b/modules/mockserver/mockserver.go @@ -0,0 +1,59 @@ +package mockserver + +import ( + "context" + "fmt" + + "github.com/testcontainers/testcontainers-go" + "github.com/testcontainers/testcontainers-go/wait" +) + +// defaultImage is the default MockServer container image +const defaultImage = "mockserver/mockserver:5.15.0" + +// MockServerContainer represents the MockServer container type used in the module +type MockServerContainer struct { + testcontainers.Container +} + +// RunContainer creates an instance of the MockServer container type +func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*MockServerContainer, error) { + req := testcontainers.ContainerRequest{ + Image: defaultImage, + ExposedPorts: []string{"1080/tcp"}, + WaitingFor: wait.ForAll( + wait.ForLog("started on port: 1080"), + wait.ForListeningPort("1080/tcp"), + ), + Env: map[string]string{}, + } + + 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 + } + + return &MockServerContainer{Container: container}, nil +} + +// GetURL returns the URL of the MockServer container +func (c *MockServerContainer) URL(ctx context.Context) (string, error) { + host, err := c.Host(ctx) + if err != nil { + return "", err + } + port, err := c.MappedPort(ctx, "1080/tcp") + if err != nil { + return "", err + } + return fmt.Sprintf("http://%s:%d", host, port.Int()), nil +} diff --git a/modules/mongodb/go.mod b/modules/mongodb/go.mod index c364c71b73..9b4851c09e 100644 --- a/modules/mongodb/go.mod +++ b/modules/mongodb/go.mod @@ -18,7 +18,7 @@ require ( github.com/cpuguy83/dockercfg v0.3.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.7+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -51,9 +51,8 @@ require ( golang.org/x/crypto v0.17.0 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect diff --git a/modules/mongodb/go.sum b/modules/mongodb/go.sum index e8766a2538..6702330da1 100644 --- a/modules/mongodb/go.sum +++ b/modules/mongodb/go.sum @@ -30,8 +30,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -161,7 +161,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -189,8 +188,9 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/modules/mssql/go.mod b/modules/mssql/go.mod index 5005d912e2..7dbc9c1724 100644 --- a/modules/mssql/go.mod +++ b/modules/mssql/go.mod @@ -18,7 +18,7 @@ require ( github.com/cpuguy83/dockercfg v0.3.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.7+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -47,8 +47,7 @@ require ( golang.org/x/crypto v0.17.0 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect diff --git a/modules/mssql/go.sum b/modules/mssql/go.sum index 14d9384cd8..46c4daa6d3 100644 --- a/modules/mssql/go.sum +++ b/modules/mssql/go.sum @@ -36,8 +36,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -153,7 +153,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -175,8 +174,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/mysql/examples_test.go b/modules/mysql/examples_test.go index fa2c19ff6e..29668dc3c4 100644 --- a/modules/mysql/examples_test.go +++ b/modules/mysql/examples_test.go @@ -2,6 +2,7 @@ package mysql_test import ( "context" + "database/sql" "fmt" "path/filepath" @@ -14,7 +15,7 @@ func ExampleRunContainer() { ctx := context.Background() mysqlContainer, err := mysql.RunContainer(ctx, - testcontainers.WithImage("mysql:8"), + testcontainers.WithImage("mysql:8.0.36"), mysql.WithConfigFile(filepath.Join("testdata", "my_8.cnf")), mysql.WithDatabase("foo"), mysql.WithUsername("root"), @@ -43,3 +44,53 @@ func ExampleRunContainer() { // Output: // true } + +func ExampleRunContainer_connect() { + ctx := context.Background() + + mysqlContainer, err := mysql.RunContainer(ctx, + testcontainers.WithImage("mysql:8.0.36"), + mysql.WithConfigFile(filepath.Join("testdata", "my_8.cnf")), + mysql.WithDatabase("foo"), + mysql.WithUsername("root"), + mysql.WithPassword("password"), + mysql.WithScripts(filepath.Join("testdata", "schema.sql")), + ) + if err != nil { + panic(err) + } + + defer func() { + if err := mysqlContainer.Terminate(ctx); err != nil { + panic(err) + } + }() + + connectionString, _ := mysqlContainer.ConnectionString(ctx) + + db, err := sql.Open("mysql", connectionString) + if err != nil { + panic(err) + } + defer db.Close() + + if err = db.Ping(); err != nil { + panic(err) + } + stmt, err := db.Prepare("SELECT @@GLOBAL.tmpdir") + if err != nil { + panic(err) + } + defer stmt.Close() + row := stmt.QueryRow() + tmpDir := "" + err = row.Scan(&tmpDir) + if err != nil { + panic(err) + } + + fmt.Println(tmpDir) + + // Output: + // /tmp +} diff --git a/modules/mysql/go.mod b/modules/mysql/go.mod index bed976a426..e95529c61c 100644 --- a/modules/mysql/go.mod +++ b/modules/mysql/go.mod @@ -19,7 +19,7 @@ require ( github.com/cpuguy83/dockercfg v0.3.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.7+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -45,8 +45,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/mysql/go.sum b/modules/mysql/go.sum index 40bd62c5f5..bc02cdd8b4 100644 --- a/modules/mysql/go.sum +++ b/modules/mysql/go.sum @@ -30,8 +30,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -138,7 +138,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -160,8 +159,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/mysql/mysql.go b/modules/mysql/mysql.go index ec98b481be..2ebfce1710 100644 --- a/modules/mysql/mysql.go +++ b/modules/mysql/mysql.go @@ -18,7 +18,7 @@ const ( ) // defaultImage { -const defaultImage = "mysql:8" +const defaultImage = "mysql:8.0.36" // } diff --git a/modules/mysql/mysql_test.go b/modules/mysql/mysql_test.go index 723b2930c9..daf5d879dc 100644 --- a/modules/mysql/mysql_test.go +++ b/modules/mysql/mysql_test.go @@ -1,4 +1,4 @@ -package mysql +package mysql_test import ( "context" @@ -9,13 +9,13 @@ import ( // Import mysql into the scope of this package (required) _ "github.com/go-sql-driver/mysql" - "github.com/testcontainers/testcontainers-go" + "github.com/testcontainers/testcontainers-go/modules/mysql" ) func TestMySQL(t *testing.T) { ctx := context.Background() - container, err := RunContainer(ctx) + container, err := mysql.RunContainer(ctx) if err != nil { t.Fatal(err) } @@ -57,10 +57,10 @@ func TestMySQL(t *testing.T) { func TestMySQLWithNonRootUserAndEmptyPassword(t *testing.T) { ctx := context.Background() - _, err := RunContainer(ctx, - WithDatabase("foo"), - WithUsername("test"), - WithPassword("")) + _, err := mysql.RunContainer(ctx, + mysql.WithDatabase("foo"), + mysql.WithUsername("test"), + mysql.WithPassword("")) if err.Error() != "empty password can be used only with the root user" { t.Fatal(err) } @@ -69,10 +69,10 @@ func TestMySQLWithNonRootUserAndEmptyPassword(t *testing.T) { func TestMySQLWithRootUserAndEmptyPassword(t *testing.T) { ctx := context.Background() - container, err := RunContainer(ctx, - WithDatabase("foo"), - WithUsername("root"), - WithPassword("")) + container, err := mysql.RunContainer(ctx, + mysql.WithDatabase("foo"), + mysql.WithUsername("root"), + mysql.WithPassword("")) if err != nil { t.Fatal(err) } @@ -106,55 +106,11 @@ func TestMySQLWithRootUserAndEmptyPassword(t *testing.T) { } } -func TestMySQLWithConfigFile(t *testing.T) { - ctx := context.Background() - - container, err := RunContainer(ctx, testcontainers.WithImage("mysql:5.6"), - WithConfigFile(filepath.Join("testdata", "my_5.6.cnf"))) - if err != nil { - t.Fatal(err) - } - - // Clean up the container after the test is complete - t.Cleanup(func() { - if err := container.Terminate(ctx); err != nil { - t.Fatalf("failed to terminate container: %s", err) - } - }) - - // perform assertions - connectionString, _ := container.ConnectionString(ctx) - - db, err := sql.Open("mysql", connectionString) - if err != nil { - t.Fatal(err) - } - defer db.Close() - - if err = db.Ping(); err != nil { - t.Errorf("error pinging db: %+v\n", err) - } - stmt, err := db.Prepare("SELECT @@GLOBAL.innodb_file_format") - if err != nil { - t.Fatal(err) - } - defer stmt.Close() - row := stmt.QueryRow() - innodbFileFormat := "" - err = row.Scan(&innodbFileFormat) - if err != nil { - t.Errorf("error fetching innodb_file_format value") - } - if innodbFileFormat != "Barracuda" { - t.Fatal("The InnoDB file format has been set by the ini file content") - } -} - func TestMySQLWithScripts(t *testing.T) { ctx := context.Background() - container, err := RunContainer(ctx, - WithScripts(filepath.Join("testdata", "schema.sql"))) + container, err := mysql.RunContainer(ctx, + mysql.WithScripts(filepath.Join("testdata", "schema.sql"))) if err != nil { t.Fatal(err) } diff --git a/modules/mysql/testdata/my_5.6.cnf b/modules/mysql/testdata/my_5.6.cnf deleted file mode 100644 index 78012cc4bf..0000000000 --- a/modules/mysql/testdata/my_5.6.cnf +++ /dev/null @@ -1,54 +0,0 @@ -[mysqld] -user = mysql -port = 3306 -#socket = /tmp/mysql.sock -skip-external-locking -key_buffer_size = 16K -max_allowed_packet = 1M -table_open_cache = 4 -sort_buffer_size = 64K -read_buffer_size = 256K -read_rnd_buffer_size = 256K -net_buffer_length = 2K -thread_stack = 128K - - -innodb_file_format=Barracuda - - - - - -# Don't listen on a TCP/IP port at all. This can be a security enhancement, -# if all processes that need to connect to mysqld run on the same host. -# All interaction with mysqld must be made via Unix sockets or named pipes. -# Note that using this option without enabling named pipes on Windows -# (using the "enable-named-pipe" option) will render mysqld useless! -# -#skip-networking -#server-id = 1 - -# Uncomment the following if you want to log updates -#log-bin=mysql-bin - -# binary logging format - mixed recommended -#binlog_format=mixed - -# Causes updates to non-transactional engines using statement format to be -# written directly to binary log. Before using this option make sure that -# there are no dependencies between transactional and non-transactional -# tables such as in the statement INSERT INTO t_myisam SELECT * FROM -# t_innodb; otherwise, slaves may diverge from the master. -#binlog_direct_non_transactional_updates=TRUE - -# Uncomment the following if you are using InnoDB tables -innodb_data_file_path = ibdata1:10M:autoextend -# You can set .._buffer_pool_size up to 50 - 80 % -# of RAM but beware of setting memory usage too high -innodb_buffer_pool_size = 16M -#innodb_additional_mem_pool_size = 2M -# Set .._log_file_size to 25 % of buffer pool size -innodb_log_file_size = 5M -innodb_log_buffer_size = 8M -innodb_flush_log_at_trx_commit = 1 -innodb_lock_wait_timeout = 50 \ No newline at end of file diff --git a/modules/mysql/testdata/my_8.cnf b/modules/mysql/testdata/my_8.cnf index 7eb6b0faf7..c4c6039b8a 100644 --- a/modules/mysql/testdata/my_8.cnf +++ b/modules/mysql/testdata/my_8.cnf @@ -22,7 +22,7 @@ # this will increase compatibility with older clients. For background, see: # https://dev.mysql.com/doc/refman/8.1/en/server-system-variables.html#sysvar_default_authentication_plugin # default-authentication-plugin=mysql_native_password -skip-host-cache +host_cache_size=0 skip-name-resolve datadir=/var/lib/mysql socket=/var/run/mysqld/mysqld.sock diff --git a/modules/nats/go.mod b/modules/nats/go.mod index ab3080d6e4..04aac643c9 100644 --- a/modules/nats/go.mod +++ b/modules/nats/go.mod @@ -3,7 +3,7 @@ module github.com/testcontainers/testcontainers-go/modules/nats go 1.20 require ( - github.com/nats-io/nats.go v1.31.0 + github.com/nats-io/nats.go v1.32.0 github.com/testcontainers/testcontainers-go v0.27.0 ) @@ -18,20 +18,20 @@ require ( github.com/cpuguy83/dockercfg v0.3.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.7+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/uuid v1.5.0 // indirect - github.com/klauspost/compress v1.17.0 // indirect + github.com/klauspost/compress v1.17.2 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/moby/patternmatcher v0.6.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/nats-io/nkeys v0.4.6 // indirect + github.com/nats-io/nkeys v0.4.7 // indirect github.com/nats-io/nuid v1.0.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc5 // indirect @@ -44,11 +44,10 @@ require ( github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect - golang.org/x/crypto v0.17.0 // indirect + golang.org/x/crypto v0.18.0 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/nats/go.sum b/modules/nats/go.sum index cebe96fe29..02f2dc1ba8 100644 --- a/modules/nats/go.sum +++ b/modules/nats/go.sum @@ -23,8 +23,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= @@ -43,8 +43,8 @@ github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= github.com/google/uuid v1.5.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.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= -github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= +github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= 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.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -57,10 +57,10 @@ 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/nats-io/nats.go v1.31.0 h1:/WFBHEc/dOKBF6qf1TZhrdEfTmOZ5JzdJ+Y3m6Y/p7E= -github.com/nats-io/nats.go v1.31.0/go.mod h1:di3Bm5MLsoB4Bx61CBTsxuarI36WbhAwOm8QrW39+i8= -github.com/nats-io/nkeys v0.4.6 h1:IzVe95ru2CT6ta874rt9saQRkWfe2nFj1NtvYSLqMzY= -github.com/nats-io/nkeys v0.4.6/go.mod h1:4DxZNzenSVd1cYQoAa8948QY3QDjrHfcfVADymtkpts= +github.com/nats-io/nats.go v1.32.0 h1:Bx9BZS+aXYlxW08k8Gd3yR2s73pV5XSoAQUyp1Kwvp0= +github.com/nats-io/nats.go v1.32.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8= +github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI= +github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -102,8 +102,8 @@ github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQ 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.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= 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= @@ -115,7 +115,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -129,8 +128,9 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= diff --git a/modules/neo4j/go.mod b/modules/neo4j/go.mod index 1a6899f54f..f8a193ecba 100644 --- a/modules/neo4j/go.mod +++ b/modules/neo4j/go.mod @@ -3,8 +3,8 @@ module github.com/testcontainers/testcontainers-go/modules/neo4j go 1.20 require ( - github.com/docker/go-connections v0.4.0 - github.com/neo4j/neo4j-go-driver/v5 v5.15.0 + github.com/docker/go-connections v0.5.0 + github.com/neo4j/neo4j-go-driver/v5 v5.16.0 github.com/testcontainers/testcontainers-go v0.27.0 ) @@ -44,8 +44,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/neo4j/go.sum b/modules/neo4j/go.sum index 7664f6b131..db5809267b 100644 --- a/modules/neo4j/go.sum +++ b/modules/neo4j/go.sum @@ -30,8 +30,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -74,8 +74,8 @@ github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3 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/neo4j/neo4j-go-driver/v5 v5.15.0 h1:oqJZB1p2DE153RjfFbVGQiSDXqMCMEQnrZW+ZI86o58= -github.com/neo4j/neo4j-go-driver/v5 v5.15.0/go.mod h1:Vff8OwT7QpLm7L2yYr85XNWe9Rbqlbeb9asNXJTHO4k= +github.com/neo4j/neo4j-go-driver/v5 v5.16.0 h1:m3ZTjqulwob5HBysu5QdSvFB1+6x8xC9I3hC7yzcN6A= +github.com/neo4j/neo4j-go-driver/v5 v5.16.0/go.mod h1:Vff8OwT7QpLm7L2yYr85XNWe9Rbqlbeb9asNXJTHO4k= 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-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= @@ -138,7 +138,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -160,8 +159,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/postgres/go.mod b/modules/postgres/go.mod index 6befed36af..f07d22ce53 100644 --- a/modules/postgres/go.mod +++ b/modules/postgres/go.mod @@ -3,7 +3,7 @@ module github.com/testcontainers/testcontainers-go/modules/postgres go 1.20 require ( - github.com/docker/go-connections v0.4.0 + github.com/docker/go-connections v0.5.0 github.com/lib/pq v1.10.9 github.com/stretchr/testify v1.8.4 github.com/testcontainers/testcontainers-go v0.27.0 @@ -49,8 +49,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/postgres/go.sum b/modules/postgres/go.sum index 2eadf0656d..c9875d4820 100644 --- a/modules/postgres/go.sum +++ b/modules/postgres/go.sum @@ -31,8 +31,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -143,7 +143,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -165,8 +164,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/postgres/postgres_test.go b/modules/postgres/postgres_test.go index d960d1e285..040b4775c4 100644 --- a/modules/postgres/postgres_test.go +++ b/modules/postgres/postgres_test.go @@ -76,25 +76,25 @@ func TestPostgres(t *testing.T) { // explicitly set sslmode=disable because the container is not configured to use TLS connStr, err := container.ConnectionString(ctx, "sslmode=disable", "application_name=test") // } - assert.NoError(t, err) + require.NoError(t, err) // Ensure connection string is using generic format id, err := container.MappedPort(ctx, "5432/tcp") - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=disable&application_name=test", user, password, "localhost", id.Port(), dbname), connStr) // perform assertions db, err := sql.Open("postgres", connStr) - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, db) defer db.Close() result, err := db.Exec("CREATE TABLE IF NOT EXISTS test (id int, name varchar(255));") - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, result) result, err = db.Exec("INSERT INTO test (id, name) VALUES (1, 'test');") - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, result) }) } @@ -165,10 +165,10 @@ func TestWithConfigFile(t *testing.T) { // explicitly set sslmode=disable because the container is not configured to use TLS connStr, err := container.ConnectionString(ctx, "sslmode=disable") - assert.NoError(t, err) + require.NoError(t, err) db, err := sql.Open("postgres", connStr) - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, db) defer db.Close() } @@ -196,15 +196,15 @@ func TestWithInitScript(t *testing.T) { // explicitly set sslmode=disable because the container is not configured to use TLS connStr, err := container.ConnectionString(ctx, "sslmode=disable") - assert.NoError(t, err) + require.NoError(t, err) db, err := sql.Open("postgres", connStr) - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, db) defer db.Close() // database created in init script. See testdata/init-user-db.sh result, err := db.Exec("SELECT * FROM testdb;") - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, result) } diff --git a/modules/pulsar/go.mod b/modules/pulsar/go.mod index 1d1021b7fc..01d9bf5180 100644 --- a/modules/pulsar/go.mod +++ b/modules/pulsar/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/apache/pulsar-client-go v0.10.0 github.com/docker/docker v24.0.7+incompatible - github.com/docker/go-connections v0.4.0 + github.com/docker/go-connections v0.5.0 github.com/stretchr/testify v1.8.4 github.com/testcontainers/testcontainers-go v0.27.0 ) @@ -33,7 +33,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/go-units v0.5.0 // indirect - github.com/dvsekhvalnov/jose2go v1.5.0 // indirect + github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -76,7 +76,7 @@ require ( golang.org/x/mod v0.11.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.10.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/term v0.13.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/modules/pulsar/go.sum b/modules/pulsar/go.sum index 07668ecd62..7de947d2b9 100644 --- a/modules/pulsar/go.sum +++ b/modules/pulsar/go.sum @@ -104,13 +104,13 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= -github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= +github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= +github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -515,8 +515,9 @@ golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= diff --git a/modules/pulsar/pulsar_test.go b/modules/pulsar/pulsar_test.go index bc7975a82c..64f0ca39bd 100644 --- a/modules/pulsar/pulsar_test.go +++ b/modules/pulsar/pulsar_test.go @@ -101,10 +101,10 @@ func TestPulsar(t *testing.T) { ctx, tt.opts..., ) - require.Nil(t, err) + require.NoError(t, err) defer func() { err := c.Terminate(ctx) - require.Nil(t, err) + require.NoError(t, err) }() // withLogConsumers { @@ -120,12 +120,12 @@ func TestPulsar(t *testing.T) { // getBrokerURL { brokerURL, err := c.BrokerURL(ctx) // } - require.Nil(t, err) + require.NoError(t, err) // getAdminURL { serviceURL, err := c.HTTPServiceURL(ctx) // } - require.Nil(t, err) + require.NoError(t, err) assert.True(t, strings.HasPrefix(brokerURL, "pulsar://")) assert.True(t, strings.HasPrefix(serviceURL, "http://")) @@ -135,7 +135,7 @@ func TestPulsar(t *testing.T) { OperationTimeout: 30 * time.Second, ConnectionTimeout: 30 * time.Second, }) - require.Nil(t, err) + require.NoError(t, err) t.Cleanup(func() { pc.Close() }) subscriptionName := "pulsar-test" @@ -145,7 +145,7 @@ func TestPulsar(t *testing.T) { SubscriptionName: subscriptionName, Type: pulsar.Exclusive, }) - require.Nil(t, err) + require.NoError(t, err) t.Cleanup(func() { consumer.Close() }) msgChan := make(chan []byte) @@ -166,12 +166,12 @@ func TestPulsar(t *testing.T) { producer, err := pc.CreateProducer(pulsar.ProducerOptions{ Topic: "test-topic", }) - require.Nil(t, err) + require.NoError(t, err) _, err = producer.Send(ctx, &pulsar.ProducerMessage{ Payload: []byte("hello world"), }) - require.Nil(t, err) + require.NoError(t, err) ticker := time.NewTicker(1 * time.Minute) select { @@ -189,15 +189,15 @@ func TestPulsar(t *testing.T) { } resp, err := httpClient.Get(serviceURL + "/admin/v2/persistent/public/default/test-topic/stats") - require.Nil(t, err) + require.NoError(t, err) defer resp.Body.Close() body, err := io.ReadAll(resp.Body) - require.Nil(t, err) + require.NoError(t, err) var stats map[string]interface{} err = json.Unmarshal(body, &stats) - require.Nil(t, err) + require.NoError(t, err) subscriptions := stats["subscriptions"] require.NotNil(t, subscriptions) diff --git a/modules/rabbitmq/examples_test.go b/modules/rabbitmq/examples_test.go index b3b585063f..95ff7861dc 100644 --- a/modules/rabbitmq/examples_test.go +++ b/modules/rabbitmq/examples_test.go @@ -18,7 +18,7 @@ func ExampleRunContainer() { ctx := context.Background() rabbitmqContainer, err := rabbitmq.RunContainer(ctx, - testcontainers.WithImage("rabbitmq:3.7.25-management-alpine"), + testcontainers.WithImage("rabbitmq:3.12.11-management-alpine"), rabbitmq.WithAdminUsername("admin"), rabbitmq.WithAdminPassword("password"), ) diff --git a/modules/rabbitmq/go.mod b/modules/rabbitmq/go.mod index 8413528843..b1f1a00667 100644 --- a/modules/rabbitmq/go.mod +++ b/modules/rabbitmq/go.mod @@ -3,7 +3,7 @@ module github.com/testcontainers/testcontainers-go/modules/rabbitmq go 1.20 require ( - github.com/docker/go-connections v0.4.0 + github.com/docker/go-connections v0.5.0 github.com/rabbitmq/amqp091-go v1.9.0 github.com/testcontainers/testcontainers-go v0.27.0 ) @@ -44,8 +44,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/rabbitmq/go.sum b/modules/rabbitmq/go.sum index 560e0a59d7..6cfcab0852 100644 --- a/modules/rabbitmq/go.sum +++ b/modules/rabbitmq/go.sum @@ -30,8 +30,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -141,7 +141,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -163,8 +162,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/rabbitmq/rabbitmq.go b/modules/rabbitmq/rabbitmq.go index 37330b68c2..9fb28212e1 100644 --- a/modules/rabbitmq/rabbitmq.go +++ b/modules/rabbitmq/rabbitmq.go @@ -69,7 +69,7 @@ func (c *RabbitMQContainer) HttpsURL(ctx context.Context) (string, error) { // RunContainer creates an instance of the RabbitMQ container type func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*RabbitMQContainer, error) { req := testcontainers.ContainerRequest{ - Image: "rabbitmq:3.7.25-management-alpine", + Image: "rabbitmq:3.12.11-management-alpine", Env: map[string]string{ "RABBITMQ_DEFAULT_USER": defaultUser, "RABBITMQ_DEFAULT_PASS": defaultPassword, diff --git a/modules/rabbitmq/rabbitmq_test.go b/modules/rabbitmq/rabbitmq_test.go index 648deecf4a..0c85c66607 100644 --- a/modules/rabbitmq/rabbitmq_test.go +++ b/modules/rabbitmq/rabbitmq_test.go @@ -7,15 +7,46 @@ import ( "strings" "testing" + amqp "github.com/rabbitmq/amqp091-go" + "github.com/testcontainers/testcontainers-go" "github.com/testcontainers/testcontainers-go/modules/rabbitmq" ) +func TestRunContainer_connectUsingAmqp(t *testing.T) { + ctx := context.Background() + + rabbitmqContainer, err := rabbitmq.RunContainer(ctx) + if err != nil { + t.Fatal(err) + } + + defer func() { + if err := rabbitmqContainer.Terminate(ctx); err != nil { + t.Fatal(err) + } + }() + + amqpURL, err := rabbitmqContainer.AmqpURL(ctx) + if err != nil { + t.Fatal(err) + } + + amqpConnection, err := amqp.Dial(amqpURL) + if err != nil { + t.Fatal(err) + } + + if err = amqpConnection.Close(); err != nil { + t.Fatal(err) + } +} + func TestRunContainer_withAllSettings(t *testing.T) { ctx := context.Background() rabbitmqContainer, err := rabbitmq.RunContainer(ctx, - testcontainers.WithImage("rabbitmq:3.7.25-management-alpine"), + testcontainers.WithImage("rabbitmq:3.12.11-management-alpine"), // addVirtualHosts { testcontainers.WithAfterReadyCommand(VirtualHost{Name: "vhost1"}), testcontainers.WithAfterReadyCommand(VirtualHostLimit{VHost: "vhost1", Name: "max-connections", Value: 1}), diff --git a/modules/redis/go.mod b/modules/redis/go.mod index d86cae2b31..fceba3eab4 100644 --- a/modules/redis/go.mod +++ b/modules/redis/go.mod @@ -26,7 +26,7 @@ require ( github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.7+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -52,8 +52,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/redis/go.sum b/modules/redis/go.sum index 40de339c1d..684f9a2a3d 100644 --- a/modules/redis/go.sum +++ b/modules/redis/go.sum @@ -34,8 +34,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -149,7 +149,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -171,8 +170,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/redis/redis_test.go b/modules/redis/redis_test.go index ec7d7be735..86d123dd8e 100644 --- a/modules/redis/redis_test.go +++ b/modules/redis/redis_test.go @@ -127,7 +127,9 @@ func assertSetsGets(t *testing.T, ctx context.Context, redisContainer *RedisCont require.NoError(t, err) client := redis.NewClient(options) - defer flushRedis(ctx, *client) + defer func(t *testing.T, ctx context.Context, client *redis.Client) { + require.NoError(t, flushRedis(ctx, *client)) + }(t, ctx, client) t.Log("pinging redis") pong, err := client.Ping(ctx).Result() diff --git a/modules/redis/testdata/Dockerfile b/modules/redis/testdata/Dockerfile index bf302c6240..7157611a13 100644 --- a/modules/redis/testdata/Dockerfile +++ b/modules/redis/testdata/Dockerfile @@ -1 +1 @@ -FROM docker.io/redis:5.0-alpine \ No newline at end of file +FROM docker.io/redis:5.0-alpine@sha256:1a3c609295332f1ce603948142a132656c92a08149d7096e203058533c415b8c diff --git a/modules/redpanda/go.mod b/modules/redpanda/go.mod index 8423242d79..69767f7a45 100644 --- a/modules/redpanda/go.mod +++ b/modules/redpanda/go.mod @@ -3,7 +3,7 @@ module github.com/testcontainers/testcontainers-go/modules/redpanda go 1.20 require ( - github.com/docker/go-connections v0.4.0 + github.com/docker/go-connections v0.5.0 github.com/stretchr/testify v1.8.4 github.com/testcontainers/testcontainers-go v0.27.0 github.com/twmb/franz-go v1.15.4 @@ -51,8 +51,7 @@ require ( golang.org/x/crypto v0.17.0 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/grpc v1.58.3 // indirect diff --git a/modules/redpanda/go.sum b/modules/redpanda/go.sum index b2c5bf0113..765eae1ebe 100644 --- a/modules/redpanda/go.sum +++ b/modules/redpanda/go.sum @@ -30,8 +30,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -149,7 +149,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -171,8 +170,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/redpanda/mounts/redpanda.yaml.tpl b/modules/redpanda/mounts/redpanda.yaml.tpl index a19d21ce19..935e1923ef 100644 --- a/modules/redpanda/mounts/redpanda.yaml.tpl +++ b/modules/redpanda/mounts/redpanda.yaml.tpl @@ -19,6 +19,13 @@ redpanda: port: 9093 authentication_method: {{ if .KafkaAPI.EnableAuthorization }}sasl{{ else }}none{{ end }} + {{ range .KafkaAPI.Listeners }} + - address: 0.0.0.0 + name: {{ .Address }} + port: {{ .Port }} + authentication_method: {{ .AuthenticationMethod }} + {{ end }} + advertised_kafka_api: - address: {{ .KafkaAPI.AdvertisedHost }} name: external @@ -26,6 +33,12 @@ redpanda: - address: 127.0.0.1 name: internal port: 9093 + {{ range .KafkaAPI.Listeners }} + - address: {{ .Address }} + name: {{ .Address }} + port: {{ .Port }} + {{ end }} + {{ if .EnableTLS }} admin_api_tls: diff --git a/modules/redpanda/options.go b/modules/redpanda/options.go index 379492b95d..1d4afcf8af 100644 --- a/modules/redpanda/options.go +++ b/modules/redpanda/options.go @@ -1,6 +1,11 @@ package redpanda -import "github.com/testcontainers/testcontainers-go" +import ( + "net" + "strconv" + + "github.com/testcontainers/testcontainers-go" +) type options struct { // Superusers is a list of service account names. @@ -29,7 +34,12 @@ type options struct { // EnableTLS is a flag to enable TLS. EnableTLS bool + cert, key []byte + + // Listeners is a list of custom listeners that can be provided to access the + // containers form within docker networks + Listeners []listener } func defaultOptions() options { @@ -41,6 +51,7 @@ func defaultOptions() options { ServiceAccounts: make(map[string]string, 0), AutoCreateTopics: false, EnableTLS: false, + Listeners: make([]listener, 0), } } @@ -86,6 +97,8 @@ func WithEnableKafkaAuthorization() Option { } } +// WithEnableSchemaRegistryHTTPBasicAuth enables HTTP basic authentication for +// Schema Registry. func WithEnableSchemaRegistryHTTPBasicAuth() Option { return func(o *options) { o.SchemaRegistryAuthenticationMethod = "http_basic" @@ -106,3 +119,27 @@ func WithTLS(cert, key []byte) Option { o.key = key } } + +// WithListener adds a custom listener to the Redpanda containers. Listener +// will be aliases to all networks, so they can be accessed from within docker +// networks. At leas one network must be attached to the container, if not an +// error will be thrown when starting the container. +func WithListener(lis string) Option { + host, port, err := net.SplitHostPort(lis) + if err != nil { + return func(o *options) {} + } + + portInt, err := strconv.Atoi(port) + if err != nil { + return func(o *options) {} + } + + return func(o *options) { + o.Listeners = append(o.Listeners, listener{ + Address: host, + Port: portInt, + AuthenticationMethod: o.KafkaAuthenticationMethod, + }) + } +} diff --git a/modules/redpanda/redpanda.go b/modules/redpanda/redpanda.go index fd885fbc07..3a30a24e75 100644 --- a/modules/redpanda/redpanda.go +++ b/modules/redpanda/redpanda.go @@ -5,6 +5,7 @@ import ( "context" _ "embed" "fmt" + "math" "os" "path/filepath" "text/template" @@ -31,6 +32,7 @@ const ( defaultKafkaAPIPort = "9092/tcp" defaultAdminAPIPort = "9644/tcp" defaultSchemaRegistryPort = "8081/tcp" + defaultDockerKafkaApiPort = "29092" redpandaDir = "/etc/redpanda" entrypointFile = "/entrypoint-tc.sh" @@ -98,6 +100,12 @@ func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomize return nil, fmt.Errorf("failed to create entrypoint file: %w", err) } + // 4. Register extra kafka listeners if provided, network aliases will be + // set + if err := registerListeners(ctx, settings, req); err != nil { + return nil, fmt.Errorf("failed to register listeners: %w", err) + } + // Bootstrap config file contains cluster configurations which will only be considered // the very first time you start a cluster. bootstrapConfigPath := filepath.Join(tmpDir, bootstrapConfigFile) @@ -122,7 +130,7 @@ func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomize }, ) - // 4. Create certificate and key for TLS connections. + // 5. Create certificate and key for TLS connections. if settings.EnableTLS { certPath := filepath.Join(tmpDir, certFile) if err := os.WriteFile(certPath, settings.cert, 0o600); err != nil { @@ -152,7 +160,7 @@ func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomize return nil, err } - // 5. Get mapped port for the Kafka API, so that we can render and then mount + // 6. Get mapped port for the Kafka API, so that we can render and then mount // the Redpanda config with the advertised Kafka address. hostIP, err := container.Host(ctx) if err != nil { @@ -164,7 +172,7 @@ func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomize return nil, fmt.Errorf("failed to get mapped Kafka port: %w", err) } - // 6. Render redpanda.yaml config and mount it. + // 7. Render redpanda.yaml config and mount it. nodeConfig, err := renderNodeConfig(settings, hostIP, kafkaPort.Int()) if err != nil { return nil, fmt.Errorf("failed to render node config: %w", err) @@ -175,7 +183,7 @@ func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomize return nil, fmt.Errorf("failed to copy redpanda.yaml into container: %w", err) } - // 6. Wait until Redpanda is ready to serve requests + // 8. Wait until Redpanda is ready to serve requests err = wait.ForAll( wait.ForListeningPort(defaultKafkaAPIPort), wait.ForLog("Successfully started Redpanda!").WithPollInterval(100*time.Millisecond)). @@ -185,7 +193,7 @@ func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomize return nil, fmt.Errorf("failed to wait for Redpanda readiness: %w", err) } - // 7. Create Redpanda Service Accounts if configured to do so. + // 9. Create Redpanda Service Accounts if configured to do so. if len(settings.ServiceAccounts) > 0 { adminAPIPort, err := container.MappedPort(ctx, nat.Port(defaultAdminAPIPort)) if err != nil { @@ -252,6 +260,29 @@ func renderBootstrapConfig(settings options) ([]byte, error) { return bootstrapConfig.Bytes(), nil } +// registerListeners validates that the provided listeners are valid and set network aliases for the provided addresses. +// The container must be attached to at least one network. +func registerListeners(ctx context.Context, settings options, req testcontainers.GenericContainerRequest) error { + if len(settings.Listeners) == 0 { + return nil + } + + if len(req.Networks) == 0 { + return fmt.Errorf("container must be attached to at least one network") + } + + for _, listener := range settings.Listeners { + if listener.Port < 0 || listener.Port > math.MaxUint16 { + return fmt.Errorf("invalid port on listener %s:%d (must be between 0 and 65535)", listener.Address, listener.Port) + } + + for _, network := range req.Networks { + req.NetworkAliases[network] = append(req.NetworkAliases[network], listener.Address) + } + } + return nil +} + // renderNodeConfig renders the redpanda.yaml node config and returns it as // byte array. func renderNodeConfig(settings options, hostIP string, advertisedKafkaPort int) ([]byte, error) { @@ -262,6 +293,7 @@ func renderNodeConfig(settings options, hostIP string, advertisedKafkaPort int) AdvertisedPort: advertisedKafkaPort, AuthenticationMethod: settings.KafkaAuthenticationMethod, EnableAuthorization: settings.KafkaEnableAuthorization, + Listeners: settings.Listeners, }, SchemaRegistry: redpandaConfigTplParamsSchemaRegistry{ AuthenticationMethod: settings.SchemaRegistryAuthenticationMethod, @@ -300,8 +332,15 @@ type redpandaConfigTplParamsKafkaAPI struct { AdvertisedPort int AuthenticationMethod string EnableAuthorization bool + Listeners []listener } type redpandaConfigTplParamsSchemaRegistry struct { AuthenticationMethod string } + +type listener struct { + Address string + Port int + AuthenticationMethod string +} diff --git a/modules/redpanda/redpanda_test.go b/modules/redpanda/redpanda_test.go index 7ad424b3bd..f33ac4221b 100644 --- a/modules/redpanda/redpanda_test.go +++ b/modules/redpanda/redpanda_test.go @@ -5,6 +5,7 @@ import ( "crypto/tls" "crypto/x509" "fmt" + "io" "net/http" "strings" "testing" @@ -16,6 +17,9 @@ import ( "github.com/twmb/franz-go/pkg/kerr" "github.com/twmb/franz-go/pkg/kgo" "github.com/twmb/franz-go/pkg/sasl/scram" + + "github.com/testcontainers/testcontainers-go" + "github.com/testcontainers/testcontainers-go/network" ) func TestRedpanda(t *testing.T) { @@ -137,7 +141,7 @@ func TestRedpandaWithAuthentication(t *testing.T) { kafkaAdmCl := kadm.NewClient(kafkaCl) _, err = kafkaAdmCl.CreateTopic(ctx, 1, 1, nil, "test-2") require.Error(t, err) - assert.ErrorContains(t, err, "TOPIC_AUTHORIZATION_FAILED") + require.ErrorContains(t, err, "TOPIC_AUTHORIZATION_FAILED") kafkaCl.Close() } @@ -155,7 +159,7 @@ func TestRedpandaWithAuthentication(t *testing.T) { kafkaAdmCl := kadm.NewClient(kafkaCl) _, err = kafkaAdmCl.Metadata(ctx) require.Error(t, err) - assert.ErrorContains(t, err, "SASL_AUTHENTICATION_FAILED") + require.ErrorContains(t, err, "SASL_AUTHENTICATION_FAILED") } // Test Schema Registry API @@ -278,6 +282,119 @@ func TestRedpandaWithTLS(t *testing.T) { require.Error(t, results.FirstErr(), kerr.UnknownTopicOrPartition) } +func TestRedpandaListener_Simple(t *testing.T) { + ctx := context.Background() + + // 1. Create network + rpNetwork, err := network.New(ctx, network.WithCheckDuplicate()) + require.NoError(t, err) + + // 2. Start Redpanda container + // withListenerRP { + container, err := RunContainer(ctx, + testcontainers.WithImage("redpandadata/redpanda:v23.2.18"), + network.WithNetwork([]string{"redpanda-host"}, rpNetwork), + WithListener("redpanda:29092"), WithAutoCreateTopics(), + ) + // } + require.NoError(t, err) + + // 3. Start KCat container + // withListenerKcat { + kcat, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{ + ContainerRequest: testcontainers.ContainerRequest{ + Image: "confluentinc/cp-kcat:7.4.1", + Networks: []string{ + rpNetwork.Name, + }, + Entrypoint: []string{ + "sh", + }, + Cmd: []string{ + "-c", + "tail -f /dev/null", + }, + }, + Started: true, + }) + // } + + require.NoError(t, err) + + // 4. Copy message to kcat + err = kcat.CopyToContainer(ctx, []byte("Message produced by kcat"), "/tmp/msgs.txt", 700) + require.NoError(t, err) + + // 5. Produce message to Redpanda + // withListenerExec { + _, _, err = kcat.Exec(ctx, []string{"kcat", "-b", "redpanda:29092", "-t", "msgs", "-P", "-l", "/tmp/msgs.txt"}) + // } + + require.NoError(t, err) + + // 6. Consume message from Redpanda + _, stdout, err := kcat.Exec(ctx, []string{"kcat", "-b", "redpanda:29092", "-C", "-t", "msgs", "-c", "1"}) + require.NoError(t, err) + + // 7. Read Message from stdout + out, err := io.ReadAll(stdout) + require.NoError(t, err) + + require.Contains(t, string(out), "Message produced by kcat") + + t.Cleanup(func() { + if err := kcat.Terminate(ctx); err != nil { + t.Fatalf("failed to terminate kcat container: %s", err) + } + if err := container.Terminate(ctx); err != nil { + t.Fatalf("failed to terminate redpanda container: %s", err) + } + + if err := rpNetwork.Remove(ctx); err != nil { + t.Fatalf("failed to remove network: %s", err) + } + }) +} + +func TestRedpandaListener_InvalidPort(t *testing.T) { + ctx := context.Background() + + // 1. Create network + RPNetwork, err := network.New(ctx, network.WithCheckDuplicate()) + require.NoError(t, err) + + // 2. Attempt Start Redpanda container + _, err = RunContainer(ctx, + testcontainers.WithImage("redpandadata/redpanda:v23.2.18"), + WithListener("redpanda:99092"), + network.WithNetwork([]string{"redpanda-host"}, RPNetwork), + ) + + require.Error(t, err) + + require.Contains(t, err.Error(), "invalid port on listener redpanda:99092") + + t.Cleanup(func() { + if err := RPNetwork.Remove(ctx); err != nil { + t.Fatalf("failed to remove network: %s", err) + } + }) +} + +func TestRedpandaListener_NoNetwork(t *testing.T) { + ctx := context.Background() + + // 1. Attempt Start Redpanda container + _, err := RunContainer(ctx, + testcontainers.WithImage("redpandadata/redpanda:v23.2.18"), + WithListener("redpanda:99092"), + ) + + require.Error(t, err) + + require.Contains(t, err.Error(), "container must be attached to at least one network") +} + // localhostCert is a PEM-encoded TLS cert with SAN IPs // generated from src/crypto/tls: // go run generate_cert.go --rsa-bits 2048 --host 127.0.0.1,::1,localhost --ca --start-date "Jan 1 00:00:00 1970" --duration=1000000h diff --git a/modules/vault/go.mod b/modules/vault/go.mod index cb4833dd41..d2ff582534 100644 --- a/modules/vault/go.mod +++ b/modules/vault/go.mod @@ -21,7 +21,7 @@ require ( 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/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -58,8 +58,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect diff --git a/modules/vault/go.sum b/modules/vault/go.sum index 43642ce4f2..0561520f0d 100644 --- a/modules/vault/go.sum +++ b/modules/vault/go.sum @@ -30,8 +30,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3 github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+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-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.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= @@ -166,7 +166,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -188,8 +187,9 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc 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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= diff --git a/modules/vault/vault_test.go b/modules/vault/vault_test.go index 558884c8ca..d068827fdc 100644 --- a/modules/vault/vault_test.go +++ b/modules/vault/vault_test.go @@ -11,6 +11,7 @@ import ( vaultClient "github.com/hashicorp/vault-client-go" "github.com/hashicorp/vault-client-go/schema" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/tidwall/gjson" "github.com/testcontainers/testcontainers-go" @@ -37,12 +38,12 @@ func TestVault(t *testing.T) { } vaultContainer, err := testcontainervault.RunContainer(ctx, opts...) - assert.Nil(t, err) + require.NoError(t, err) // httpHostAddress { hostAddress, err := vaultContainer.HttpHostAddress(ctx) // } - assert.Nil(t, err) + require.NoError(t, err) t.Run("Get secret path", func(t *testing.T) { t.Run("From vault CLI", func(t *testing.T) { @@ -51,11 +52,11 @@ func TestVault(t *testing.T) { // containerCliRead { exec, reader, err := vaultContainer.Exec(ctx, []string{"vault", "kv", "get", "-format=json", "secret/test1"}) // } - assert.Nil(t, err) + require.NoError(t, err) assert.Equal(t, 0, exec) bytes, err := io.ReadAll(reader) - assert.Nil(t, err) + require.NoError(t, err) assert.Equal(t, "bar1", gjson.Get(string(bytes), "data.data.foo1").String()) }) @@ -67,11 +68,11 @@ func TestVault(t *testing.T) { response, err := http.DefaultClient.Do(request) // } - assert.Nil(t, err) + require.NoError(t, err) defer response.Body.Close() body, err := io.ReadAll(response.Body) - assert.Nil(t, err) + require.NoError(t, err) assert.Equal(t, "bar1", gjson.Get(string(body), "data.data.foo1").String()) }) @@ -84,14 +85,14 @@ func TestVault(t *testing.T) { vaultClient.WithAddress(hostAddress), vaultClient.WithRequestTimeout(30*time.Second), ) - assert.Nil(t, err) + require.NoError(t, err) err = client.SetToken(token) - assert.Nil(t, err) + require.NoError(t, err) s, err := client.Secrets.KvV2Read(ctx, "test1", vaultClient.WithMountPath("secret")) // } - assert.Nil(t, err) + require.NoError(t, err) assert.Equal(t, "bar1", s.Data.Data["foo1"]) }) }) @@ -102,10 +103,10 @@ func TestVault(t *testing.T) { vaultClient.WithAddress(hostAddress), vaultClient.WithRequestTimeout(30*time.Second), ) - assert.Nil(t, err) + require.NoError(t, err) err = client.SetToken(token) - assert.Nil(t, err) + require.NoError(t, err) _, err = client.Secrets.KvV2Write(ctx, "test3", schema.KvV2WriteRequest{ Data: map[string]any{ @@ -113,10 +114,10 @@ func TestVault(t *testing.T) { }, }, vaultClient.WithMountPath("secret")) - assert.Nil(t, err) + require.NoError(t, err) s, err := client.Secrets.KvV2Read(ctx, "test3", vaultClient.WithMountPath("secret")) - assert.Nil(t, err) + require.NoError(t, err) assert.Equal(t, "bar", s.Data.Data["foo"]) }) }) diff --git a/mounts_test.go b/mounts_test.go index 1dd1bbf646..fe7bd4f02e 100644 --- a/mounts_test.go +++ b/mounts_test.go @@ -6,6 +6,7 @@ import ( "github.com/docker/docker/api/types/mount" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestVolumeMount(t *testing.T) { @@ -180,15 +181,15 @@ func TestCreateContainerWithVolume(t *testing.T) { ContainerRequest: req, Started: true, }) - assert.NoError(t, err) + require.NoError(t, err) terminateContainerOnEnd(t, ctx, c) // Check if volume is created client, err := NewDockerClientWithOpts(ctx) - assert.NoError(t, err) + require.NoError(t, err) defer client.Close() volume, err := client.VolumeInspect(ctx, "test-volume") - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, "test-volume", volume.Name) } diff --git a/network/network_test.go b/network/network_test.go index a75e7c3a61..69cc2a7dee 100644 --- a/network/network_test.go +++ b/network/network_test.go @@ -241,10 +241,10 @@ func TestContainerWithReaperNetwork(t *testing.T) { for i := 0; i < maxNetworksCount; i++ { n, err := network.New(ctx) - assert.Nil(t, err) + require.NoError(t, err) // use t.Cleanup to run after terminateContainerOnEnd t.Cleanup(func() { - assert.NoError(t, n.Remove(ctx)) + require.NoError(t, n.Remove(ctx)) }) networks = append(networks, n.Name) @@ -273,12 +273,12 @@ func TestContainerWithReaperNetwork(t *testing.T) { containerId := nginx.GetContainerID() cli, err := testcontainers.NewDockerClientWithOpts(ctx) - assert.Nil(t, err) + require.NoError(t, err) defer cli.Close() cnt, err := cli.ContainerInspect(ctx, containerId) - assert.Nil(t, err) - assert.Equal(t, maxNetworksCount, len(cnt.NetworkSettings.Networks)) + require.NoError(t, err) + assert.Len(t, cnt.NetworkSettings.Networks, maxNetworksCount) assert.NotNil(t, cnt.NetworkSettings.Networks[networks[0]]) assert.NotNil(t, cnt.NetworkSettings.Networks[networks[1]]) } @@ -334,8 +334,8 @@ func TestMultipleContainersInTheNewNetwork(t *testing.T) { rNets, err := c2.Networks(ctx) require.NoError(t, err) - assert.Equal(t, 1, len(pNets)) - assert.Equal(t, 1, len(rNets)) + assert.Len(t, pNets, 1) + assert.Len(t, rNets, 1) assert.Equal(t, networkName, pNets[0]) assert.Equal(t, networkName, rNets[0]) @@ -422,10 +422,10 @@ func TestWithNetwork(t *testing.T) { network.WithNetwork([]string{"alias"}, nw)(&req) - assert.Equal(t, 1, len(req.Networks)) + assert.Len(t, req.Networks, 1) assert.Equal(t, networkName, req.Networks[0]) - assert.Equal(t, 1, len(req.NetworkAliases)) + assert.Len(t, req.NetworkAliases, 1) assert.Equal(t, map[string][]string{networkName: {"alias"}}, req.NetworkAliases) } @@ -468,10 +468,10 @@ func TestWithSyntheticNetwork(t *testing.T) { network.WithNetwork([]string{"alias"}, nw)(&req) - assert.Equal(t, 1, len(req.Networks)) + assert.Len(t, req.Networks, 1) assert.Equal(t, networkName, req.Networks[0]) - assert.Equal(t, 1, len(req.NetworkAliases)) + assert.Len(t, req.NetworkAliases, 1) assert.Equal(t, map[string][]string{networkName: {"alias"}}, req.NetworkAliases) // verify that the network is created only once @@ -485,7 +485,7 @@ func TestWithSyntheticNetwork(t *testing.T) { Filters: args, }) require.NoError(t, err) - assert.Len(t, resources, 0) // no Docker network was created + assert.Empty(t, resources) // no Docker network was created c, err := testcontainers.GenericContainer(context.Background(), req) require.NoError(t, err) @@ -506,11 +506,11 @@ func TestWithNewNetwork(t *testing.T) { network.WithLabels(map[string]string{"this-is-a-test": "value"}), )(&req) - assert.Equal(t, 1, len(req.Networks)) + assert.Len(t, req.Networks, 1) networkName := req.Networks[0] - assert.Equal(t, 1, len(req.NetworkAliases)) + assert.Len(t, req.NetworkAliases, 1) assert.Equal(t, map[string][]string{networkName: {"alias"}}, req.NetworkAliases) client, err := testcontainers.NewDockerClientWithOpts(context.Background()) @@ -554,6 +554,6 @@ func TestWithNewNetworkContextTimeout(t *testing.T) { )(&req) // we do not want to fail, just skip the network creation - assert.Equal(t, 0, len(req.Networks)) - assert.Equal(t, 0, len(req.NetworkAliases)) + assert.Empty(t, req.Networks) + assert.Empty(t, req.NetworkAliases) } diff --git a/options_test.go b/options_test.go index 09da87286b..0599105659 100644 --- a/options_test.go +++ b/options_test.go @@ -53,7 +53,7 @@ func TestOverrideContainerRequest(t *testing.T) { // toBeMergedRequest should not be changed assert.Equal(t, "", toBeMergedRequest.Env["BAR"]) - assert.Equal(t, 1, len(toBeMergedRequest.ExposedPorts)) + assert.Len(t, toBeMergedRequest.ExposedPorts, 1) assert.Equal(t, "67890/tcp", toBeMergedRequest.ExposedPorts[0]) // req should be merged with toBeMergedRequest @@ -80,8 +80,8 @@ func TestWithStartupCommand(t *testing.T) { testcontainers.WithStartupCommand(testExec)(&req) - assert.Equal(t, 1, len(req.LifecycleHooks)) - assert.Equal(t, 1, len(req.LifecycleHooks[0].PostStarts)) + assert.Len(t, req.LifecycleHooks, 1) + assert.Len(t, req.LifecycleHooks[0].PostStarts, 1) c, err := testcontainers.GenericContainer(context.Background(), req) require.NoError(t, err) diff --git a/reaper.go b/reaper.go index b618ad3854..1d269ce899 100644 --- a/reaper.go +++ b/reaper.go @@ -15,6 +15,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/errdefs" "github.com/docker/go-connections/nat" "github.com/testcontainers/testcontainers-go/internal/config" @@ -141,13 +142,14 @@ func reuseOrCreateReaper(ctx context.Context, sessionID string, provider ReaperP // Can't use Container.IsRunning because the bool is not updated when Reaper is terminated state, err := reaperInstance.container.State(ctx) if err != nil { - return nil, err - } - - if state.Running { + if !errdefs.IsNotFound(err) { + return nil, err + } + } else if state.Running { return reaperInstance, nil } // else: the reaper instance has been terminated, so we need to create a new one + reaperOnce = sync.Once{} } // 2. because the reaper instance has not been created yet, look for it in the Docker daemon, which diff --git a/reaper_test.go b/reaper_test.go index d6b9cfe8f9..d0b6f4fc7c 100644 --- a/reaper_test.go +++ b/reaper_test.go @@ -435,7 +435,7 @@ func Test_NewReaper(t *testing.T) { _, err := reuseOrCreateReaper(test.ctx, testSessionID, provider) // we should have errored out see mockReaperProvider.RunContainer - assert.EqualError(t, err, "expected") + require.EqualError(t, err, "expected") assert.Equal(t, test.req.Image, provider.req.Image, "expected image doesn't match the submitted request") assert.Equal(t, test.req.ExposedPorts, provider.req.ExposedPorts, "expected exposed ports don't match the submitted request") @@ -446,7 +446,7 @@ func Test_NewReaper(t *testing.T) { // checks for reaper's preCreationCallback fields assert.Equal(t, container.NetworkMode(Bridge), provider.hostConfig.NetworkMode, "expected networkMode doesn't match the submitted request") - assert.Equal(t, true, provider.hostConfig.AutoRemove, "expected networkMode doesn't match the submitted request") + assert.True(t, provider.hostConfig.AutoRemove, "expected networkMode doesn't match the submitted request") }) } } @@ -469,10 +469,10 @@ func Test_ReaperReusedIfHealthy(t *testing.T) { provider, _ := ProviderDocker.GetProvider() reaper, err := reuseOrCreateReaper(context.WithValue(ctx, core.DockerHostContextKey, provider.(*DockerProvider).host), testSessionID, provider) - assert.NoError(t, err, "creating the Reaper should not error") + require.NoError(t, err, "creating the Reaper should not error") reaperReused, err := reuseOrCreateReaper(context.WithValue(ctx, core.DockerHostContextKey, provider.(*DockerProvider).host), testSessionID, provider) - assert.NoError(t, err, "reusing the Reaper should not error") + require.NoError(t, err, "reusing the Reaper should not error") // assert that the internal state of both reaper instances is the same assert.Equal(t, reaper.SessionID, reaperReused.SessionID, "expecting the same SessionID") assert.Equal(t, reaper.Endpoint, reaperReused.Endpoint, "expecting the same reaper endpoint") @@ -484,13 +484,49 @@ func Test_ReaperReusedIfHealthy(t *testing.T) { defer func(term chan bool) { term <- true }(terminate) - assert.NoError(t, err, "connecting to Reaper should be successful") + require.NoError(t, err, "connecting to Reaper should be successful") if !wasReaperRunning { terminateContainerOnEnd(t, ctx, reaper.container) } } +func Test_RecreateReaperIfTerminated(t *testing.T) { + config.Reset() // reset the config using the internal method to avoid the sync.Once + tcConfig := config.Read() + if tcConfig.RyukDisabled { + t.Skip("Ryuk is disabled, skipping test") + } + + mockProvider := newMockReaperProvider(t) + t.Cleanup(mockProvider.RestoreReaperState) + + SkipIfProviderIsNotHealthy(&testing.T{}) + + provider, _ := ProviderDocker.GetProvider() + ctx := context.Background() + reaper, err := reuseOrCreateReaper(context.WithValue(ctx, core.DockerHostContextKey, provider.(*DockerProvider).host), testSessionID, provider) + require.NoError(t, err, "creating the Reaper should not error") + + terminate, err := reaper.Connect() + require.NoError(t, err, "connecting to Reaper should be successful") + terminate <- true + + // Wait for ryuk's default timeout (10s) + 1s to allow for a graceful shutdown/cleanup of the container. + time.Sleep(11 * time.Second) + + recreatedReaper, err := reuseOrCreateReaper(context.WithValue(ctx, core.DockerHostContextKey, provider.(*DockerProvider).host), testSessionID, provider) + require.NoError(t, err, "creating the Reaper should not error") + assert.NotEqual(t, reaper.container.GetContainerID(), recreatedReaper.container.GetContainerID(), "expected different container ID") + + terminate, err = recreatedReaper.Connect() + defer func(term chan bool) { + term <- true + }(terminate) + require.NoError(t, err, "connecting to Reaper should be successful") + terminateContainerOnEnd(t, ctx, recreatedReaper.container) +} + func TestReaper_reuseItFromOtherTestProgramUsingDocker(t *testing.T) { config.Reset() // reset the config using the internal method to avoid the sync.Once tcConfig := config.Read() @@ -518,14 +554,14 @@ func TestReaper_reuseItFromOtherTestProgramUsingDocker(t *testing.T) { provider, _ := ProviderDocker.GetProvider() reaper, err := reuseOrCreateReaper(context.WithValue(ctx, core.DockerHostContextKey, provider.(*DockerProvider).host), testSessionID, provider) - assert.NoError(t, err, "creating the Reaper should not error") + require.NoError(t, err, "creating the Reaper should not error") // explicitly reset the reaperInstance to nil to simulate another test program in the same session accessing the same reaper reaperInstance = nil reaperOnce = sync.Once{} reaperReused, err := reuseOrCreateReaper(context.WithValue(ctx, core.DockerHostContextKey, provider.(*DockerProvider).host), testSessionID, provider) - assert.NoError(t, err, "reusing the Reaper should not error") + require.NoError(t, err, "reusing the Reaper should not error") // assert that the internal state of both reaper instances is the same assert.Equal(t, reaper.SessionID, reaperReused.SessionID, "expecting the same SessionID") assert.Equal(t, reaper.Endpoint, reaperReused.Endpoint, "expecting the same reaper endpoint") @@ -537,7 +573,7 @@ func TestReaper_reuseItFromOtherTestProgramUsingDocker(t *testing.T) { defer func(term chan bool) { term <- true }(terminate) - assert.NoError(t, err, "connecting to Reaper should be successful") + require.NoError(t, err, "connecting to Reaper should be successful") if !wasReaperRunning { terminateContainerOnEnd(t, ctx, reaper.container) diff --git a/sonar-project.properties b/sonar-project.properties index 8a28073392..8296154d13 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -18,4 +18,4 @@ sonar.test.inclusions=**/*_test.go sonar.test.exclusions=**/vendor/** sonar.go.coverage.reportPaths=**/coverage.out -sonar.go.tests.reportPaths=TEST-unit.xml,examples/cockroachdb/TEST-unit.xml,examples/consul/TEST-unit.xml,examples/nginx/TEST-unit.xml,examples/toxiproxy/TEST-unit.xml,modulegen/TEST-unit.xml,modules/artemis/TEST-unit.xml,modules/cassandra/TEST-unit.xml,modules/clickhouse/TEST-unit.xml,modules/compose/TEST-unit.xml,modules/couchbase/TEST-unit.xml,modules/elasticsearch/TEST-unit.xml,modules/gcloud/TEST-unit.xml,modules/k3s/TEST-unit.xml,modules/k6/TEST-unit.xml,modules/kafka/TEST-unit.xml,modules/localstack/TEST-unit.xml,modules/mariadb/TEST-unit.xml,modules/mongodb/TEST-unit.xml,modules/mssql/TEST-unit.xml,modules/mysql/TEST-unit.xml,modules/nats/TEST-unit.xml,modules/neo4j/TEST-unit.xml,modules/postgres/TEST-unit.xml,modules/pulsar/TEST-unit.xml,modules/rabbitmq/TEST-unit.xml,modules/redis/TEST-unit.xml,modules/redpanda/TEST-unit.xml,modules/vault/TEST-unit.xml +sonar.go.tests.reportPaths=TEST-unit.xml,examples/cockroachdb/TEST-unit.xml,examples/consul/TEST-unit.xml,examples/nginx/TEST-unit.xml,examples/toxiproxy/TEST-unit.xml,modulegen/TEST-unit.xml,modules/artemis/TEST-unit.xml,modules/cassandra/TEST-unit.xml,modules/clickhouse/TEST-unit.xml,modules/compose/TEST-unit.xml,modules/couchbase/TEST-unit.xml,modules/elasticsearch/TEST-unit.xml,modules/gcloud/TEST-unit.xml,modules/k3s/TEST-unit.xml,modules/k6/TEST-unit.xml,modules/kafka/TEST-unit.xml,modules/localstack/TEST-unit.xml,modules/mariadb/TEST-unit.xml,modules/mockserver/TEST-unit.xml,modules/mongodb/TEST-unit.xml,modules/mssql/TEST-unit.xml,modules/mysql/TEST-unit.xml,modules/nats/TEST-unit.xml,modules/neo4j/TEST-unit.xml,modules/postgres/TEST-unit.xml,modules/pulsar/TEST-unit.xml,modules/rabbitmq/TEST-unit.xml,modules/redis/TEST-unit.xml,modules/redpanda/TEST-unit.xml,modules/vault/TEST-unit.xml diff --git a/testdata/Dockerfile b/testdata/Dockerfile index bf302c6240..7157611a13 100644 --- a/testdata/Dockerfile +++ b/testdata/Dockerfile @@ -1 +1 @@ -FROM docker.io/redis:5.0-alpine \ No newline at end of file +FROM docker.io/redis:5.0-alpine@sha256:1a3c609295332f1ce603948142a132656c92a08149d7096e203058533c415b8c diff --git a/wait/health_test.go b/wait/health_test.go index beafe33527..9f76fb7492 100644 --- a/wait/health_test.go +++ b/wait/health_test.go @@ -2,14 +2,13 @@ package wait import ( "context" - "errors" "io" "testing" "time" "github.com/docker/docker/api/types" "github.com/docker/go-connections/nat" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" tcexec "github.com/testcontainers/testcontainers-go/exec" ) @@ -54,8 +53,8 @@ func TestWaitForHealthTimesOutForUnhealthy(t *testing.T) { wg := NewHealthStrategy().WithStartupTimeout(100 * time.Millisecond) err := wg.WaitUntilReady(context.Background(), target) - assert.NotNil(t, err) - assert.True(t, errors.Is(err, context.DeadlineExceeded)) + require.Error(t, err) + require.ErrorIs(t, err, context.DeadlineExceeded) } // TestWaitForHealthSucceeds ensures that a healthy container always succeeds. @@ -69,7 +68,7 @@ func TestWaitForHealthSucceeds(t *testing.T) { wg := NewHealthStrategy().WithStartupTimeout(100 * time.Millisecond) err := wg.WaitUntilReady(context.Background(), target) - assert.Nil(t, err) + require.NoError(t, err) } // TestWaitForHealthWithNil checks that an initial `nil` Health will not cause a panic, @@ -93,7 +92,7 @@ func TestWaitForHealthWithNil(t *testing.T) { }(target) err := wg.WaitUntilReady(context.Background(), target) - assert.Nil(t, err) + require.NoError(t, err) } // TestWaitFailsForNilHealth checks that Health always nil fails (but will NOT cause a panic) @@ -109,8 +108,8 @@ func TestWaitFailsForNilHealth(t *testing.T) { WithPollInterval(100 * time.Millisecond) err := wg.WaitUntilReady(context.Background(), target) - assert.NotNil(t, err) - assert.True(t, errors.Is(err, context.DeadlineExceeded)) + require.Error(t, err) + require.ErrorIs(t, err, context.DeadlineExceeded) } func TestWaitForHealthFailsDueToOOMKilledContainer(t *testing.T) { @@ -124,8 +123,8 @@ func TestWaitForHealthFailsDueToOOMKilledContainer(t *testing.T) { WithPollInterval(100 * time.Millisecond) err := wg.WaitUntilReady(context.Background(), target) - assert.NotNil(t, err) - assert.EqualError(t, err, "container crashed with out-of-memory (OOMKilled)") + require.Error(t, err) + require.EqualError(t, err, "container crashed with out-of-memory (OOMKilled)") } func TestWaitForHealthFailsDueToExitedContainer(t *testing.T) { @@ -140,8 +139,8 @@ func TestWaitForHealthFailsDueToExitedContainer(t *testing.T) { WithPollInterval(100 * time.Millisecond) err := wg.WaitUntilReady(context.Background(), target) - assert.NotNil(t, err) - assert.EqualError(t, err, "container exited with code 1") + require.Error(t, err) + require.EqualError(t, err, "container exited with code 1") } func TestWaitForHealthFailsDueToUnexpectedContainerStatus(t *testing.T) { @@ -155,6 +154,6 @@ func TestWaitForHealthFailsDueToUnexpectedContainerStatus(t *testing.T) { WithPollInterval(100 * time.Millisecond) err := wg.WaitUntilReady(context.Background(), target) - assert.NotNil(t, err) - assert.EqualError(t, err, "unexpected container status \"dead\"") + require.Error(t, err) + require.EqualError(t, err, "unexpected container status \"dead\"") } diff --git a/wait/testdata/Dockerfile b/wait/testdata/Dockerfile index 512f09c8fc..ad92401796 100644 --- a/wait/testdata/Dockerfile +++ b/wait/testdata/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.18-alpine as builder +FROM golang:1.18-alpine@sha256:77f25981bd57e60a510165f3be89c901aec90453fd0f1c5a45691f6cb1528807 as builder WORKDIR /app COPY . . RUN mkdir -p dist