diff --git a/cncd/pipeline/pipeline/frontend/yaml/matrix/matrix.go b/cncd/pipeline/pipeline/frontend/yaml/matrix/matrix.go index 76a0f6bed..7177e1a2f 100644 --- a/cncd/pipeline/pipeline/frontend/yaml/matrix/matrix.go +++ b/cncd/pipeline/pipeline/frontend/yaml/matrix/matrix.go @@ -40,9 +40,8 @@ func Parse(data []byte) ([]Axis, error) { return nil, err } - // if not a matrix build return an array with just the single axis. if len(matrix) == 0 { - return nil, nil + return []Axis{}, nil } return calc(matrix), nil diff --git a/cncd/pipeline/pipeline/frontend/yaml/matrix/matrix_test.go b/cncd/pipeline/pipeline/frontend/yaml/matrix/matrix_test.go index 0c4eef50a..690d71082 100644 --- a/cncd/pipeline/pipeline/frontend/yaml/matrix/matrix_test.go +++ b/cncd/pipeline/pipeline/frontend/yaml/matrix/matrix_test.go @@ -25,10 +25,10 @@ func TestMatrix(t *testing.T) { g.Assert(len(set)).Equal(24) }) - g.It("Should return nil if no matrix", func() { + g.It("Should return empty array if no matrix", func() { axis, err := ParseString("") g.Assert(err == nil).IsTrue() - g.Assert(axis == nil).IsTrue() + g.Assert(len(axis) == 0).IsTrue() }) g.It("Should return included axis", func() {