|
|
@ -55,7 +55,7 @@ const strict = false
|
|
|
|
|
|
|
|
|
|
|
|
func TestTemplateParsing(t *testing.T) {
|
|
|
|
func TestTemplateParsing(t *testing.T) {
|
|
|
|
linter := support.Linter{ChartDir: templateTestBasedir}
|
|
|
|
linter := support.Linter{ChartDir: templateTestBasedir}
|
|
|
|
Templates(&linter, values, namespace, strict)
|
|
|
|
Templates(&linter, values, namespace, strict, nil)
|
|
|
|
res := linter.Messages
|
|
|
|
res := linter.Messages
|
|
|
|
|
|
|
|
|
|
|
|
if len(res) != 1 {
|
|
|
|
if len(res) != 1 {
|
|
|
@ -78,7 +78,7 @@ func TestTemplateIntegrationHappyPath(t *testing.T) {
|
|
|
|
defer os.Rename(ignoredTemplatePath, wrongTemplatePath)
|
|
|
|
defer os.Rename(ignoredTemplatePath, wrongTemplatePath)
|
|
|
|
|
|
|
|
|
|
|
|
linter := support.Linter{ChartDir: templateTestBasedir}
|
|
|
|
linter := support.Linter{ChartDir: templateTestBasedir}
|
|
|
|
Templates(&linter, values, namespace, strict)
|
|
|
|
Templates(&linter, values, namespace, strict, nil)
|
|
|
|
res := linter.Messages
|
|
|
|
res := linter.Messages
|
|
|
|
|
|
|
|
|
|
|
|
if len(res) != 0 {
|
|
|
|
if len(res) != 0 {
|
|
|
@ -88,7 +88,7 @@ func TestTemplateIntegrationHappyPath(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
func TestV3Fail(t *testing.T) {
|
|
|
|
func TestV3Fail(t *testing.T) {
|
|
|
|
linter := support.Linter{ChartDir: "./testdata/v3-fail"}
|
|
|
|
linter := support.Linter{ChartDir: "./testdata/v3-fail"}
|
|
|
|
Templates(&linter, values, namespace, strict)
|
|
|
|
Templates(&linter, values, namespace, strict, nil)
|
|
|
|
res := linter.Messages
|
|
|
|
res := linter.Messages
|
|
|
|
|
|
|
|
|
|
|
|
if len(res) != 3 {
|
|
|
|
if len(res) != 3 {
|
|
|
@ -108,7 +108,7 @@ func TestV3Fail(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
func TestMultiTemplateFail(t *testing.T) {
|
|
|
|
func TestMultiTemplateFail(t *testing.T) {
|
|
|
|
linter := support.Linter{ChartDir: "./testdata/multi-template-fail"}
|
|
|
|
linter := support.Linter{ChartDir: "./testdata/multi-template-fail"}
|
|
|
|
Templates(&linter, values, namespace, strict)
|
|
|
|
Templates(&linter, values, namespace, strict, nil)
|
|
|
|
res := linter.Messages
|
|
|
|
res := linter.Messages
|
|
|
|
|
|
|
|
|
|
|
|
if len(res) != 1 {
|
|
|
|
if len(res) != 1 {
|
|
|
@ -229,7 +229,7 @@ func TestDeprecatedAPIFails(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
linter := support.Linter{ChartDir: filepath.Join(tmpdir, mychart.Name())}
|
|
|
|
linter := support.Linter{ChartDir: filepath.Join(tmpdir, mychart.Name())}
|
|
|
|
Templates(&linter, values, namespace, strict)
|
|
|
|
Templates(&linter, values, namespace, strict, nil)
|
|
|
|
if l := len(linter.Messages); l != 1 {
|
|
|
|
if l := len(linter.Messages); l != 1 {
|
|
|
|
for i, msg := range linter.Messages {
|
|
|
|
for i, msg := range linter.Messages {
|
|
|
|
t.Logf("Message %d: %s", i, msg)
|
|
|
|
t.Logf("Message %d: %s", i, msg)
|
|
|
@ -286,7 +286,7 @@ func TestStrictTemplateParsingMapError(t *testing.T) {
|
|
|
|
linter := &support.Linter{
|
|
|
|
linter := &support.Linter{
|
|
|
|
ChartDir: filepath.Join(dir, ch.Metadata.Name),
|
|
|
|
ChartDir: filepath.Join(dir, ch.Metadata.Name),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Templates(linter, ch.Values, namespace, strict)
|
|
|
|
Templates(linter, ch.Values, namespace, strict, nil)
|
|
|
|
if len(linter.Messages) != 0 {
|
|
|
|
if len(linter.Messages) != 0 {
|
|
|
|
t.Errorf("expected zero messages, got %d", len(linter.Messages))
|
|
|
|
t.Errorf("expected zero messages, got %d", len(linter.Messages))
|
|
|
|
for i, msg := range linter.Messages {
|
|
|
|
for i, msg := range linter.Messages {
|
|
|
@ -416,7 +416,7 @@ func TestEmptyWithCommentsManifests(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
linter := support.Linter{ChartDir: filepath.Join(tmpdir, mychart.Name())}
|
|
|
|
linter := support.Linter{ChartDir: filepath.Join(tmpdir, mychart.Name())}
|
|
|
|
Templates(&linter, values, namespace, strict)
|
|
|
|
Templates(&linter, values, namespace, strict, nil)
|
|
|
|
if l := len(linter.Messages); l > 0 {
|
|
|
|
if l := len(linter.Messages); l > 0 {
|
|
|
|
for i, msg := range linter.Messages {
|
|
|
|
for i, msg := range linter.Messages {
|
|
|
|
t.Logf("Message %d: %s", i, msg)
|
|
|
|
t.Logf("Message %d: %s", i, msg)
|
|
|
|