Skip to content

[cmd/mdatagen] generated_component_test.go should handle expected factory failures #13063

@braydonk

Description

@braydonk

Component(s)

cmd/mdatagen

Describe the issue you're reporting

There are some scenarios, such as platform support, where a component factory is expected to fail. The component test template always assumes that the factory is going to succeed, meaning on unsupported platforms the test will fail.

Perhaps a template could be added to mdatagen that will generate another component_test.go under different build tags that expects the factory to error out?

Alternatives

Perhaps we think factories should never error out and simply fail every scrape with an unsupported platform error? I would think we should prefer failing fast at the configuration stage for something like this though.

EDIT: Discussion in the Collector SIG on May 21, 2025 leaned almost unanimously in favour of factories failing fast.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions