From 1002ec5ae981b5dd4517b8a75bd4d088efab0bbd Mon Sep 17 00:00:00 2001 From: Zach Burgess Date: Mon, 7 Jul 2025 21:11:05 -0700 Subject: [PATCH] Update tests in lint_test.go Signed-off-by: Zach Burgess --- pkg/lint/lint_test.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkg/lint/lint_test.go b/pkg/lint/lint_test.go index 6e7f40ef6..63cf017e4 100644 --- a/pkg/lint/lint_test.go +++ b/pkg/lint/lint_test.go @@ -39,18 +39,23 @@ const invalidChartFileDir = "rules/testdata/invalidchartfile" func TestBadChart(t *testing.T) { m := RunAll(badChartDir, values, namespace).Messages - if len(m) != 7 { + if len(m) != 8 { t.Errorf("Number of errors %v", len(m)) t.Errorf("All didn't fail with expected errors, got %#v", m) } - // There should be one INFO, and 2 ERROR messages, check for them - var i, e, e2, e3, e4, e5, e6 bool + // There should be one INFO, one WARNING, and 2 ERROR messages, check for them + var i, w, e, e2, e3, e4, e5, e6 bool for _, msg := range m { if msg.Severity == support.InfoSev { if strings.Contains(msg.Err.Error(), "icon is recommended") { i = true } } + if msg.Severity == support.WarningSev { + if strings.Contains(msg.Err.Error(), "does not exist") { + w = true + } + } if msg.Severity == support.ErrorSev { if strings.Contains(msg.Err.Error(), "version '0.0.0.0' is not a valid SemVer") { e = true @@ -76,7 +81,7 @@ func TestBadChart(t *testing.T) { } } } - if !e || !e2 || !e3 || !e4 || !e5 || !i || !e6 { + if !e || !e2 || !e3 || !e4 || !e5 || !i || !e6 || !w { t.Errorf("Didn't find all the expected errors, got %#v", m) } } @@ -93,7 +98,7 @@ func TestInvalidYaml(t *testing.T) { func TestInvalidChartYaml(t *testing.T) { m := RunAll(invalidChartFileDir, values, namespace).Messages - if len(m) != 1 { + if len(m) != 2 { t.Fatalf("All didn't fail with expected errors, got %#v", m) } if !strings.Contains(m[0].Err.Error(), "failed to strictly parse chart metadata file") {