Skip to content

Commit

Permalink
[chore] [receiver/purefa] Use confighttp.NewDefaultClientConfig inste…
Browse files Browse the repository at this point in the history
…ad of manually creating struct (open-telemetry#35645)

**Description:**
This PR makes usage of `NewDefaultClientConfig` instead of manually
creating the confighttp.ClientConfig struct.

**Link to tracking Issue:** open-telemetry#35457

---------

Co-authored-by: Andrzej Stencel <[email protected]>
  • Loading branch information
2 people authored and shivanthzen committed Dec 4, 2024
1 parent 602a187 commit 8c65233
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion receiver/purefareceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/purefareceiver/internal/metadata"
Expand All @@ -22,14 +23,17 @@ func TestLoadConfig(t *testing.T) {
cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml"))
require.NoError(t, err)

clientConfig := confighttp.NewDefaultClientConfig()

tests := []struct {
id component.ID
expected component.Config
}{
{
id: component.NewID(metadata.Type),
expected: &Config{
ArrayName: "foobar.example.com",
ClientConfig: clientConfig,
ArrayName: "foobar.example.com",
Settings: &Settings{
ReloadIntervals: &ReloadIntervals{
Array: 15 * time.Second,
Expand Down
2 changes: 1 addition & 1 deletion receiver/purefareceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewFactory() receiver.Factory {
func createDefaultConfig() component.Config {
return &Config{
ArrayName: "foobar.example.com",
ClientConfig: confighttp.ClientConfig{},
ClientConfig: confighttp.NewDefaultClientConfig(),
Settings: &Settings{
ReloadIntervals: &ReloadIntervals{
Array: 15 * time.Second,
Expand Down

0 comments on commit 8c65233

Please sign in to comment.