Commit 932663bd authored by vaikas-google's avatar vaikas-google

add test for malformed values.toml file

parent 012b0f7c
...@@ -7,6 +7,7 @@ import ( ...@@ -7,6 +7,7 @@ import (
) )
const badChartDir = "testdata/badchartfile" const badChartDir = "testdata/badchartfile"
const badValuesFileDir = "testdata/badvaluesfile"
const badYamlFileDir = "testdata/albatross" const badYamlFileDir = "testdata/albatross"
const goodChartDir = "testdata/goodone" const goodChartDir = "testdata/goodone"
...@@ -40,13 +41,23 @@ func TestBadChart(t *testing.T) { ...@@ -40,13 +41,23 @@ func TestBadChart(t *testing.T) {
func TestInvalidYaml(t *testing.T) { func TestInvalidYaml(t *testing.T) {
m := All(badYamlFileDir) m := All(badYamlFileDir)
if len(m) != 1 { if len(m) != 1 {
t.Errorf("All didn't fail with expected errors") t.Errorf("All didn't fail with expected errors, got %#v", m)
} }
if !strings.Contains(m[0].Text, "deliberateSyntaxError") { if !strings.Contains(m[0].Text, "deliberateSyntaxError") {
t.Errorf("All didn't have the error for deliberateSyntaxError") t.Errorf("All didn't have the error for deliberateSyntaxError")
} }
} }
func TestBadValues(t *testing.T) {
m := All(badValuesFileDir)
if len(m) != 1 {
t.Errorf("All didn't fail with expected errors, got %#v", m)
}
if !strings.Contains(m[0].Text, "Bare keys cannot contain ':'") {
t.Errorf("All didn't have the error for invalid key format")
}
}
func TestGoodChart(t *testing.T) { func TestGoodChart(t *testing.T) {
m := All(goodChartDir) m := All(goodChartDir)
if len(m) != 0 { if len(m) != 0 {
......
name: badvaluesfile
description: A Helm chart for Kubernetes
version: 0.0.1
home: ""
metadata:
name: {{.name | default "foo" | title}}
# Invalid value for badvaluesfile for testing lint fails with invalid toml format
name: "value"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment