diff --git a/internal/elasticsearch/ingest/processors.go b/internal/elasticsearch/ingest/processors.go index 23b2f0e4c..bab9c506e 100644 --- a/internal/elasticsearch/ingest/processors.go +++ b/internal/elasticsearch/ingest/processors.go @@ -30,7 +30,10 @@ func (p Pipeline) Processors() (procs []Processor, err error) { default: return nil, fmt.Errorf("unsupported pipeline format: %s", p.Format) } - return procs, fmt.Errorf("failure processing %s pipeline '%s': %w", p.Format, p.Filename(), err) + if err != nil { + return nil, fmt.Errorf("failure processing %s pipeline '%s': %w", p.Format, p.Filename(), err) + } + return procs, nil } // extract a list of processors from a pipeline definition in YAML format. diff --git a/internal/elasticsearch/ingest/processors_test.go b/internal/elasticsearch/ingest/processors_test.go index 30523b90c..0d3d161d3 100644 --- a/internal/elasticsearch/ingest/processors_test.go +++ b/internal/elasticsearch/ingest/processors_test.go @@ -172,17 +172,11 @@ processors: } procs, err := p.Processors() if !tt.wantErr { - if !assert.NoError(t, err) { - t.Fatal(err) - } + assert.NoError(t, err) } else { - if !assert.Error(t, err) { - t.Fatal("error expected") - } - } - if !assert.Equal(t, tt.expected, procs) { - t.Errorf("Processors() gotProcs = %v, want %v", procs, tt.expected) + assert.Error(t, err) } + assert.Equal(t, tt.expected, procs) }) } }