|
|
@ -332,3 +332,37 @@ func TestValidateTopIndentLevel(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TestEmptyWithCommentsManifests checks the lint is not failing against empty manifests that contains only comments
|
|
|
|
|
|
|
|
// See https://github.com/helm/helm/issues/8621
|
|
|
|
|
|
|
|
func TestEmptyWithCommentsManifests(t *testing.T) {
|
|
|
|
|
|
|
|
mychart := chart.Chart{
|
|
|
|
|
|
|
|
Metadata: &chart.Metadata{
|
|
|
|
|
|
|
|
APIVersion: "v2",
|
|
|
|
|
|
|
|
Name: "emptymanifests",
|
|
|
|
|
|
|
|
Version: "0.1.0",
|
|
|
|
|
|
|
|
Icon: "satisfy-the-linting-gods.gif",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
Templates: []*chart.File{
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Name: "templates/empty-with-comments.yaml",
|
|
|
|
|
|
|
|
Data: []byte("#@formatter:off\n"),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tmpdir := ensure.TempDir(t)
|
|
|
|
|
|
|
|
defer os.RemoveAll(tmpdir)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err := chartutil.SaveDir(&mychart, tmpdir); err != nil {
|
|
|
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
linter := support.Linter{ChartDir: filepath.Join(tmpdir, mychart.Name())}
|
|
|
|
|
|
|
|
Templates(&linter, values, namespace, strict)
|
|
|
|
|
|
|
|
if l := len(linter.Messages); l > 0 {
|
|
|
|
|
|
|
|
for i, msg := range linter.Messages {
|
|
|
|
|
|
|
|
t.Logf("Message %d: %s", i, msg)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
t.Fatalf("Expected 0 lint errors, got %d", l)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|