From 2eb4f732e51771e5b83b9526de6e016c55ee1de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Garc=C3=ADa=20Veytia=20=28Puerco=29?= Date: Mon, 10 Jun 2024 19:26:42 -0600 Subject: [PATCH] Defalke TestParse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit deflakes the TestParse test Signed-off-by: Adolfo GarcĂ­a Veytia (Puerco) --- pkg/parser/parser_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/parser/parser_test.go b/pkg/parser/parser_test.go index 02aed0d..d0a218f 100644 --- a/pkg/parser/parser_test.go +++ b/pkg/parser/parser_test.go @@ -2,6 +2,7 @@ package parser import ( "reflect" + "sort" "testing" "github.com/stacklok/trusty-action/pkg/types" @@ -72,6 +73,10 @@ func TestParse(t *testing.T) { for _, test := range tests { deps, ecosystem, err := Parse(test.filename, test.content) + + sort.Slice(deps, func(i, j int) bool { return deps[i].Name < deps[j].Name }) + sort.Slice(test.expected, func(i, j int) bool { return test.expected[i].Name < test.expected[j].Name }) + if !reflect.DeepEqual(deps, test.expected) { t.Errorf("Expected dependencies %v, but got %v", test.expected, deps) }