Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: github.com/testcontainers/testcontainers-go.SkipIfProviderIsNotHealthy panics on GHA macos-latest runners #2859

Open
RomainMuller opened this issue Oct 30, 2024 · 1 comment
Labels
bug An issue with the library

Comments

@RomainMuller
Copy link

RomainMuller commented Oct 30, 2024

Testcontainers version

0.34.0

Using the latest Testcontainers version?

Yes

Host OS

macOS

Host arch

x86, ARM64

Go version

1.22 / 1.23

Docker version

Docker is not available on macos-latest GitHub Actions runners.

Docker info

Docker is not available on macos-latest GitHub Actions runners.

What happened?

Attempting to skip tests on runners where Docker is not usable using github.com/testcontainers/testcontainers-go.SkipIfProviderIsNotHealthy; tests still fail on an unconditional panic on macos-latest runners in GitHub Actions.

Relevant log output

panic: rootless Docker not found [recovered]
	panic: rootless Docker not found

goroutine 53 [running]:
testing.tRunner.func1.2({0x102f964a0, 0x140001285d0})
	/Users/runner/hostedtoolcache/go/1.22.8/arm64/src/testing/testing.go:1631 +0x1c4
testing.tRunner.func1()
	/Users/runner/hostedtoolcache/go/1.22.8/arm64/src/testing/testing.go:1634 +0x33c
panic({0x102f964a0?, 0x140001285d0?})
	/Users/runner/hostedtoolcache/go/1.22.8/arm64/src/runtime/panic.go:770 +0x124
github.com/testcontainers/testcontainers-go/internal/core.MustExtractDockerHost.func1()
	/Users/runner/go/pkg/mod/github.com/testcontainers/[email protected]/internal/core/docker_host.go:91 +0x78
sync.(*Once).doSlow(0x0?, 0x0?)
	/Users/runner/hostedtoolcache/go/1.22.8/arm64/src/sync/once.go:74 +0x100
sync.(*Once).Do(...)
	/Users/runner/hostedtoolcache/go/1.22.8/arm64/src/sync/once.go:65
github.com/testcontainers/testcontainers-go/internal/core.MustExtractDockerHost({0x103092ec0?, 0x1035f0f80?})
	/Users/runner/go/pkg/mod/github.com/testcontainers/[email protected]/internal/core/docker_host.go:88 +0x5c
github.com/testcontainers/testcontainers-go/internal/core.NewClient({0x103092ec0, 0x1035f0f80}, {0x0, 0x0, 0x0?})
	/Users/runner/go/pkg/mod/github.com/testcontainers/[email protected]/internal/core/client.go:17 +0x9c
github.com/testcontainers/testcontainers-go.NewDockerClientWithOpts({0x103092ec0, 0x1035f0f80}, {0x0, 0x0, 0x0})
	/Users/runner/go/pkg/mod/github.com/testcontainers/[email protected]/docker_client.go:117 +0x4c
github.com/testcontainers/testcontainers-go.NewDockerProvider({0x14000a84c50, 0x1, 0x14000079bf8?})
	/Users/runner/go/pkg/mod/github.com/testcontainers/[email protected]/provider.go:143 +0x10c
github.com/testcontainers/testcontainers-go.ProviderType.GetProvider(0x1, {0x0, 0x0, 0x10288cd40?})
	/Users/runner/go/pkg/mod/github.com/testcontainers/[email protected]/provider.go:114 +0x394
github.com/testcontainers/testcontainers-go.SkipIfProviderIsNotHealthy(0x140007a6d00)
	/Users/runner/go/pkg/mod/github.com/testcontainers/[email protected]/testing.go:24 +0x38
datadoghq.dev/orchestrion/_integration-tests/utils.SkipIfProviderIsNotHealthy(0x140007a6d00)
	/Users/runner/work/orchestrion/orchestrion/_integration-tests/utils/testcontainers.go:103 +0xf0
datadoghq.dev/orchestrion/_integration-tests/tests/vault.(*TestCase).Setup(0x14000a84ba0, 0x140007a6d00)
	/Users/runner/work/orchestrion/orchestrion/_integration-tests/tests/vault/vault.go:30 +0xac
datadoghq.dev/orchestrion/_integration-tests/utils.RunTest(0x140007a6d00, {0x103092ef8, 0x14000a84ba0})
	/Users/runner/work/orchestrion/orchestrion/_integration-tests/utils/suite.go:63 +0x188
datadoghq.dev/orchestrion/_integration-tests/tests/vault.TestIntegration_vault(0x140007a6d00)
	/Users/runner/work/orchestrion/orchestrion/_integration-tests/tests/vault/gen_test.go:18 +0x3c
testing.tRunner(0x140007a6d00, 0x103085a78)
	/Users/runner/hostedtoolcache/go/1.22.8/arm64/src/testing/testing.go:1689 +0xec
created by testing.(*T).Run in goroutine 1
	/Users/runner/hostedtoolcache/go/1.22.8/arm64/src/testing/testing.go:1742 +0x320

Additional information

No response

@RomainMuller RomainMuller added the bug An issue with the library label Oct 30, 2024
@mdelapenya
Copy link
Member

Thanks for opening this issue, yeah the MustExtractDockerHost panics if no docker host/socket is discovered. I think that test helper could be improved to recover on panics and effectively skip the test in that case.

Would you like to work on a fix for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue with the library
Projects
None yet
Development

No branches or pull requests

2 participants