Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mackjmr committed Oct 4, 2024
1 parent a7ae565 commit 1723892
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
19 changes: 5 additions & 14 deletions exporter/influxdbexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package influxdbexporter

import (
"net/http"
"path/filepath"
"testing"
"time"
Expand All @@ -23,10 +22,10 @@ import (
)

func TestLoadConfig(t *testing.T) {
defaultMaxIdleConns := http.DefaultTransport.(*http.Transport).MaxIdleConns
defaultMaxIdleConnsPerHost := http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost
defaultMaxConnsPerHost := http.DefaultTransport.(*http.Transport).MaxConnsPerHost
defaultIdleConnTimeout := http.DefaultTransport.(*http.Transport).IdleConnTimeout
clientConfig := confighttp.NewDefaultClientConfig()
clientConfig.Endpoint = "http://localhost:8080"
clientConfig.Timeout = 500 * time.Millisecond
clientConfig.Headers = map[string]configopaque.String{"User-Agent": "OpenTelemetry -> Influx"}
t.Parallel()

cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml"))
Expand All @@ -43,15 +42,7 @@ func TestLoadConfig(t *testing.T) {
{
id: component.NewIDWithName(metadata.Type, "override-config"),
expected: &Config{
ClientConfig: confighttp.ClientConfig{
Endpoint: "http://localhost:8080",
Timeout: 500 * time.Millisecond,
Headers: map[string]configopaque.String{"User-Agent": "OpenTelemetry -> Influx"},
MaxIdleConns: &defaultMaxIdleConns,
MaxIdleConnsPerHost: &defaultMaxIdleConnsPerHost,
MaxConnsPerHost: &defaultMaxConnsPerHost,
IdleConnTimeout: &defaultIdleConnTimeout,
},
ClientConfig: clientConfig,
QueueSettings: exporterhelper.QueueConfig{
Enabled: true,
NumConsumers: 3,
Expand Down
6 changes: 3 additions & 3 deletions exporter/influxdbexporter/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ func Test_influxHTTPWriterBatch_EnqueuePoint_emptyTagValue(t *testing.T) {
t.Cleanup(noopHTTPServer.Close)

nowTime := time.Unix(1000, 2000)
clientConfig := confighttp.NewDefaultClientConfig()
clientConfig.Endpoint = noopHTTPServer.URL

influxWriter, err := newInfluxHTTPWriter(
new(common.NoopLogger),
&Config{
ClientConfig: confighttp.ClientConfig{
Endpoint: noopHTTPServer.URL,
},
ClientConfig: clientConfig,
},
componenttest.NewNopTelemetrySettings())
require.NoError(t, err)
Expand Down

0 comments on commit 1723892

Please sign in to comment.