Skip to content

Commit

Permalink
[chore][exporter/f5cloud] Fix TestLoadConfig w/ using factory default…
Browse files Browse the repository at this point in the history
… configs (open-telemetry#30759)

Fixes
open-telemetry#30703.

This changes the test to create a otlphttpCfg from factory default, so
that the test doesn't fail when new fields are introduced to otlphttp
default config.
  • Loading branch information
songy23 authored and cparkins committed Feb 1, 2024
1 parent 8816a8d commit 3a4138c
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions exporter/f5cloudexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,32 @@ func TestLoadConfig(t *testing.T) {
require.NoError(t, component.UnmarshalConfig(sub, cfg))

actualCfg := cfg.(*Config)
expectedCfg := &Config{
Config: otlphttp.Config{
RetryConfig: configretry.BackOffConfig{
Enabled: true,
InitialInterval: 10 * time.Second,
MaxInterval: 1 * time.Minute,
MaxElapsedTime: 10 * time.Minute,
RandomizationFactor: backoff.DefaultRandomizationFactor,
Multiplier: backoff.DefaultMultiplier,
},
QueueConfig: exporterhelper.QueueSettings{
Enabled: true,
NumConsumers: 2,
QueueSize: 10,
},
HTTPClientSettings: confighttp.HTTPClientSettings{
Endpoint: "https://f5cloud",
ReadBufferSize: 123,
WriteBufferSize: 345,
Timeout: time.Second * 10,
Headers: map[string]configopaque.String{
"User-Agent": "opentelemetry-collector-contrib {{version}}",
},
Compression: "gzip",
},
otlphttpCfg := otlphttp.NewFactory().CreateDefaultConfig().(*otlphttp.Config)
otlphttpCfg.RetryConfig = configretry.BackOffConfig{
Enabled: true,
InitialInterval: 10 * time.Second,
MaxInterval: 1 * time.Minute,
MaxElapsedTime: 10 * time.Minute,
RandomizationFactor: backoff.DefaultRandomizationFactor,
Multiplier: backoff.DefaultMultiplier,
}
otlphttpCfg.QueueConfig = exporterhelper.QueueSettings{
Enabled: true,
NumConsumers: 2,
QueueSize: 10,
}
otlphttpCfg.HTTPClientSettings = confighttp.HTTPClientSettings{
Endpoint: "https://f5cloud",
ReadBufferSize: 123,
WriteBufferSize: 345,
Timeout: time.Second * 10,
Headers: map[string]configopaque.String{
"User-Agent": "opentelemetry-collector-contrib {{version}}",
},
Compression: "gzip",
}
expectedCfg := &Config{
Config: *otlphttpCfg,
Source: "dev",
AuthConfig: AuthConfig{
CredentialFile: "/etc/creds/key.json",
Expand Down

0 comments on commit 3a4138c

Please sign in to comment.