Functional test uses a OTel collector deployed in a container
and configured via provided relay.yaml
I include two approaches on how to deal with Docker:
- Using Docker cli go sdk https://docs.docker.com/engine/api/sdk/examples/
- Using https://golang.testcontainers.org/
To run locally:
go test -v ./tests
Note: the TestContainers runs an additional container
https://golang.testcontainers.org/features/garbage_collector/#ryuk
•2024/02/16 15:23:08 github.com/testcontainers/testcontainers-go - Connected to docker:
Server Version: 24.0.5
API Version: 1.43
Operating System: Docker Desktop
Total Memory: 7851 MB
Resolved Docker Host: unix:///Users/<REDACTED>/.docker/run/docker.sock
Resolved Docker Socket Path: /var/run/docker.sock
Test SessionID: 608c6fc97809c2ab6ad833b50fa3e7d9636c70d5ebbe1337b406179f44e47f32
Test ProcessID: c59a4d57-e59d-4d3a-8abd-0d6135a9403f
2024/02/16 15:23:08 🐳 Creating container for image testcontainers/ryuk:0.6.0
2024/02/16 15:23:08 ✅ Container created: d34d1f0a58e9
2024/02/16 15:23:08 🐳 Starting container: d34d1f0a58e9
2024/02/16 15:23:08 ✅ Container started: d34d1f0a58e9
2024/02/16 15:23:08 🚧 Waiting for container id d34d1f0a58e9 image: testcontainers/ryuk:0.6.0. Waiting for: &{Port:8080/tcp timeout:<nil> PollInterval:100ms}
2024/02/16 15:23:09 🔔 Container is ready: d34d1f0a58e9
2024/02/16 15:23:09 🐳 Creating container for image otel/opentelemetry-collector-contrib:0.88.0
2024/02/16 15:23:09 ✅ Container created: a6bd9d6293bb
2024/02/16 15:23:09 🐳 Starting container: a6bd9d6293bb
2024/02/16 15:23:09 ✅ Container started: a6bd9d6293bb
2024/02/16 15:23:09 🚧 Waiting for container id a6bd9d6293bb image: otel/opentelemetry-collector-contrib:0.88.0. Waiting for: &{timeout:<nil> Log:Everything is ready. Begin running and processing data. IsRegexp:false Occurrence:1 PollInterval:100ms}
2024/02/16 15:23:09 🔔 Container is ready: a6bd9d6293bb
•