Skip to content

Commit

Permalink
[chore] [internal/aws/ecsutil] Use confighttp.NewDefaultClientConfig …
Browse files Browse the repository at this point in the history
…instead of manually creating struct (open-telemetry#35575)

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

**Link to tracking Issue:** open-telemetry#35457
  • Loading branch information
mackjmr authored Oct 23, 2024
1 parent 7090083 commit b770e76
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/aws/ecsutil/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestClient(t *testing.T) {

func TestNewClientProvider(t *testing.T) {
baseURL, _ := url.Parse("http://localhost:8080")
provider := NewClientProvider(*baseURL, confighttp.ClientConfig{}, componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings())
provider := NewClientProvider(*baseURL, confighttp.NewDefaultClientConfig(), componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings())
require.NotNil(t, provider)
_, ok := provider.(*defaultClientProvider)
require.True(t, ok)
Expand All @@ -49,7 +49,7 @@ func TestNewClientProvider(t *testing.T) {

func TestDefaultClient(t *testing.T) {
endpoint, _ := url.Parse("http://localhost:8080")
client, err := defaultClient(context.Background(), *endpoint, confighttp.ClientConfig{}, componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings())
client, err := defaultClient(context.Background(), *endpoint, confighttp.NewDefaultClientConfig(), componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings())
require.NoError(t, err)
require.NotNil(t, client.httpClient.Transport)
require.Equal(t, "http://localhost:8080", client.baseURL.String())
Expand Down
2 changes: 1 addition & 1 deletion internal/aws/ecsutil/metadata_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewDetectedTaskMetadataProvider(set component.TelemetrySettings) (MetadataP
return nil, fmt.Errorf("unable to detect task metadata endpoint")
}

clientSettings := confighttp.ClientConfig{}
clientSettings := confighttp.NewDefaultClientConfig()
client, err := NewRestClient(*endpoint, clientSettings, set)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion internal/aws/ecsutil/rest_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (f *fakeClient) Get(path string) ([]byte, error) {

func TestRestClient(t *testing.T) {
u, _ := url.Parse("http://www.test.com")
rest, err := NewRestClient(*u, confighttp.ClientConfig{}, componenttest.NewNopTelemetrySettings())
rest, err := NewRestClient(*u, confighttp.NewDefaultClientConfig(), componenttest.NewNopTelemetrySettings())
require.NoError(t, err)
require.NotNil(t, rest)
}
Expand Down

0 comments on commit b770e76

Please sign in to comment.