Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use default confighttp struct for tests (open-telemetry#36681)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description These components are constructing `confighttp.ClientConfig` field by field and adding the corresponding defaults. Instead of using default values to construct a new struct, the new struct should already contain the defaults. This becomes an issue when adding new fields with defaults in the `ClientConfig` structure, see: open-telemetry/opentelemetry-collector#10877 Error in the core collector CI: ``` === FAIL: . TestLoadConfig/elasticsearch (re-run 1) (0.00s) config_test.go:200: Config mismatch (-expected +actual): &elasticsearchreceiver.Config{ ControllerConfig: {CollectionInterval: s"2m0s", InitialDelay: s"1s"}, ClientConfig: confighttp.ClientConfig{ ... // 15 identical fields HTTP2PingTimeout: s"0s", Cookies: nil, - MaxRedirects: 0, + MaxRedirects: 10, }, MetricsBuilderConfig: {Metrics: {ElasticsearchBreakerMemoryEstimated: {Enabled: true}, ElasticsearchBreakerMemoryLimit: {Enabled: true}, ElasticsearchBreakerTripped: {Enabled: true}, ElasticsearchClusterDataNodes: {Enabled: true}, ...}, ResourceAttributes: {ElasticsearchClusterName: {Enabled: true}, ElasticsearchIndexName: {Enabled: true}, ElasticsearchNodeName: {Enabled: true}, ElasticsearchNodeVersion: {Enabled: true}}}, Nodes: {"_local"}, ... // 4 identical fields } ``` <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes <!--Describe what testing was performed and which tests were added.--> #### Testing <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.-->
- Loading branch information