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

[telemetry testing] Move generated_component_telemetry_test into internal/metadata #11163

Open
crobert-1 opened this issue Sep 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@crobert-1
Copy link
Member

Request

Originally suggested here, related to #10801.

Moving generated code under internal/metadata generally seems preferable to me, as it allows other generated code to depend on it. As it is currently generated, it lives in a component's top-level directory.

However, this results in an unintended consequence. Since generated_component_telemetry_test.go is a test file, it won't be compiled as part of its package, so another package depending on it won't have access to its methods. In the case of the sample receiver, the metrics_test.go file wouldn't have access to SetupTestTelemetry if generated_component_telemetry_test.go was under internal/metadata.

We have a couple of options:

  1. Rename generated_component_telemetry_test.go to no longer be a test file, something like generated_telemetry_test_helper.go.
  2. Create a new package under internal/metadata that includes test helpers, named something like telemetrytest. The file could then be moved there without the _test.go suffix and referenced in tests.

Alternative
The result of leaving it in its current location is that we need to add generated telemetry tests to a component's top-level directory alongside generated_component_telemetry_test.go, which may add more clutter to components.

@crobert-1 crobert-1 added the bug Something isn't working label Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant