Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] remove use of deprecated component.UnmarshalConfig #33404

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion connector/exceptionsconnector/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
err = component.UnmarshalConfig(sub, cfg)
err = sub.Unmarshal(cfg)
assert.NoError(t, err)
assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tt.expected, cfg)
Expand Down
4 changes: 2 additions & 2 deletions connector/failoverconnector/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tc.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tc.expected, cfg)
Expand Down Expand Up @@ -106,7 +106,7 @@ func TestValidateConfig(t *testing.T) {

sub, err := cm.Sub(tc.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

assert.EqualError(t, component.ValidateConfig(cfg), tc.err.Error())
})
Expand Down
2 changes: 1 addition & 1 deletion connector/grafanacloudconnector/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, tc.name).String())
assert.NilError(t, err)
assert.NilError(t, component.UnmarshalConfig(sub, cfg))
assert.NilError(t, sub.Unmarshal(cfg))
assert.DeepEqual(t, tc.expect, cfg)
})
}
Expand Down
2 changes: 1 addition & 1 deletion connector/routingconnector/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tt.expected, cfg)
Expand Down
2 changes: 1 addition & 1 deletion connector/spanmetricsconnector/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
err = component.UnmarshalConfig(sub, cfg)
err = sub.Unmarshal(cfg)

if tt.expected == nil {
err = errors.Join(err, component.ValidateConfig(cfg))
Expand Down
2 changes: 1 addition & 1 deletion exporter/alertmanagerexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tt.expected, cfg)
Expand Down
2 changes: 1 addition & 1 deletion exporter/alibabacloudlogserviceexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tt.expected, cfg)
Expand Down
2 changes: 1 addition & 1 deletion exporter/awscloudwatchlogsexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
err = component.UnmarshalConfig(sub, cfg)
err = sub.Unmarshal(cfg)

if tt.expected == nil {
err = multierr.Append(err, component.ValidateConfig(cfg))
Expand Down
2 changes: 1 addition & 1 deletion exporter/awsemfexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tt.expected, cfg)
Expand Down
4 changes: 2 additions & 2 deletions exporter/awsemfexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestCreateTracesExporter(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "1").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

ctx := context.Background()
exporter, err := factory.CreateTracesExporter(ctx, exportertest.NewNopCreateSettings(), cfg)
Expand All @@ -50,7 +50,7 @@ func TestCreateMetricsExporter(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "1").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

ctx := context.Background()
exporter, err := factory.CreateMetricsExporter(ctx, exportertest.NewNopCreateSettings(), cfg)
Expand Down
2 changes: 1 addition & 1 deletion exporter/awskinesisexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tt.expected, cfg)
Expand Down
4 changes: 2 additions & 2 deletions exporter/awsxrayexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestCreateTracesExporter(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "customname").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

ctx := context.Background()
exporter, err := factory.CreateTracesExporter(ctx, exportertest.NewNopCreateSettings(), cfg)
Expand All @@ -93,7 +93,7 @@ func TestCreateMetricsExporter(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "customname").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

ctx := context.Background()
exporter, err := factory.CreateMetricsExporter(ctx, exportertest.NewNopCreateSettings(), cfg)
Expand Down
12 changes: 6 additions & 6 deletions exporter/azuredataexplorerexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestCreateMetricsExporter(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

params := exportertest.NewNopCreateSettings()
exporter, err := factory.CreateMetricsExporter(context.Background(), params, cfg)
Expand Down Expand Up @@ -63,7 +63,7 @@ func TestCreateMetricsExporterWhenIngestEmpty(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "2").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

params := exportertest.NewNopCreateSettings()
// Load the #3 which has empty. This
Expand All @@ -88,7 +88,7 @@ func TestCreateLogsExporter(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

params := exportertest.NewNopCreateSettings()
exporter, err := factory.CreateLogsExporter(context.Background(), params, cfg)
Expand Down Expand Up @@ -118,7 +118,7 @@ func TestCreateLogsExporterWhenIngestEmpty(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "2").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

params := exportertest.NewNopCreateSettings()
// Load the #3 which has empty
Expand All @@ -136,7 +136,7 @@ func TestCreateTracesExporter(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

params := exportertest.NewNopCreateSettings()
exporter, err := factory.CreateTracesExporter(context.Background(), params, cfg)
Expand All @@ -163,7 +163,7 @@ func TestCreateTracesExporterWhenIngestEmpty(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "2").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

params := exportertest.NewNopCreateSettings()
// Load the #3 which has empty
Expand Down
2 changes: 1 addition & 1 deletion exporter/azuremonitorexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tt.expected, cfg)
Expand Down
2 changes: 1 addition & 1 deletion exporter/carbonexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tt.expected, cfg)
Expand Down
2 changes: 1 addition & 1 deletion exporter/cassandraexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tt.expected, cfg)
Expand Down
4 changes: 2 additions & 2 deletions exporter/clickhouseexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tt.expected, cfg)
Expand Down Expand Up @@ -353,7 +353,7 @@ func TestTableEngineConfigParsing(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tt.expected, cfg.(*Config).TableEngineString())
Expand Down
12 changes: 6 additions & 6 deletions exporter/coralogixexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tt.expected, cfg)
Expand All @@ -172,7 +172,7 @@ func TestTraceExporter(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

params := exportertest.NewNopCreateSettings()
te, err := newTracesExporter(cfg, params)
Expand All @@ -190,7 +190,7 @@ func TestMetricsExporter(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "metrics").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))
require.NoError(t, component.ValidateConfig(cfg))

params := exportertest.NewNopCreateSettings()
Expand All @@ -210,7 +210,7 @@ func TestLogsExporter(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "logs").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))
require.NoError(t, component.ValidateConfig(cfg))

params := exportertest.NewNopCreateSettings()
Expand All @@ -230,7 +230,7 @@ func TestDomainWithAllExporters(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "domain").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

params := exportertest.NewNopCreateSettings()
te, err := newTracesExporter(cfg, params)
Expand Down Expand Up @@ -260,7 +260,7 @@ func TestEndpoindsAndDomainWithAllExporters(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "domain_endoints").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

params := exportertest.NewNopCreateSettings()
te, err := newTracesExporter(cfg, params)
Expand Down
14 changes: 7 additions & 7 deletions exporter/datadogexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tt.expected, cfg)
Expand Down Expand Up @@ -459,7 +459,7 @@ func TestOverrideEndpoints(t *testing.T) {
cfg := factory.CreateDefaultConfig()
sub, err := cm.Sub(component.NewIDWithName(metadata.Type, testInstance.componentID).String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

componentCfg, ok := cfg.(*Config)
require.True(t, ok, "component.Config is not a Datadog exporter config (wrong ID?)")
Expand All @@ -482,7 +482,7 @@ func TestCreateAPIMetricsExporter(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "api").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

c := cfg.(*Config)
c.Metrics.TCPAddrConfig.Endpoint = server.URL
Expand Down Expand Up @@ -515,7 +515,7 @@ func TestCreateAPIExporterFailOnInvalidKey_Zorkian(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "api").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

// Use the mock server for API key validation
c := cfg.(*Config)
Expand Down Expand Up @@ -595,7 +595,7 @@ func TestCreateAPIExporterFailOnInvalidKey(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "api").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

// Use the mock server for API key validation
c := cfg.(*Config)
Expand Down Expand Up @@ -670,7 +670,7 @@ func TestCreateAPILogsExporter(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "api").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

c := cfg.(*Config)
c.Metrics.TCPAddrConfig.Endpoint = server.URL
Expand Down Expand Up @@ -751,7 +751,7 @@ func TestStopExporters(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "api").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

c := cfg.(*Config)
c.Metrics.TCPAddrConfig.Endpoint = server.URL
Expand Down
2 changes: 1 addition & 1 deletion receiver/vcenterreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func TestLoadConfig(t *testing.T) {

sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(cfg))

expected := factory.CreateDefaultConfig().(*Config)
expected.Endpoint = "http://vcsa.host.localnet"
Expand Down