Skip to content

Commit

Permalink
regenerate without using a deprecated method
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed May 24, 2024
1 parent 1757e25 commit 616b7ec
Show file tree
Hide file tree
Showing 27 changed files with 56 additions and 67 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions cmd/mdatagen/templates/component_test.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func TestComponentLifecycle(t *testing.T) {
cfg := factory.CreateDefaultConfig()
sub, err := cm.Sub("tests::config")
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(&cfg))

for _, test := range tests {
{{- if not .Tests.SkipShutdown }}
Expand Down Expand Up @@ -199,7 +199,7 @@ func TestComponentLifecycle(t *testing.T) {
cfg := factory.CreateDefaultConfig()
sub, err := cm.Sub("tests::config")
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(&cfg))

for _, test := range tests {
{{- if not .Tests.SkipShutdown }}
Expand Down Expand Up @@ -294,7 +294,7 @@ func TestComponentLifecycle(t *testing.T) {
cfg := factory.CreateDefaultConfig()
sub, err := cm.Sub("tests::config")
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(&cfg))

for _, test := range tests {
{{- if not .Tests.SkipShutdown }}
Expand Down Expand Up @@ -333,7 +333,7 @@ func TestComponentLifecycle(t *testing.T) {
cfg := factory.CreateDefaultConfig()
sub, err := cm.Sub("tests::config")
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(&cfg))

{{- if not .Tests.SkipShutdown }}
t.Run("shutdown", func(t *testing.T) {
Expand Down Expand Up @@ -456,7 +456,7 @@ func TestComponentLifecycle(t *testing.T) {
cfg := factory.CreateDefaultConfig()
sub, err := cm.Sub("tests::config")
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(&cfg))

for _, test := range tests {
{{- if not .Tests.SkipShutdown }}
Expand Down
5 changes: 2 additions & 3 deletions cmd/mdatagen/templates/config_test.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/confmap/confmaptest"
)

Expand Down Expand Up @@ -75,7 +74,7 @@ func loadMetricsBuilderConfig(t *testing.T, name string) MetricsBuilderConfig {
sub, err := cm.Sub(name)
require.NoError(t, err)
cfg := DefaultMetricsBuilderConfig()
require.NoError(t, component.UnmarshalConfig(sub, &cfg))
require.NoError(t, sub.Unmarshal(&cfg))
return cfg
}
{{- end }}
Expand Down Expand Up @@ -125,7 +124,7 @@ func loadResourceAttributesConfig(t *testing.T, name string) ResourceAttributesC
sub, err = sub.Sub("resource_attributes")
require.NoError(t, err)
cfg := DefaultResourceAttributesConfig()
require.NoError(t, component.UnmarshalConfig(sub, &cfg))
require.NoError(t, sub.Unmarshal(&cfg))
return cfg
}
{{- end }}
2 changes: 1 addition & 1 deletion connector/forwardconnector/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions exporter/debugexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configtelemetry"
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/confmap/confmaptest"
Expand All @@ -19,7 +18,7 @@ import (
func TestUnmarshalDefaultConfig(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
assert.NoError(t, component.UnmarshalConfig(confmap.New(), cfg))
assert.NoError(t, confmap.New().Unmarshal(&cfg))
assert.Equal(t, factory.CreateDefaultConfig(), cfg)
}

Expand Down Expand Up @@ -49,7 +48,7 @@ func TestUnmarshalConfig(t *testing.T) {
require.NoError(t, err)
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
err = component.UnmarshalConfig(cm, cfg)
err = cm.Unmarshal(&cfg)
if tt.expectedErr != "" {
assert.EqualError(t, err, tt.expectedErr)
} else {
Expand Down Expand Up @@ -91,7 +90,7 @@ func Test_UnmarshalMarshalled(t *testing.T) {

outCfg := &Config{}

err = component.UnmarshalConfig(conf, outCfg)
err = conf.Unmarshal(outCfg)

if tc.expectedErr == "" {
assert.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion exporter/debugexporter/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions exporter/loggingexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zapcore"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configtelemetry"
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/confmap/confmaptest"
Expand All @@ -20,7 +19,7 @@ import (
func TestUnmarshalDefaultConfig(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
assert.NoError(t, component.UnmarshalConfig(confmap.New(), cfg))
assert.NoError(t, confmap.New().Unmarshal(&cfg))
assert.Equal(t, factory.CreateDefaultConfig(), cfg)
}

Expand Down Expand Up @@ -75,7 +74,7 @@ func TestUnmarshalConfig(t *testing.T) {
require.NoError(t, err)
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
err = component.UnmarshalConfig(cm, cfg)
err = cm.Unmarshal(&cfg)
if tt.expectedErr != "" {
assert.EqualError(t, err, tt.expectedErr)
} else {
Expand Down Expand Up @@ -135,7 +134,7 @@ func Test_UnmarshalMarshalled(t *testing.T) {

outCfg := &Config{}

err = component.UnmarshalConfig(conf, outCfg)
err = conf.Unmarshal(outCfg)

if tc.expectedErr == "" {
assert.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion exporter/loggingexporter/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion exporter/nopexporter/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions exporter/otlpexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
func TestUnmarshalDefaultConfig(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
assert.NoError(t, component.UnmarshalConfig(confmap.New(), cfg))
assert.NoError(t, confmap.New().Unmarshal(&cfg))
assert.Equal(t, factory.CreateDefaultConfig(), cfg)
}

Expand All @@ -34,7 +34,7 @@ func TestUnmarshalConfig(t *testing.T) {
require.NoError(t, err)
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
assert.NoError(t, component.UnmarshalConfig(cm, cfg))
assert.NoError(t, cm.Unmarshal(&cfg))
assert.Equal(t,
&Config{
TimeoutSettings: exporterhelper.TimeoutSettings{
Expand Down Expand Up @@ -124,7 +124,7 @@ func TestUnmarshalInvalidConfig(t *testing.T) {
cfg := factory.CreateDefaultConfig()
sub, err := cm.Sub(test.name)
require.NoError(t, err)
assert.NoError(t, component.UnmarshalConfig(sub, cfg))
assert.NoError(t, sub.Unmarshal(&cfg))
assert.ErrorContains(t, component.ValidateConfig(cfg), test.errorMsg)
})
}
Expand Down
2 changes: 1 addition & 1 deletion exporter/otlpexporter/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions exporter/otlphttpexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
func TestUnmarshalDefaultConfig(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
assert.NoError(t, component.UnmarshalConfig(confmap.New(), cfg))
assert.NoError(t, confmap.New().Unmarshal(&cfg))
assert.Equal(t, factory.CreateDefaultConfig(), cfg)
// Default/Empty config is invalid.
assert.Error(t, component.ValidateConfig(cfg))
Expand All @@ -35,7 +35,7 @@ func TestUnmarshalConfig(t *testing.T) {
require.NoError(t, err)
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
assert.NoError(t, component.UnmarshalConfig(cm, cfg))
assert.NoError(t, cm.Unmarshal(&cfg))
assert.Equal(t,
&Config{
RetryConfig: configretry.BackOffConfig{
Expand Down Expand Up @@ -80,7 +80,7 @@ func TestUnmarshalConfigInvalidEncoding(t *testing.T) {
require.NoError(t, err)
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
assert.Error(t, component.UnmarshalConfig(cm, cfg))
assert.Error(t, cm.Unmarshal(&cfg))
}

func TestUnmarshalEncoding(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion exporter/otlphttpexporter/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions extension/ballastextension/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/confmap/confmaptest"
)

func TestUnmarshalDefaultConfig(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
assert.NoError(t, component.UnmarshalConfig(confmap.New(), cfg))
assert.NoError(t, confmap.New().Unmarshal(&cfg))
assert.Equal(t, factory.CreateDefaultConfig(), cfg)
}

Expand All @@ -27,7 +26,7 @@ func TestUnmarshalConfig(t *testing.T) {
require.NoError(t, err)
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
assert.NoError(t, component.UnmarshalConfig(cm, cfg))
assert.NoError(t, cm.Unmarshal(&cfg))
assert.Equal(t,
&Config{
SizeMiB: 123,
Expand Down
3 changes: 1 addition & 2 deletions extension/ballastextension/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions extension/memorylimiterextension/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions extension/zpagesextension/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/confmap/confmaptest"
Expand All @@ -19,7 +18,7 @@ import (
func TestUnmarshalDefaultConfig(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
assert.NoError(t, component.UnmarshalConfig(confmap.New(), cfg))
assert.NoError(t, confmap.New().Unmarshal(&cfg))
assert.Equal(t, factory.CreateDefaultConfig(), cfg)
}

Expand All @@ -28,7 +27,7 @@ func TestUnmarshalConfig(t *testing.T) {
require.NoError(t, err)
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
assert.NoError(t, component.UnmarshalConfig(cm, cfg))
assert.NoError(t, cm.Unmarshal(&cfg))
assert.Equal(t,
&Config{
TCPAddr: confignet.TCPAddrConfig{
Expand Down
3 changes: 1 addition & 2 deletions extension/zpagesextension/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 616b7ec

Please sign in to comment.