diff --git a/service/pipelines_test.go b/service/pipelines_test.go index bfa06aa1455..68eaff10c81 100644 --- a/service/pipelines_test.go +++ b/service/pipelines_test.go @@ -301,6 +301,7 @@ func TestBuildErrors(t *testing.T) { tests := []struct { name string settings pipelinesSettings + expected string }{ { name: "not_supported_exporter_logs", @@ -318,6 +319,7 @@ func TestBuildErrors(t *testing.T) { }, }, }, + expected: "failed to create \"bf\" exporter, in pipeline \"logs\": telemetry type is not supported", }, { name: "not_supported_exporter_metrics", @@ -335,6 +337,7 @@ func TestBuildErrors(t *testing.T) { }, }, }, + expected: "failed to create \"bf\" exporter, in pipeline \"metrics\": telemetry type is not supported", }, { name: "not_supported_exporter_traces", @@ -352,6 +355,7 @@ func TestBuildErrors(t *testing.T) { }, }, }, + expected: "failed to create \"bf\" exporter, in pipeline \"traces\": telemetry type is not supported", }, { name: "not_supported_processor_logs", @@ -363,7 +367,7 @@ func TestBuildErrors(t *testing.T) { component.NewID("bf"): badProcessorFactory.CreateDefaultConfig(), }, ExporterConfigs: map[component.ID]component.Config{ - component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(), + component.NewID("nop"): nopExporterFactory.CreateDefaultConfig(), }, PipelineConfigs: map[component.ID]*ConfigServicePipeline{ component.NewID("logs"): { @@ -373,6 +377,7 @@ func TestBuildErrors(t *testing.T) { }, }, }, + expected: "failed to create \"bf\" processor, in pipeline \"logs\": telemetry type is not supported", }, { name: "not_supported_processor_metrics", @@ -384,7 +389,7 @@ func TestBuildErrors(t *testing.T) { component.NewID("bf"): badProcessorFactory.CreateDefaultConfig(), }, ExporterConfigs: map[component.ID]component.Config{ - component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(), + component.NewID("nop"): nopExporterFactory.CreateDefaultConfig(), }, PipelineConfigs: map[component.ID]*ConfigServicePipeline{ component.NewID("metrics"): { @@ -394,6 +399,7 @@ func TestBuildErrors(t *testing.T) { }, }, }, + expected: "failed to create \"bf\" processor, in pipeline \"metrics\": telemetry type is not supported", }, { name: "not_supported_processor_traces", @@ -405,7 +411,7 @@ func TestBuildErrors(t *testing.T) { component.NewID("bf"): badProcessorFactory.CreateDefaultConfig(), }, ExporterConfigs: map[component.ID]component.Config{ - component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(), + component.NewID("nop"): nopExporterFactory.CreateDefaultConfig(), }, PipelineConfigs: map[component.ID]*ConfigServicePipeline{ component.NewID("traces"): { @@ -415,6 +421,7 @@ func TestBuildErrors(t *testing.T) { }, }, }, + expected: "failed to create \"bf\" processor, in pipeline \"traces\": telemetry type is not supported", }, { name: "not_supported_receiver_logs", @@ -423,7 +430,7 @@ func TestBuildErrors(t *testing.T) { component.NewID("bf"): badReceiverFactory.CreateDefaultConfig(), }, ExporterConfigs: map[component.ID]component.Config{ - component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(), + component.NewID("nop"): nopExporterFactory.CreateDefaultConfig(), }, PipelineConfigs: map[component.ID]*ConfigServicePipeline{ component.NewID("logs"): { @@ -432,6 +439,7 @@ func TestBuildErrors(t *testing.T) { }, }, }, + expected: "failed to create \"bf\" receiver, in pipeline \"logs\": telemetry type is not supported", }, { name: "not_supported_receiver_metrics", @@ -440,7 +448,7 @@ func TestBuildErrors(t *testing.T) { component.NewID("bf"): badReceiverFactory.CreateDefaultConfig(), }, ExporterConfigs: map[component.ID]component.Config{ - component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(), + component.NewID("nop"): nopExporterFactory.CreateDefaultConfig(), }, PipelineConfigs: map[component.ID]*ConfigServicePipeline{ component.NewID("metrics"): { @@ -449,6 +457,7 @@ func TestBuildErrors(t *testing.T) { }, }, }, + expected: "failed to create \"bf\" receiver, in pipeline \"metrics\": telemetry type is not supported", }, { name: "not_supported_receiver_traces", @@ -457,7 +466,7 @@ func TestBuildErrors(t *testing.T) { component.NewID("bf"): badReceiverFactory.CreateDefaultConfig(), }, ExporterConfigs: map[component.ID]component.Config{ - component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(), + component.NewID("nop"): nopExporterFactory.CreateDefaultConfig(), }, PipelineConfigs: map[component.ID]*ConfigServicePipeline{ component.NewID("traces"): { @@ -466,6 +475,7 @@ func TestBuildErrors(t *testing.T) { }, }, }, + expected: "failed to create \"bf\" receiver, in pipeline \"traces\": telemetry type is not supported", }, { name: "unknown_exporter_config", @@ -474,15 +484,16 @@ func TestBuildErrors(t *testing.T) { component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, ExporterConfigs: map[component.ID]component.Config{ - component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(), + component.NewID("nop"): nopExporterFactory.CreateDefaultConfig(), }, PipelineConfigs: map[component.ID]*ConfigServicePipeline{ component.NewID("traces"): { Receivers: []component.ID{component.NewID("nop")}, - Exporters: []component.ID{component.NewID("nop"), component.NewID("nop/1")}, + Exporters: []component.ID{component.NewID("nop"), component.NewIDWithName("nop", "1")}, }, }, }, + expected: "exporter \"nop/1\" is not configured", }, { name: "unknown_exporter_factory", @@ -491,7 +502,7 @@ func TestBuildErrors(t *testing.T) { component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, ExporterConfigs: map[component.ID]component.Config{ - component.NewID("unknown"): nopReceiverFactory.CreateDefaultConfig(), + component.NewID("unknown"): nopExporterFactory.CreateDefaultConfig(), }, PipelineConfigs: map[component.ID]*ConfigServicePipeline{ component.NewID("traces"): { @@ -500,6 +511,7 @@ func TestBuildErrors(t *testing.T) { }, }, }, + expected: "exporter factory not available for: \"unknown\"", }, { name: "unknown_processor_config", @@ -511,16 +523,17 @@ func TestBuildErrors(t *testing.T) { component.NewID("nop"): nopProcessorFactory.CreateDefaultConfig(), }, ExporterConfigs: map[component.ID]component.Config{ - component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(), + component.NewID("nop"): nopExporterFactory.CreateDefaultConfig(), }, PipelineConfigs: map[component.ID]*ConfigServicePipeline{ component.NewID("metrics"): { Receivers: []component.ID{component.NewID("nop")}, - Processors: []component.ID{component.NewID("nop"), component.NewID("nop/1")}, + Processors: []component.ID{component.NewID("nop"), component.NewIDWithName("nop", "1")}, Exporters: []component.ID{component.NewID("nop")}, }, }, }, + expected: "processor \"nop/1\" is not configured", }, { name: "unknown_processor_factory", @@ -532,7 +545,7 @@ func TestBuildErrors(t *testing.T) { component.NewID("unknown"): nopProcessorFactory.CreateDefaultConfig(), }, ExporterConfigs: map[component.ID]component.Config{ - component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(), + component.NewID("nop"): nopExporterFactory.CreateDefaultConfig(), }, PipelineConfigs: map[component.ID]*ConfigServicePipeline{ component.NewID("metrics"): { @@ -542,6 +555,7 @@ func TestBuildErrors(t *testing.T) { }, }, }, + expected: "processor factory not available for: \"unknown\"", }, { name: "unknown_receiver_config", @@ -550,15 +564,16 @@ func TestBuildErrors(t *testing.T) { component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, ExporterConfigs: map[component.ID]component.Config{ - component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(), + component.NewID("nop"): nopExporterFactory.CreateDefaultConfig(), }, PipelineConfigs: map[component.ID]*ConfigServicePipeline{ component.NewID("logs"): { - Receivers: []component.ID{component.NewID("nop"), component.NewID("nop/1")}, + Receivers: []component.ID{component.NewID("nop"), component.NewIDWithName("nop", "1")}, Exporters: []component.ID{component.NewID("nop")}, }, }, }, + expected: "receiver \"nop/1\" is not configured", }, { name: "unknown_receiver_factory", @@ -567,7 +582,7 @@ func TestBuildErrors(t *testing.T) { component.NewID("unknown"): nopReceiverFactory.CreateDefaultConfig(), }, ExporterConfigs: map[component.ID]component.Config{ - component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(), + component.NewID("nop"): nopExporterFactory.CreateDefaultConfig(), }, PipelineConfigs: map[component.ID]*ConfigServicePipeline{ component.NewID("logs"): { @@ -576,6 +591,7 @@ func TestBuildErrors(t *testing.T) { }, }, }, + expected: "receiver factory not available for: \"unknown\"", }, } @@ -598,7 +614,7 @@ func TestBuildErrors(t *testing.T) { } _, err := buildPipelines(context.Background(), set) - assert.Error(t, err) + assert.EqualError(t, err, test.expected) }) } }