Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chore] testbed: use available port for correctness internal metrics …
…config (open-telemetry#30290) **Description:** Fixing a bug - these changes ensure that the correctness tests don't collide on internal metric server ports that currently prevent clean `make test` runs in the testbed directory. They also relax the `testbed.GetAvailablePort()` parameter type to avoid type assertions and limiting the use of the helper. **Testing:** Before changes: ```bash make test go test -race -timeout 300s -parallel 4 --tags="" ./... ? github.com/open-telemetry/opentelemetry-collector-contrib/testbed/correctnesstests [no test files] ? github.com/open-telemetry/opentelemetry-collector-contrib/testbed/datareceivers [no test files] ? github.com/open-telemetry/opentelemetry-collector-contrib/testbed/datasenders [no test files] 2024/01/04 14:57:41 starting testbed receiver 2024/01/04 14:57:41 starting collector 2024-01-04T14:57:41.145Z info service@v0.91.0/telemetry.go:86 Setting up own telemetry... 2024-01-04T14:57:41.147Z info service@v0.91.0/telemetry.go:203 Serving Prometheus metrics {"address": ":8888", "level": "Basic"} 2024-01-04T14:57:41.149Z info service@v0.91.0/service.go:145 Starting otelcol... {"Version": "latest", "NumCPU": 8} 2024-01-04T14:57:41.149Z info extensions/extensions.go:34 Starting extensions... 2024-01-04T14:57:41.151Z info otlpreceiver@v0.91.0/otlp.go:83 Starting GRPC server {"kind": "receiver", "name": "otlp", "data_type": "metrics", "endpoint": "127.0.0.1:36701"} 2024-01-04T14:57:41.152Z info service@v0.91.0/service.go:171 Everything is ready. Begin running and processing data. 2024-01-04T14:57:41.153Z error otelcol@v0.91.0/collector.go:255 Asynchronous error received, terminating process {"error": "listen tcp :8888: bind: address already in use"} go.opentelemetry.io/collector/otelcol.(*Collector).Run /home/rmfitzpatrick.linux/go/pkg/mod/go.opentelemetry.io/collector/otelcol@v0.91.0/collector.go:255 github.com/open-telemetry/opentelemetry-collector-contrib/testbed/testbed.(*inProcessCollector).Start.func2 /opt/macos/work/opentelemetry-collector-contrib/testbed/testbed/in_process_collector.go:87 2024-01-04T14:57:41.153Z info service@v0.91.0/service.go:185 Starting shutdown... 2024-01-04T14:57:41.155Z info extensions/extensions.go:59 Stopping extensions... 2024-01-04T14:57:41.155Z info service@v0.91.0/service.go:199 Shutdown complete. --- FAIL: TestHarness_MetricsGoldenData (1.02s) --- FAIL: TestHarness_MetricsGoldenData/otlp-otlp (1.01s) correctness_test_case.go:50: Error Trace: /opt/macos/work/opentelemetry-collector-contrib/testbed/correctnesstests/metrics/correctness_test_case.go:50 /opt/macos/work/opentelemetry-collector-contrib/testbed/correctnesstests/metrics/metrics_correctness_test.go:62 /opt/macos/work/opentelemetry-collector-contrib/testbed/correctnesstests/metrics/metrics_correctness_test.go:34 Error: Received unexpected error: unable to start, otelcol state is 3 Test: TestHarness_MetricsGoldenData/otlp-otlp FAIL FAIL github.com/open-telemetry/opentelemetry-collector-contrib/testbed/correctnesstests/metrics 1.181s ok github.com/open-telemetry/opentelemetry-collector-contrib/testbed/correctnesstests/traces 0.171s ok github.com/open-telemetry/opentelemetry-collector-contrib/testbed/stabilitytests 0.162s ok github.com/open-telemetry/opentelemetry-collector-contrib/testbed/testbed 1.231s ok github.com/open-telemetry/opentelemetry-collector-contrib/testbed/tests 0.157s FAIL make: *** [../Makefile.Common:118: test] Error 1 ``` After: ```bash $ make test go test -race -timeout 300s -parallel 4 --tags="" ./... ? github.com/open-telemetry/opentelemetry-collector-contrib/testbed/correctnesstests [no test files] ? github.com/open-telemetry/opentelemetry-collector-contrib/testbed/datareceivers [no test files] ? github.com/open-telemetry/opentelemetry-collector-contrib/testbed/datasenders [no test files] ok github.com/open-telemetry/opentelemetry-collector-contrib/testbed/correctnesstests/metrics 1.446s ok github.com/open-telemetry/opentelemetry-collector-contrib/testbed/correctnesstests/traces 0.166s ok github.com/open-telemetry/opentelemetry-collector-contrib/testbed/stabilitytests 0.178s ok github.com/open-telemetry/opentelemetry-collector-contrib/testbed/testbed 1.313s ok github.com/open-telemetry/opentelemetry-collector-contrib/testbed/tests 0.156s ``` **Documentation:** none needed
- Loading branch information