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

[cmd/mdatagen] Support modifying component tests for different platforms #30044

Closed
evan-bradley opened this issue Dec 18, 2023 · 7 comments
Closed
Assignees
Labels
closed as inactive cmd/mdatagen mdatagen command enhancement New feature or request Stale

Comments

@evan-bradley
Copy link
Contributor

Component(s)

cmd/mdatagen

Is your feature request related to a problem? Please describe.

Not all components support all platforms, which can lead to failures in tests when testing is performed on an unsupported platform in CI.

Describe the solution you'd like

Add a config option that allows configuring which platforms a component supports. I'm not aware of any components that are currently restricted by architecture, but that may also be necessary.

Describe alternatives you've considered

No response

Additional context

We are currently receiving the current error on main when running Windows unit tests for the Podman receiver:

C:/mingw64/bin/make -C receiver/podmanreceiver test
make[2]: Entering directory 'D:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/podmanreceiver'
go test -race -timeout 300s -parallel 4 --tags="" ./...
?   	github.com/open-telemetry/opentelemetry-collector-contrib/receiver/otlpjsonfilereceiver/internal/metadata	[no test files]
?   	github.com/open-telemetry/opentelemetry-collector-contrib/receiver/podmanreceiver/internal/metadata	[no test files]
--- FAIL: Test_ComponentLifecycle (0.00s)
    --- FAIL: Test_ComponentLifecycle/metrics-shutdown (0.00s)
        generated_component_test.go:67: 
            	Error Trace:	D:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/podmanreceiver/generated_component_test.go:67
            	Error:      	Received unexpected error:
            	            	podman receiver is not supported on windows
            	Test:       	Test_ComponentLifecycle/metrics-shutdown
FAIL
FAIL	github.com/open-telemetry/opentelemetry-collector-contrib/receiver/podmanreceiver	0.063s
FAIL
make[2]: *** [../../Makefile.Common:118: test] Error 1
make[2]: Leaving directory 'D:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/podmanreceiver'
make[1]: *** [Makefile:152: receiver/podmanreceiver] Error 2

From: https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/7250553809/job/19751004982

I believe this error comes from generating the tests, which was done here: #29957

@evan-bradley evan-bradley added the enhancement New feature or request label Dec 18, 2023
@github-actions github-actions bot added the cmd/mdatagen mdatagen command label Dec 18, 2023
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@hughesjj
Copy link
Contributor

@dmitryax I can take implementation of this one if you wish

@hughesjj
Copy link
Contributor

@evan-bradley thoughts on specifying build-targets instead of values for GOOS/PLATFORM?

Idea would be we

  1. check if build-targets array is present
  2. inject a //go:build LIST_OF_TARGETS directive near the top of the file
  3. Add the list of flags in a simple array join where that LIST_OF_TARGETS is referenced

Or do we need more granularity, ex at the per-metric level? If so then I'd say a change in metadata.yaml schema is warranted/better.

@hughesjj
Copy link
Contributor

We may want to hold off on implementation until opentelemetry-collector PR 9172 is done.

@evan-bradley
Copy link
Contributor Author

evan-bradley commented Jan 16, 2024

@evan-bradley thoughts on specifying build-targets instead of values for GOOS/PLATFORM?

Sorry, I missed the notification for this. Are there other build targets that we would want to gate tests on outside of the OS/architecture? I'm not against the approach you suggested, but to me restricting the allowed values to the supported Collector platforms seems like a reasonable default choice.

Or do we need more granularity, ex at the per-metric level?

I'm not aware that we need granularity on anything more than the component level for these tests, since I think most components handle per-platform metrics within their own tests and not in the mdatagen-generated tests.

Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

@github-actions github-actions bot added the Stale label Mar 18, 2024
Copy link
Contributor

This issue has been closed as inactive because it has been stale for 120 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed as inactive cmd/mdatagen mdatagen command enhancement New feature or request Stale
Projects
None yet
Development

No branches or pull requests

2 participants