From 554c353afc2a3320a0e0e23989f8208c7c4d9eb3 Mon Sep 17 00:00:00 2001 From: Pablo Baeyens Date: Mon, 5 Feb 2024 17:59:33 +0100 Subject: [PATCH] Fix linter and test issues --- exporter/f5cloudexporter/factory_test.go | 2 +- exporter/googlecloudpubsubexporter/factory_test.go | 3 +-- exporter/mezmoexporter/factory_test.go | 3 +-- exporter/sentryexporter/factory_test.go | 2 +- extension/basicauthextension/factory_test.go | 3 +-- processor/attributesprocessor/factory_test.go | 2 +- processor/spanprocessor/factory_test.go | 2 +- processor/transformprocessor/factory_test.go | 2 +- receiver/activedirectorydsreceiver/factory_windows.go | 2 +- receiver/awsxrayreceiver/factory_test.go | 2 +- receiver/azureeventhubreceiver/eventhubhandler_test.go | 2 +- receiver/googlecloudpubsubreceiver/factory_test.go | 3 +-- receiver/googlecloudspannerreceiver/factory_test.go | 3 +-- 13 files changed, 13 insertions(+), 18 deletions(-) diff --git a/exporter/f5cloudexporter/factory_test.go b/exporter/f5cloudexporter/factory_test.go index 6b0203f15633..859313bc1186 100644 --- a/exporter/f5cloudexporter/factory_test.go +++ b/exporter/f5cloudexporter/factory_test.go @@ -22,7 +22,7 @@ import ( func TestFactory_TestType(t *testing.T) { f := NewFactory() - assert.Equal(t, f.Type(), component.Type(metadata.Type)) + assert.Equal(t, f.Type(), metadata.Type) } func TestFactory_CreateDefaultConfig(t *testing.T) { diff --git a/exporter/googlecloudpubsubexporter/factory_test.go b/exporter/googlecloudpubsubexporter/factory_test.go index fffea47b722d..399e17291606 100644 --- a/exporter/googlecloudpubsubexporter/factory_test.go +++ b/exporter/googlecloudpubsubexporter/factory_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/exporter/exportertest" @@ -24,7 +23,7 @@ func TestCreateDefaultConfig(t *testing.T) { func TestType(t *testing.T) { factory := NewFactory() - assert.Equal(t, component.Type(metadata.Type), factory.Type()) + assert.Equal(t, metadata.Type, factory.Type()) } func TestCreateTracesExporter(t *testing.T) { diff --git a/exporter/mezmoexporter/factory_test.go b/exporter/mezmoexporter/factory_test.go index e2eda355ae90..d68d4b7df8b4 100644 --- a/exporter/mezmoexporter/factory_test.go +++ b/exporter/mezmoexporter/factory_test.go @@ -9,7 +9,6 @@ import ( "time" "github.com/stretchr/testify/assert" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/config/configretry" @@ -22,7 +21,7 @@ import ( func TestType(t *testing.T) { factory := NewFactory() pType := factory.Type() - assert.Equal(t, pType, component.Type(metadata.Type)) + assert.Equal(t, pType, metadata.Type) } func TestCreateDefaultConfig(t *testing.T) { diff --git a/exporter/sentryexporter/factory_test.go b/exporter/sentryexporter/factory_test.go index fc9b019ac865..1827e3ad9750 100644 --- a/exporter/sentryexporter/factory_test.go +++ b/exporter/sentryexporter/factory_test.go @@ -23,7 +23,7 @@ func TestCreateDefaultConfig(t *testing.T) { func TestCreateExporter(t *testing.T) { factory := NewFactory() - assert.Equal(t, metadata.Type, string(factory.Type())) + assert.Equal(t, metadata.Type, factory.Type()) cfg := factory.CreateDefaultConfig() eCfg := cfg.(*Config) diff --git a/extension/basicauthextension/factory_test.go b/extension/basicauthextension/factory_test.go index ec59b7c91556..29511d05e31d 100644 --- a/extension/basicauthextension/factory_test.go +++ b/extension/basicauthextension/factory_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/extension/extensiontest" @@ -37,5 +36,5 @@ func TestCreateExtension_ValidConfig(t *testing.T) { func TestNewFactory(t *testing.T) { f := NewFactory() assert.NotNil(t, f) - assert.Equal(t, f.Type(), component.Type(metadata.Type)) + assert.Equal(t, f.Type(), metadata.Type) } diff --git a/processor/attributesprocessor/factory_test.go b/processor/attributesprocessor/factory_test.go index 5bb5d0327490..368d4500aed4 100644 --- a/processor/attributesprocessor/factory_test.go +++ b/processor/attributesprocessor/factory_test.go @@ -20,7 +20,7 @@ import ( func TestFactory_Type(t *testing.T) { factory := NewFactory() - assert.Equal(t, factory.Type(), component.Type(metadata.Type)) + assert.Equal(t, factory.Type(), metadata.Type) } func TestFactory_CreateDefaultConfig(t *testing.T) { diff --git a/processor/spanprocessor/factory_test.go b/processor/spanprocessor/factory_test.go index bcb9bc6d13ea..072f80bfa94f 100644 --- a/processor/spanprocessor/factory_test.go +++ b/processor/spanprocessor/factory_test.go @@ -20,7 +20,7 @@ import ( func TestFactory_Type(t *testing.T) { factory := NewFactory() - assert.Equal(t, factory.Type(), component.Type(metadata.Type)) + assert.Equal(t, factory.Type(), metadata.Type) } func TestFactory_CreateDefaultConfig(t *testing.T) { diff --git a/processor/transformprocessor/factory_test.go b/processor/transformprocessor/factory_test.go index af670d5bf841..c9cc89ca2459 100644 --- a/processor/transformprocessor/factory_test.go +++ b/processor/transformprocessor/factory_test.go @@ -23,7 +23,7 @@ import ( func TestFactory_Type(t *testing.T) { factory := NewFactory() - assert.Equal(t, factory.Type(), component.Type(metadata.Type)) + assert.Equal(t, factory.Type(), metadata.Type) } func TestFactory_CreateDefaultConfig(t *testing.T) { diff --git a/receiver/activedirectorydsreceiver/factory_windows.go b/receiver/activedirectorydsreceiver/factory_windows.go index 60156ca495d0..a5e482a9b5e4 100644 --- a/receiver/activedirectorydsreceiver/factory_windows.go +++ b/receiver/activedirectorydsreceiver/factory_windows.go @@ -32,7 +32,7 @@ func createMetricsReceiver( adds := newActiveDirectoryDSScraper(c.MetricsBuilderConfig, params) scraper, err := scraperhelper.NewScraper( - metadata.Type, + metadata.Type.String(), adds.scrape, scraperhelper.WithStart(adds.start), scraperhelper.WithShutdown(adds.shutdown), diff --git a/receiver/awsxrayreceiver/factory_test.go b/receiver/awsxrayreceiver/factory_test.go index 6190dc4f75e6..c2b0e0b16c4a 100644 --- a/receiver/awsxrayreceiver/factory_test.go +++ b/receiver/awsxrayreceiver/factory_test.go @@ -23,7 +23,7 @@ func TestCreateDefaultConfig(t *testing.T) { assert.NotNil(t, cfg, "failed to create default config") assert.NoError(t, componenttest.CheckConfigStruct(cfg)) - assert.Equal(t, component.Type(metadata.Type), factory.Type()) + assert.Equal(t, metadata.Type, factory.Type()) } func TestCreateTracesReceiver(t *testing.T) { diff --git a/receiver/azureeventhubreceiver/eventhubhandler_test.go b/receiver/azureeventhubreceiver/eventhubhandler_test.go index 8fdb6778f9c6..8b086f2fde9a 100644 --- a/receiver/azureeventhubreceiver/eventhubhandler_test.go +++ b/receiver/azureeventhubreceiver/eventhubhandler_test.go @@ -78,7 +78,7 @@ func (m *mockDataConsumer) consume(ctx context.Context, event *eventhub.Event) e } err = m.nextLogsConsumer.ConsumeLogs(logsContext, logs) - m.obsrecv.EndLogsOp(logsContext, metadata.Type, 1, err) + m.obsrecv.EndLogsOp(logsContext, metadata.Type.String(), 1, err) return err } diff --git a/receiver/googlecloudpubsubreceiver/factory_test.go b/receiver/googlecloudpubsubreceiver/factory_test.go index d4e97c5c6d4b..88838e0b145e 100644 --- a/receiver/googlecloudpubsubreceiver/factory_test.go +++ b/receiver/googlecloudpubsubreceiver/factory_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/receiver/receivertest" @@ -25,7 +24,7 @@ func TestCreateDefaultConfig(t *testing.T) { func TestType(t *testing.T) { factory := NewFactory() - assert.Equal(t, component.Type(metadata.Type), factory.Type()) + assert.Equal(t, metadata.Type, factory.Type()) } func TestCreateTracesReceiver(t *testing.T) { diff --git a/receiver/googlecloudspannerreceiver/factory_test.go b/receiver/googlecloudspannerreceiver/factory_test.go index 6541d95472d0..d07e16af5d7a 100644 --- a/receiver/googlecloudspannerreceiver/factory_test.go +++ b/receiver/googlecloudspannerreceiver/factory_test.go @@ -9,7 +9,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/receiver/receivertest" @@ -24,7 +23,7 @@ func TestCreateDefaultConfig(t *testing.T) { func TestType(t *testing.T) { factory := NewFactory() - assert.Equal(t, component.Type(metadata.Type), factory.Type()) + assert.Equal(t, metadata.Type, factory.Type()) } func TestCreateMetricsReceiver(t *testing.T) {