Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] testbed: use available port for correctness internal metrics config #30290

Merged

Conversation

rmfitzpatrick
Copy link
Contributor

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:

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:

$ 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

…config

Also relaxes testbed.GetAvailablePort parameter type
@dmitryax dmitryax merged commit 1d4b064 into open-telemetry:main Jan 4, 2024
86 checks passed
@github-actions github-actions bot added this to the next release milestone Jan 4, 2024
cparkins pushed a commit to AmadeusITGroup/opentelemetry-collector-contrib that referenced this pull request Jan 10, 2024
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants