Testcontainers for Go is a Go package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers that should be run as part of a test and clean up those resources when the test is done.
In version 0.32.0 integration tests were passing with a KafkaContainer. In 0.33.0 the following lines in the Kafka module at the top of copyStarterScript result in the context deadline being exceeded and the test failing. If I remove them my tests pass again.
if err := wait.ForListeningPort(publicPort).
SkipInternalCheck().
WaitUntilReady(ctx, c); err != nil {
return fmt.Errorf("wait for exposed port: %w", err)
}
The Kafka container I am creating has the following properties:
The image for the container is confluentinc/confluent-local:7.7.0.
I suspect this may have to do with me using Colima on a Mac and host port mapping, what is confusing to me is that if I comment those lines out and pass the following in my container params then the tests still pass.
kafkaContainer, err := kafka.Run(ctx,
cfg.image,
kafka.WithClusterID(cfg.clusterId),
testcontainers.WithLogger(testcontainers.TestLogger(t)),
testcontainers.WithWaitStrategy(
wait.ForListeningPort("9093/tcp"),
wait.ForLog(".*Transitioning from RECOVERY to RUNNING.*").AsRegexp(),
),
)
Relevant log output
lifecycle.go:62: π³ Creating container for image postgres:15.3-alpine
lifecycle.go:68: β Container created: c6eaaf53bec4
lifecycle.go:74: π³ Starting container: c6eaaf53bec4
lifecycle.go:80: β Container started: c6eaaf53bec4
lifecycle.go:271: β³ Waiting for container id c6eaaf53bec4 image: postgres:15.3-alpine. Waiting for: &{timeout:<nil> deadline:0x1400059fc68 Strategies:[0x14000345410 0x14000345440]}
lifecycle.go:86: π Container is ready: c6eaaf53bec4
lifecycle.go:62: π³ Creating container for image confluentinc/confluent-local:7.7.0
lifecycle.go:68: β Container created: f49cdd632ddd
lifecycle.go:74: π³ Starting container: f49cdd632ddd
lifecycle.go:80: β Container started: f49cdd632ddd
lifecycle.go:341: container logs (copy starter script: wait for exposed port: get state: Get "http://%2FUsers%2F*******%2F.colima%2Fdocker.sock/v1.45/containers/f49cdd632ddd469cbc51a3f2c820a72dd44ffece473c5f5a8e5a38cbd9c04e99/json": context deadline exceeded):
2024/08/26 11:42:21 failed to start container: start container: started hook: copy starter script: wait for exposed port: get state: Get "http://%2FUsers%2F******%2F.colima%2Fdocker.sock/v1.45/containers/f49cdd632ddd469cbc51a3f2c820a72dd44ffece473c5f5a8e5a38cbd9c04e99/json": context deadline exceeded.
Testcontainers version
0.33.0
Using the latest Testcontainers version?
Yes
Host OS
Mac
Host arch
ARM
Go version
1.22
Docker version
Docker info
What happened?
In version 0.32.0 integration tests were passing with a KafkaContainer. In 0.33.0 the following lines in the Kafka module at the top of
copyStarterScript
result in the context deadline being exceeded and the test failing. If I remove them my tests pass again.The Kafka container I am creating has the following properties:
The image for the container is
confluentinc/confluent-local:7.7.0
.I suspect this may have to do with me using Colima on a Mac and host port mapping, what is confusing to me is that if I comment those lines out and pass the following in my container params then the tests still pass.
Relevant log output
Additional information
No response