From eb6e6f6e01616743dfe0c39af81ee9d9666ef090 Mon Sep 17 00:00:00 2001 From: Pablo Baeyens Date: Tue, 6 Feb 2024 13:38:23 +0000 Subject: [PATCH] [chore] Use component.MustNewType everywhere (#31072) **Description:** Replaces usages of `component.Type(..)` by `component.MustNewType` **Link to tracking Issue:** Needed for open-telemetry/opentelemetry-collector/pull/9472 --- cmd/configschema/configs.go | 5 ++++- cmd/otelcontribcol/distribution_metadata_test.go | 12 +++++++----- exporter/clickhouseexporter/config_test.go | 2 +- exporter/sumologicexporter/factory_test.go | 5 +++-- exporter/syslogexporter/factory_test.go | 5 +++-- extension/httpforwarder/factory_test.go | 4 ++-- extension/storage/storagetest/extension.go | 4 ++-- pkg/stanza/adapter/benchmark_test.go | 10 ++++++---- pkg/stanza/adapter/mocks_test.go | 4 +++- processor/cumulativetodeltaprocessor/factory_test.go | 4 +++- processor/deltatorateprocessor/factory_test.go | 4 +++- processor/filterprocessor/factory_test.go | 3 ++- processor/metricsgenerationprocessor/factory_test.go | 4 +++- processor/metricstransformprocessor/factory_test.go | 4 +++- receiver/azureeventhubreceiver/factory_test.go | 5 +++-- receiver/chronyreceiver/factory_test.go | 3 +-- receiver/fluentforwardreceiver/factory_test.go | 5 +++-- receiver/jmxreceiver/config_test.go | 2 +- receiver/jmxreceiver/factory_test.go | 5 +++-- receiver/k8sclusterreceiver/factory_test.go | 4 ++-- receiver/k8seventsreceiver/factory_test.go | 4 ++-- receiver/k8sobjectsreceiver/factory_test.go | 4 ++-- receiver/splunkhecreceiver/factory_test.go | 4 ++-- receiver/zookeeperreceiver/factory_test.go | 4 +++- 24 files changed, 67 insertions(+), 43 deletions(-) diff --git a/cmd/configschema/configs.go b/cmd/configschema/configs.go index e59b904b2779..cb5caad802e4 100644 --- a/cmd/configschema/configs.go +++ b/cmd/configschema/configs.go @@ -81,7 +81,10 @@ func GetAllCfgInfos(components otelcol.Factories) []CfgInfo { // config for the component specified by the passed-in componentType and // componentName. func GetCfgInfo(components otelcol.Factories, componentType, componentName string) (CfgInfo, error) { - t := component.Type(componentName) + t, err := component.NewType(componentName) + if err != nil { + return CfgInfo{}, fmt.Errorf("failed to build component.Type: %w", err) + } switch componentType { case receiver: f := components.Receivers[t] diff --git a/cmd/otelcontribcol/distribution_metadata_test.go b/cmd/otelcontribcol/distribution_metadata_test.go index 5b564a9d5595..53ed8c41bea2 100644 --- a/cmd/otelcontribcol/distribution_metadata_test.go +++ b/cmd/otelcontribcol/distribution_metadata_test.go @@ -63,17 +63,19 @@ func TestComponentsArePresent(t *testing.T) { tt.Skip("component deprecated, skipping", metadataComponent) return } + + cType := component.MustNewType(m.Type) switch m.Status.Class { case "connector": - assert.NotNil(tt, components.Connectors[component.Type(m.Type)], "missing connector: %s", m.Type) + assert.NotNil(tt, components.Connectors[cType], "missing connector: %s", m.Type) case "exporter": - assert.NotNil(tt, components.Exporters[component.Type(m.Type)], "missing exporter: %s", m.Type) + assert.NotNil(tt, components.Exporters[cType], "missing exporter: %s", m.Type) case "extension": - assert.NotNil(tt, components.Extensions[component.Type(m.Type)], "missing extension: %s", m.Type) + assert.NotNil(tt, components.Extensions[cType], "missing extension: %s", m.Type) case "processor": - assert.NotNil(tt, components.Processors[component.Type(m.Type)], "missing processor: %s", m.Type) + assert.NotNil(tt, components.Processors[cType], "missing processor: %s", m.Type) case "receiver": - assert.NotNil(tt, components.Receivers[component.Type(m.Type)], "missing receiver: %s", m.Type) + assert.NotNil(tt, components.Receivers[cType], "missing receiver: %s", m.Type) } }) } diff --git a/exporter/clickhouseexporter/config_test.go b/exporter/clickhouseexporter/config_test.go index e7c29770f08f..337eb9fef6b6 100644 --- a/exporter/clickhouseexporter/config_test.go +++ b/exporter/clickhouseexporter/config_test.go @@ -32,7 +32,7 @@ func TestLoadConfig(t *testing.T) { defaultCfg := createDefaultConfig() defaultCfg.(*Config).Endpoint = defaultEndpoint - storageID := component.NewIDWithName(component.Type("file_storage"), "clickhouse") + storageID := component.MustNewIDWithName("file_storage", "clickhouse") tests := []struct { id component.ID diff --git a/exporter/sumologicexporter/factory_test.go b/exporter/sumologicexporter/factory_test.go index ebd1b2106108..906cd7d415e3 100644 --- a/exporter/sumologicexporter/factory_test.go +++ b/exporter/sumologicexporter/factory_test.go @@ -8,17 +8,18 @@ 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" "go.opentelemetry.io/collector/exporter/exporterhelper" + + "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sumologicexporter/internal/metadata" ) func TestType(t *testing.T) { factory := NewFactory() pType := factory.Type() - assert.Equal(t, pType, component.Type("sumologic")) + assert.Equal(t, pType, metadata.Type) } func TestCreateDefaultConfig(t *testing.T) { diff --git a/exporter/syslogexporter/factory_test.go b/exporter/syslogexporter/factory_test.go index e6f90478f25c..47cfc42a35d2 100644 --- a/exporter/syslogexporter/factory_test.go +++ b/exporter/syslogexporter/factory_test.go @@ -9,15 +9,16 @@ import ( "github.com/cenkalti/backoff/v4" "github.com/stretchr/testify/assert" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configretry" "go.opentelemetry.io/collector/exporter/exporterhelper" + + "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/syslogexporter/internal/metadata" ) func TestType(t *testing.T) { factory := NewFactory() pType := factory.Type() - assert.Equal(t, pType, component.Type("syslog")) + assert.Equal(t, pType, metadata.Type) } func TestCreateDefaultConfig(t *testing.T) { diff --git a/extension/httpforwarder/factory_test.go b/extension/httpforwarder/factory_test.go index 7207434bac50..e7c1571f944c 100644 --- a/extension/httpforwarder/factory_test.go +++ b/extension/httpforwarder/factory_test.go @@ -18,8 +18,8 @@ import ( func TestFactory(t *testing.T) { f := NewFactory() - expectType := "http_forwarder" - require.Equal(t, component.Type(expectType), f.Type()) + expectType := component.MustNewType("http_forwarder") + require.Equal(t, expectType, f.Type()) cfg := f.CreateDefaultConfig().(*Config) require.Equal(t, ":6060", cfg.Ingress.Endpoint) diff --git a/extension/storage/storagetest/extension.go b/extension/storage/storagetest/extension.go index 4815858cbab5..259b0a303891 100644 --- a/extension/storage/storagetest/extension.go +++ b/extension/storage/storagetest/extension.go @@ -11,7 +11,7 @@ import ( "go.opentelemetry.io/collector/extension/experimental/storage" ) -var testStorageType component.Type = "test_storage" +var testStorageType component.Type = component.MustNewType("test_storage") // TestStorage is an in memory storage extension designed for testing type TestStorage struct { @@ -54,7 +54,7 @@ func (s *TestStorage) GetClient(ctx context.Context, kind component.Kind, ent co return client, setCreatorID(ctx, client, s.ID) } -var nonStorageType component.Type = "non_storage" +var nonStorageType component.Type = component.MustNewType("non_storage") // NonStorage is useful for testing expected behaviors that involve // non-storage extensions diff --git a/pkg/stanza/adapter/benchmark_test.go b/pkg/stanza/adapter/benchmark_test.go index 13aa91f123d0..19d825cd5078 100644 --- a/pkg/stanza/adapter/benchmark_test.go +++ b/pkg/stanza/adapter/benchmark_test.go @@ -109,7 +109,9 @@ func BenchmarkEndToEnd(b *testing.B) { } } -const benchType = "bench" +const benchTypeStr = "bench" + +var benchType = component.MustNewType(benchTypeStr) type BenchConfig struct { BaseConfig @@ -139,18 +141,18 @@ func (f BenchReceiverType) InputConfig(cfg component.Config) operator.Config { } func init() { - operator.Register(benchType, func() operator.Builder { return NewBenchOpConfig() }) + operator.Register(benchTypeStr, func() operator.Builder { return NewBenchOpConfig() }) } // NewBenchOpConfig creates a new benchmarking operator config with default values func NewBenchOpConfig() *BenchOpConfig { - return NewBenchOpConfigWithID(benchType) + return NewBenchOpConfigWithID(benchTypeStr) } // NewBenchOpConfigWithID creates a new noop operator config with default values func NewBenchOpConfigWithID(operatorID string) *BenchOpConfig { return &BenchOpConfig{ - InputConfig: helper.NewInputConfig(operatorID, benchType), + InputConfig: helper.NewInputConfig(operatorID, benchTypeStr), } } diff --git a/pkg/stanza/adapter/mocks_test.go b/pkg/stanza/adapter/mocks_test.go index 71c6362f3e77..c2854bb50960 100644 --- a/pkg/stanza/adapter/mocks_test.go +++ b/pkg/stanza/adapter/mocks_test.go @@ -56,7 +56,9 @@ func (o *UnstartableOperator) Process(_ context.Context, _ *entry.Entry) error { return nil } -const testType = "test" +const testTypeStr = "test" + +var testType = component.MustNewType(testTypeStr) type TestConfig struct { BaseConfig `mapstructure:",squash"` diff --git a/processor/cumulativetodeltaprocessor/factory_test.go b/processor/cumulativetodeltaprocessor/factory_test.go index 109244f970d9..01cd92a35474 100644 --- a/processor/cumulativetodeltaprocessor/factory_test.go +++ b/processor/cumulativetodeltaprocessor/factory_test.go @@ -15,12 +15,14 @@ import ( "go.opentelemetry.io/collector/confmap/confmaptest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/processor/processortest" + + "github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor/internal/metadata" ) func TestType(t *testing.T) { factory := NewFactory() pType := factory.Type() - assert.Equal(t, pType, component.Type("cumulativetodelta")) + assert.Equal(t, pType, metadata.Type) } func TestCreateDefaultConfig(t *testing.T) { diff --git a/processor/deltatorateprocessor/factory_test.go b/processor/deltatorateprocessor/factory_test.go index d1a99266229a..5b1f0c24cc9a 100644 --- a/processor/deltatorateprocessor/factory_test.go +++ b/processor/deltatorateprocessor/factory_test.go @@ -15,12 +15,14 @@ import ( "go.opentelemetry.io/collector/confmap/confmaptest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/processor/processortest" + + "github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor/internal/metadata" ) func TestType(t *testing.T) { factory := NewFactory() pType := factory.Type() - assert.Equal(t, pType, component.Type("deltatorate")) + assert.Equal(t, pType, metadata.Type) } func TestCreateDefaultConfig(t *testing.T) { diff --git a/processor/filterprocessor/factory_test.go b/processor/filterprocessor/factory_test.go index 0a1dfa49ae73..6a241a1e289a 100644 --- a/processor/filterprocessor/factory_test.go +++ b/processor/filterprocessor/factory_test.go @@ -18,13 +18,14 @@ import ( "go.opentelemetry.io/collector/processor/processortest" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl" + "github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor/internal/metadata" ) func TestType(t *testing.T) { factory := NewFactory() pType := factory.Type() - assert.Equal(t, pType, component.Type("filter")) + assert.Equal(t, pType, metadata.Type) } func TestCreateDefaultConfig(t *testing.T) { diff --git a/processor/metricsgenerationprocessor/factory_test.go b/processor/metricsgenerationprocessor/factory_test.go index 8c34ccfa218b..d09c80028e93 100644 --- a/processor/metricsgenerationprocessor/factory_test.go +++ b/processor/metricsgenerationprocessor/factory_test.go @@ -15,12 +15,14 @@ import ( "go.opentelemetry.io/collector/confmap/confmaptest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/processor/processortest" + + "github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor/internal/metadata" ) func TestType(t *testing.T) { factory := NewFactory() pType := factory.Type() - assert.Equal(t, pType, component.Type("experimental_metricsgeneration")) + assert.Equal(t, pType, metadata.Type) } func TestCreateDefaultConfig(t *testing.T) { diff --git a/processor/metricstransformprocessor/factory_test.go b/processor/metricstransformprocessor/factory_test.go index 3408e97b0512..0f0b4632373e 100644 --- a/processor/metricstransformprocessor/factory_test.go +++ b/processor/metricstransformprocessor/factory_test.go @@ -16,12 +16,14 @@ import ( "go.opentelemetry.io/collector/confmap/confmaptest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/processor/processortest" + + "github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor/internal/metadata" ) func TestType(t *testing.T) { factory := NewFactory() pType := factory.Type() - assert.Equal(t, pType, component.Type("metricstransform")) + assert.Equal(t, pType, metadata.Type) } func TestCreateDefaultConfig(t *testing.T) { diff --git a/receiver/azureeventhubreceiver/factory_test.go b/receiver/azureeventhubreceiver/factory_test.go index 30c0a2f9ade6..9d3dd4fc77ac 100644 --- a/receiver/azureeventhubreceiver/factory_test.go +++ b/receiver/azureeventhubreceiver/factory_test.go @@ -8,14 +8,15 @@ import ( "testing" "github.com/stretchr/testify/assert" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/receiver/receivertest" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver/internal/metadata" ) func Test_NewFactory(t *testing.T) { f := NewFactory() - assert.Equal(t, component.Type("azureeventhub"), f.Type()) + assert.Equal(t, metadata.Type, f.Type()) } func Test_NewLogsReceiver(t *testing.T) { diff --git a/receiver/chronyreceiver/factory_test.go b/receiver/chronyreceiver/factory_test.go index 163b0b6204c6..50e7dc4b82c8 100644 --- a/receiver/chronyreceiver/factory_test.go +++ b/receiver/chronyreceiver/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/consumer/consumertest" "go.opentelemetry.io/collector/receiver/receivertest" @@ -22,7 +21,7 @@ func TestType(t *testing.T) { t.Parallel() factory := NewFactory() - assert.Equal(t, component.Type("chrony"), factory.Type(), "Must match the expected type") + assert.Equal(t, metadata.Type, factory.Type(), "Must match the expected type") } func TestValidConfig(t *testing.T) { diff --git a/receiver/fluentforwardreceiver/factory_test.go b/receiver/fluentforwardreceiver/factory_test.go index ea01ae639c8b..ec1cf7d87cbc 100644 --- a/receiver/fluentforwardreceiver/factory_test.go +++ b/receiver/fluentforwardreceiver/factory_test.go @@ -9,10 +9,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/receiver/receivertest" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/fluentforwardreceiver/internal/metadata" ) func TestCreateDefaultConfig(t *testing.T) { @@ -27,7 +28,7 @@ func TestCreateReceiver(t *testing.T) { cfg := factory.CreateDefaultConfig().(*Config) cfg.ListenAddress = "localhost:0" // Endpoint is required, not going to be used here. - require.Equal(t, component.Type("fluentforward"), factory.Type()) + require.Equal(t, metadata.Type, factory.Type()) tReceiver, err := factory.CreateLogsReceiver(context.Background(), receivertest.NewNopCreateSettings(), cfg, consumertest.NewNop()) assert.Nil(t, err, "receiver creation failed") diff --git a/receiver/jmxreceiver/config_test.go b/receiver/jmxreceiver/config_test.go index 354540984af5..4f870a07861c 100644 --- a/receiver/jmxreceiver/config_test.go +++ b/receiver/jmxreceiver/config_test.go @@ -317,7 +317,7 @@ func TestClassPathParse(t *testing.T) { func TestWithInvalidConfig(t *testing.T) { f := NewFactory() - assert.Equal(t, component.Type("jmx"), f.Type()) + assert.Equal(t, metadata.Type, f.Type()) cfg := f.CreateDefaultConfig().(*Config) require.NotNil(t, cfg) diff --git a/receiver/jmxreceiver/factory_test.go b/receiver/jmxreceiver/factory_test.go index 34464373f799..63f6d06e9cc5 100644 --- a/receiver/jmxreceiver/factory_test.go +++ b/receiver/jmxreceiver/factory_test.go @@ -9,9 +9,10 @@ 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" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jmxreceiver/internal/metadata" ) func TestWithValidConfig(t *testing.T) { @@ -19,7 +20,7 @@ func TestWithValidConfig(t *testing.T) { defer unmockJarVersions() f := NewFactory() - assert.Equal(t, component.Type("jmx"), f.Type()) + assert.Equal(t, metadata.Type, f.Type()) cfg := f.CreateDefaultConfig() cfg.(*Config).Endpoint = "myendpoint:12345" diff --git a/receiver/k8sclusterreceiver/factory_test.go b/receiver/k8sclusterreceiver/factory_test.go index 3d41b3e28d03..8dc82905af2e 100644 --- a/receiver/k8sclusterreceiver/factory_test.go +++ b/receiver/k8sclusterreceiver/factory_test.go @@ -26,7 +26,7 @@ import ( func TestFactory(t *testing.T) { f := NewFactory() - require.Equal(t, component.Type("k8s_cluster"), f.Type()) + require.Equal(t, metadata.Type, f.Type()) cfg := f.CreateDefaultConfig() rCfg, ok := cfg.(*Config) @@ -64,7 +64,7 @@ func TestFactory(t *testing.T) { func TestFactoryDistributions(t *testing.T) { f := NewFactory() - require.Equal(t, component.Type("k8s_cluster"), f.Type()) + require.Equal(t, metadata.Type, f.Type()) cfg := f.CreateDefaultConfig() rCfg, ok := cfg.(*Config) diff --git a/receiver/k8seventsreceiver/factory_test.go b/receiver/k8seventsreceiver/factory_test.go index c79739ee58d9..7192a760b935 100644 --- a/receiver/k8seventsreceiver/factory_test.go +++ b/receiver/k8seventsreceiver/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/component/componenttest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/receiver/receivertest" @@ -17,6 +16,7 @@ import ( "k8s.io/client-go/kubernetes/fake" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8seventsreceiver/internal/metadata" ) func TestDefaultConfig(t *testing.T) { @@ -32,7 +32,7 @@ func TestDefaultConfig(t *testing.T) { } func TestFactoryType(t *testing.T) { - assert.Equal(t, component.Type("k8s_events"), NewFactory().Type()) + assert.Equal(t, metadata.Type, NewFactory().Type()) } func TestCreateReceiver(t *testing.T) { diff --git a/receiver/k8sobjectsreceiver/factory_test.go b/receiver/k8sobjectsreceiver/factory_test.go index cd2e11aa253b..2f4f227ff667 100644 --- a/receiver/k8sobjectsreceiver/factory_test.go +++ b/receiver/k8sobjectsreceiver/factory_test.go @@ -9,11 +9,11 @@ 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" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sobjectsreceiver/internal/metadata" ) func TestDefaultConfig(t *testing.T) { @@ -31,7 +31,7 @@ func TestDefaultConfig(t *testing.T) { func TestFactoryType(t *testing.T) { t.Parallel() - assert.Equal(t, component.Type("k8sobjects"), NewFactory().Type()) + assert.Equal(t, metadata.Type, NewFactory().Type()) } func TestCreateReceiver(t *testing.T) { diff --git a/receiver/splunkhecreceiver/factory_test.go b/receiver/splunkhecreceiver/factory_test.go index 55c1ce166768..b9d40c69fe1e 100644 --- a/receiver/splunkhecreceiver/factory_test.go +++ b/receiver/splunkhecreceiver/factory_test.go @@ -8,12 +8,12 @@ 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" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/splunkhecreceiver/internal/metadata" ) func TestCreateDefaultConfig(t *testing.T) { @@ -38,7 +38,7 @@ func TestCreateReceiver(t *testing.T) { } func TestFactoryType(t *testing.T) { - assert.Equal(t, component.Type("splunk_hec"), NewFactory().Type()) + assert.Equal(t, metadata.Type, NewFactory().Type()) } func TestCreateNilNextConsumerMetrics(t *testing.T) { diff --git a/receiver/zookeeperreceiver/factory_test.go b/receiver/zookeeperreceiver/factory_test.go index ce50bc320183..bdb219e9a4f8 100644 --- a/receiver/zookeeperreceiver/factory_test.go +++ b/receiver/zookeeperreceiver/factory_test.go @@ -14,11 +14,13 @@ import ( "go.opentelemetry.io/collector/config/confignet" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/receiver/receivertest" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zookeeperreceiver/internal/metadata" ) func TestFactory(t *testing.T) { f := NewFactory() - require.Equal(t, component.Type("zookeeper"), f.Type()) + require.Equal(t, metadata.Type, f.Type()) cfg := f.CreateDefaultConfig() rCfg := cfg.(*Config)