diff --git a/processor/k8sattributesprocessor/config_test.go b/processor/k8sattributesprocessor/config_test.go index d42c6026ea4b..3e7a0973ef1f 100644 --- a/processor/k8sattributesprocessor/config_test.go +++ b/processor/k8sattributesprocessor/config_test.go @@ -18,11 +18,10 @@ import ( "path/filepath" "testing" - "go.opentelemetry.io/collector/confmap/confmaptest" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/config" + "go.opentelemetry.io/collector/confmap/confmaptest" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig" "github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor/internal/kube" diff --git a/processor/logstransformprocessor/config_test.go b/processor/logstransformprocessor/config_test.go index 94806e33e799..a1fa7282e383 100644 --- a/processor/logstransformprocessor/config_test.go +++ b/processor/logstransformprocessor/config_test.go @@ -19,11 +19,10 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/confmap/confmaptest" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/config" + "go.opentelemetry.io/collector/confmap/confmaptest" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/adapter" ) diff --git a/processor/logstransformprocessor/testdata/config.yaml b/processor/logstransformprocessor/testdata/config.yaml index 53f1fa842806..52f84a4ca320 100644 --- a/processor/logstransformprocessor/testdata/config.yaml +++ b/processor/logstransformprocessor/testdata/config.yaml @@ -5,4 +5,4 @@ operators: parse_from: attributes.time layout: '%Y-%m-%d %H:%M:%S' severity: - parse_from: attributes.sev \ No newline at end of file + parse_from: attributes.sev diff --git a/processor/metricsgenerationprocessor/config_test.go b/processor/metricsgenerationprocessor/config_test.go index 5a935280d578..a8b3eb14462c 100644 --- a/processor/metricsgenerationprocessor/config_test.go +++ b/processor/metricsgenerationprocessor/config_test.go @@ -19,11 +19,10 @@ import ( "path/filepath" "testing" - "go.opentelemetry.io/collector/confmap/confmaptest" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/config" + "go.opentelemetry.io/collector/confmap/confmaptest" ) func TestLoadConfig(t *testing.T) { @@ -99,12 +98,12 @@ func TestLoadConfig(t *testing.T) { require.NoError(t, err) require.NoError(t, config.UnmarshalProcessor(sub, cfg)) - if tt.expected != nil { - assert.NoError(t, cfg.Validate()) - assert.Equal(t, tt.expected, cfg) - } else { + if tt.expected == nil { assert.EqualError(t, cfg.Validate(), tt.errorMessage) + return } + assert.NoError(t, cfg.Validate()) + assert.Equal(t, tt.expected, cfg) }) } } diff --git a/processor/metricsgenerationprocessor/factory_test.go b/processor/metricsgenerationprocessor/factory_test.go index c1a327110871..9c5f20cf86ea 100644 --- a/processor/metricsgenerationprocessor/factory_test.go +++ b/processor/metricsgenerationprocessor/factory_test.go @@ -17,16 +17,14 @@ package metricsgenerationprocessor import ( "context" "path/filepath" - "strings" "testing" - "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/confmap/confmaptest" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config" "go.opentelemetry.io/collector/config/configtest" + "go.opentelemetry.io/collector/confmap/confmaptest" "go.opentelemetry.io/collector/consumer/consumertest" ) @@ -58,12 +56,7 @@ func TestCreateProcessors(t *testing.T) { factory := NewFactory() cfg := factory.CreateDefaultConfig() - var id string - parts := strings.Split(k, "/") - if len(parts) > 1 { - id = parts[1] - } - sub, err := cm.Sub(config.NewComponentIDWithName(typeStr, id).String()) + sub, err := cm.Sub(k) require.NoError(t, err) require.NoError(t, config.UnmarshalProcessor(sub, cfg)) diff --git a/processor/metricstransformprocessor/config_test.go b/processor/metricstransformprocessor/config_test.go index be9db36c2090..6f3dc29d113d 100644 --- a/processor/metricstransformprocessor/config_test.go +++ b/processor/metricstransformprocessor/config_test.go @@ -18,11 +18,10 @@ import ( "path/filepath" "testing" - "go.opentelemetry.io/collector/confmap/confmaptest" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/config" + "go.opentelemetry.io/collector/confmap/confmaptest" ) func TestLoadConfig(t *testing.T) { diff --git a/processor/metricstransformprocessor/factory_test.go b/processor/metricstransformprocessor/factory_test.go index 32a02a005a2f..2551a7a4d3db 100644 --- a/processor/metricstransformprocessor/factory_test.go +++ b/processor/metricstransformprocessor/factory_test.go @@ -19,16 +19,14 @@ import ( "fmt" "path/filepath" "reflect" - "strings" "testing" - "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/confmap/confmaptest" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config" "go.opentelemetry.io/collector/config/configtest" + "go.opentelemetry.io/collector/confmap/confmaptest" "go.opentelemetry.io/collector/consumer/consumertest" ) @@ -131,12 +129,7 @@ func TestCreateProcessors(t *testing.T) { factory := NewFactory() cfg := factory.CreateDefaultConfig() - var id string - parts := strings.Split(k, "/") - if len(parts) > 1 { - id = parts[1] - } - sub, err := cm.Sub(config.NewComponentIDWithName(typeStr, id).String()) + sub, err := cm.Sub(k) require.NoError(t, err) require.NoError(t, config.UnmarshalProcessor(sub, cfg)) diff --git a/processor/probabilisticsamplerprocessor/testdata/config.yaml b/processor/probabilisticsamplerprocessor/testdata/config.yaml index 1e7ce71a633c..326d2b8d78a3 100644 --- a/processor/probabilisticsamplerprocessor/testdata/config.yaml +++ b/processor/probabilisticsamplerprocessor/testdata/config.yaml @@ -20,4 +20,4 @@ probabilistic_sampler: # intended. hash_seed: 22 -probabilistic_sampler/empty: \ No newline at end of file +probabilistic_sampler/empty: diff --git a/processor/redactionprocessor/config_test.go b/processor/redactionprocessor/config_test.go index dd7c34716db8..ba725e3fb37d 100644 --- a/processor/redactionprocessor/config_test.go +++ b/processor/redactionprocessor/config_test.go @@ -18,11 +18,10 @@ import ( "path/filepath" "testing" - "go.opentelemetry.io/collector/confmap/confmaptest" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/config" + "go.opentelemetry.io/collector/confmap/confmaptest" ) func TestLoadConfig(t *testing.T) {