[chore] change the way we unmarshal the config in tests (#9765)
This change is required in preparation of #9750 This removes the call to `component.UnmarshalConfig` in preparation of its deprecation, and instead has the `Conf` object unmarshal itself into the `Config` struct.
This commit is contained in:
parent
c62b80de7e
commit
117ce94f96
|
|
@ -51,7 +51,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 {
|
||||
t.Run(test.name+"-shutdown", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,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 }}
|
||||
|
|
@ -179,7 +179,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 }}
|
||||
|
|
@ -268,7 +268,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 }}
|
||||
|
|
@ -307,7 +307,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) {
|
||||
|
|
@ -421,7 +421,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 }}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,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 {
|
||||
t.Run(test.name+"-shutdown", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,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 {
|
||||
t.Run(test.name+"-shutdown", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,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 {
|
||||
t.Run(test.name+"-shutdown", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,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 {
|
||||
t.Run(test.name+"-shutdown", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,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 {
|
||||
t.Run(test.name+"-shutdown", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,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 {
|
||||
t.Run(test.name+"-shutdown", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/component/componenttest"
|
||||
"go.opentelemetry.io/collector/confmap/confmaptest"
|
||||
"go.opentelemetry.io/collector/extension/extensiontest"
|
||||
|
|
@ -22,7 +21,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))
|
||||
t.Run("shutdown", func(t *testing.T) {
|
||||
e, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg)
|
||||
require.NoError(t, err)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/component/componenttest"
|
||||
"go.opentelemetry.io/collector/confmap/confmaptest"
|
||||
"go.opentelemetry.io/collector/extension/extensiontest"
|
||||
|
|
@ -22,7 +21,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))
|
||||
t.Run("lifecycle", func(t *testing.T) {
|
||||
firstExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg)
|
||||
require.NoError(t, err)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/component/componenttest"
|
||||
"go.opentelemetry.io/collector/confmap/confmaptest"
|
||||
"go.opentelemetry.io/collector/extension/extensiontest"
|
||||
|
|
@ -22,7 +21,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))
|
||||
t.Run("shutdown", func(t *testing.T) {
|
||||
e, err := factory.CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg)
|
||||
require.NoError(t, err)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,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 {
|
||||
t.Run(test.name+"-shutdown", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,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 {
|
||||
t.Run(test.name+"-lifecycle", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,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 {
|
||||
t.Run(test.name+"-shutdown", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,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 {
|
||||
t.Run(test.name+"-shutdown", func(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue