From 6985f6f4eaacb1422ecbe14a1970ad8c2e6e8b1a Mon Sep 17 00:00:00 2001 From: Enin Kaduk Date: Tue, 11 Jun 2024 12:57:11 +0200 Subject: [PATCH] update: add test for --quiet flag Signed-off-by: Enin Kaduk --- pkg/action/lint_test.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pkg/action/lint_test.go b/pkg/action/lint_test.go index 80bf4ce7e..81224bb78 100644 --- a/pkg/action/lint_test.go +++ b/pkg/action/lint_test.go @@ -17,6 +17,7 @@ limitations under the License. package action import ( + //"fmt" "testing" ) @@ -77,7 +78,7 @@ func TestLintChart(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - _, err := lintChart(tt.chartPath, map[string]interface{}{}, namespace, nil) + _, err := lintChart(tt.chartPath, map[string]interface{}{}, namespace, nil, true) switch { case err != nil && !tt.err: t.Errorf("%s", err) @@ -157,3 +158,17 @@ func TestLint_ChartWithWarnings(t *testing.T) { } }) } + +func TestLint_ChartWithInfo(t *testing.T) { + t.Run("should pass with no INFO messages when quiet", func(t *testing.T) { + testCharts := []string{chart1MultipleChartLint} + testLint := NewLint() + testLint.Quiet = true + result := testLint.Run(testCharts, values) + for _, message := range result.Messages { + if message.Severity < 3 { + t.Error("expected no INFO(1) or UNKNOWN(0) messages, but got \nSeverity:", message.Severity, "\nError:", message.Err) + } + } + }) +}