feat: migrate to testcontainers-go v0.42.0 and upgrade dependencies#146
feat: migrate to testcontainers-go v0.42.0 and upgrade dependencies#146kezhenxu94 merged 13 commits intomainfrom
Conversation
…ndencies - Delete compose_provider.go (601 lines) — custom DockerContainer/DockerProvider re-implementation replaced by native testcontainers-go APIs - Delete compose_listener.go (85 lines) — Docker event listener no longer needed; containers are accessible after stack.Up() via stack.ServiceContainer() - Rewrite compose.go to use compose.NewDockerComposeWith + stack.Up/ServiceContainer - Rewrite cleanup/compose.go to use stack.Down - Upgrade testcontainers-go v0.11.1 → v0.42.0 - Upgrade docker/docker v20.10.7 → v28.5.2 - Upgrade k8s.io/* v0.22.2 → v0.35.3 - Upgrade sigs.k8s.io/kind v0.27.0 → v0.31.0 - Upgrade spf13/cobra v1.8.0 → v1.10.2 - Remove docker-compose v1 binary install from CI (v0.42.0 uses Docker Compose v2 plugin) - Update action.yaml Go version to 1.26 Closes #139 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Split Build workflow into lint-and-test + build-platform (ubuntu/windows/macos) matrix jobs. Enable CGO for native builds. Update Dockerfile with build-essential for CGO. Change `make build` to build for current OS only (CI matrix handles cross-platform). Based on #139 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…pose version field Pin infra-e2e to apache/skywalking-infra-e2e#146 (81adeec) which migrates to testcontainers-go v0.42.0, using Docker Compose v2 plugin natively and removing docker-compose v1 dependency. Remove the deprecated `version` field from all docker-compose files for Compose v2 compatibility.
compose.Wait(true) maps to `docker compose up --wait` which requires ALL containers to remain running and healthy. This is too strict for e2e tests where some containers may not have healthchecks or may exit after init. Port readiness is already handled by WaitForService() with per-port wait strategies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Fixed: removed Port readiness is already handled by Found via apache/skywalking#13817 testing. |
…pose version field Pin infra-e2e to apache/skywalking-infra-e2e#146 (81adeec) which migrates to testcontainers-go v0.42.0, using Docker Compose v2 plugin natively and removing docker-compose v1 dependency. Remove the deprecated `version` field from all docker-compose files for Compose v2 compatibility.
WaitForService strategies only execute when compose.Wait(true) is passed, but compose.Wait(true) is too strict (requires all containers healthy). Instead, manually wait for each port via TCP dial after Up() returns, matching the old code's behavior of waitPortUntilReady(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Docker SDK v28.5.2 defaults to API v1.51, but GitHub Actions runners may only support up to v1.48. Set DOCKER_API_VERSION to the daemon's supported version to ensure compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add INFO-level logs for port wait start/completion and DEBUG-level for retry attempts. Also try connecting immediately before the first ticker interval to avoid unnecessary 500ms delay when ports are already ready. Log when a service has no ports to wait for. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
After stack.Up(), wait for each container's Docker healthcheck to pass (if defined) before doing TCP port checks. This matches the old behavior where docker-compose up -d would respect depends_on: condition: service_healthy. Also restored internal container port check (/proc/net/tcp + nc + /dev/tcp) from the old WaitPort implementation to align with original behavior. The wait sequence is now: 1. stack.Up(ctx) — start containers 2. waitForHealthy — poll Docker health status until healthy (if healthcheck defined) 3. waitForPort — external TCP dial + internal container check 4. Export env vars Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The old code only waited for services that had ports: in docker-compose.yml. Services without ports were completely skipped. The healthcheck wait was incorrectly running on ALL services, causing timeouts on services like init containers or senders whose healthchecks depend on other services. Now: services without ports get log streaming only. Services with ports get healthcheck wait + port wait + env export (matching old behavior). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The old code never checked Docker healthcheck status. It only did TCP dial + internal /proc/net/tcp check. Many compose files use healthchecks with tools (nc) not available in the container image, causing Docker to mark containers as unhealthy even when the application is running fine. Remove waitForHealthy entirely to match old behavior exactly: port-level waiting only, no Docker healthcheck dependency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| sudo systemctl restart docker | ||
| docker version | ||
| docker info | ||
| echo "DOCKER_API_VERSION=$(docker version --format '{{.Server.APIVersion}}')" >> "$GITHUB_ENV" |
There was a problem hiding this comment.
Do we still need this now? This entire step was added to work around the issue, I think the entire step Set Docker API version can be removed
There was a problem hiding this comment.
Yes, we still need this line to keep client version following the server declared.
|
|
||
| .PHONY: build | ||
| build: windows linux darwin | ||
| build: $(GOOS) |
There was a problem hiding this comment.
Changing the build target to only build the current OS will break the release target? The release target depends on this to build all binaries for all OS'es
The build target must build all platforms (windows/linux/darwin) because release-bin depends on it. Each platform build uses CGO_FLAG to enable CGO only for native builds. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Each matrix runner (ubuntu/windows/macos) now builds only its own platform instead of all three redundantly. The `make build` target is preserved for release which needs all platforms. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…pose version field (#13817) **Changes:** - Bump `skywalking-infra-e2e` to `530f997` (merged apache/skywalking-infra-e2e#146), which migrates testcontainers-go from v0.11.1 to v0.42.0, using Docker Compose v2 plugin natively and removing docker-compose v1 dependency. - Remove deprecated `version` field from all docker-compose files (Compose v2 ignores it with a warning). **What the infra-e2e change does:** - Migrates testcontainers-go v0.11.1 → v0.42.0, using native `compose.NewDockerComposeWith` API - Deletes ~686 lines of custom `DockerContainer`/`DockerProvider` reimplementation - Removes docker-compose v1 binary installation from CI `action.yaml` - Adds TCP port waiting after `docker compose up -d` (matching old behavior) - Restores `DOCKER_API_VERSION` negotiation for Docker 29+ compatibility - User-facing contract (e2e.yaml format, env vars, log paths, CLI) is preserved
Summary
Major dependency upgrade and code simplification:
DockerContainer/DockerProviderre-implementation (compose_provider.go,compose_listener.go)What Changed
compose_provider.gocompose_listener.gostack.ServiceContainer()replaces Docker event listeningcompose.goLocalDockerCompose→compose.NewDockerComposeWith+stack.Up/ServiceContainercleanup/compose.gostack.DownwithRemoveVolumes/RemoveOrphanskind.gotypes.ImageListOptions→image.ListOptions)k8s.goNewShortcutExpanderto use warning callback (new k8s API)action.yamle2e-test.yamlbuild.yamlMakefilemake buildbuilds for current OS only, added CGO_ENABLED per platformDockerfileUser-Facing Contract Preserved
e2e.yaml) unchanged<SERVICE>_host,<SERVICE>_<PORT>logDir/serviceName/std.logGITHUB_RUN_IDproject identifier unchangedTest plan
go build ./...passesmake lintpasses (0 issues)go test ./...passes (all unit tests)make buildpasses locally (macOS with CGO)Supersedes #139
🤖 Generated with Claude Code