Skip to content

Rework integration tests from docker-compose to testcontainers-go#303

Closed
korniltsev-grafanista-yolo-vibecoder239 wants to merge 1 commit into
grafana:mainfrom
korniltsev-grafanista-yolo-vibecoder239:vk/91b4-rework-integrati
Closed

Rework integration tests from docker-compose to testcontainers-go#303
korniltsev-grafanista-yolo-vibecoder239 wants to merge 1 commit into
grafana:mainfrom
korniltsev-grafanista-yolo-vibecoder239:vk/91b4-rework-integrati

Conversation

@korniltsev-grafanista-yolo-vibecoder239
Copy link
Copy Markdown
Contributor

@korniltsev-grafanista-yolo-vibecoder239 korniltsev-grafanista-yolo-vibecoder239 commented Apr 6, 2026

Summary

Replaces the split integration test infrastructure with a single Go test file using testcontainers-go, matching the patterns used by pyroscope-dotnet and otel-profiling-java.

Previously, the test logic was scattered across three places:

  • docker-compose-itest.yaml — defined 27 service containers (Alpine × Java, Ubuntu × Java)
  • itest/query/main.go — a standalone Go program (not a test) that queried Pyroscope
  • Makefile — orchestrated docker-compose up → go run → docker-compose down

Now everything lives in itest/integration_test.go:

  • 27 top-level Test* functions, one per OS/Java variant, each calling a shared runVariant helper
  • testcontainers-go manages the Pyroscope server and app containers (build, start, cleanup)
  • Existing Dockerfiles (alpine-test.Dockerfile, ubuntu-test.Dockerfile) are built via FromDockerfile with build args
  • assert.Eventually polls Pyroscope for the expected Fib.fib stack trace (3 min timeout, 5s interval)

The CI workflow now uses a discover-then-run pattern (like otel-profiling-java): a first job runs go test -list . ./... to discover all test functions, then a matrix job runs each in parallel. The variant list is defined entirely in Go — no duplication in YAML.

Changes

  • New: itest/integration_test.go — 27 test functions + helpers (startPyroscope, startApp, testTarget, stackCollapseProto)
  • New: itest/go.mod — module pyroscope-java-itest with testcontainers-go and testify
  • Updated: .github/workflows/itest.yml — two-job discover-then-run pattern, no hardcoded matrix
  • Updated: Makefileitest target now runs go test directly
  • Deleted: docker-compose-itest.yaml, itest/query/ (main.go, go.mod, go.sum)

Test plan

  • All 27 variants pass locally (go test -v -timeout 60m -count=1 ./...)
  • go test -list . ./... discovers all 27 test functions
  • CI workflow discovers and runs all variants in parallel

Replace the split test infrastructure (docker-compose YAML, Go main program,
Makefile orchestration) with a single Go test file using testcontainers-go.
Each OS/Java variant is now a top-level test function discoverable via
go test -list, and the CI workflow discovers tests dynamically instead of
maintaining a hardcoded matrix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@korniltsev-grafanista korniltsev-grafanista marked this pull request as draft April 6, 2026 08:11
@korniltsev-grafanista-yolo-vibecoder239 korniltsev-grafanista-yolo-vibecoder239 changed the title rework integration tests to be in go (vibe-kanban) Rework integration tests from docker-compose to testcontainers-go Apr 6, 2026
@korniltsev-grafanista
Copy link
Copy Markdown
Contributor

Thanks for the contribution! We're continuing this work on a branch in the main repository so we can run CI and merge from there.

Please see the replacement draft PR: #319

Closing this PR in favor of that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants