add test for malformed values.toml file

pull/704/head
vaikas-google 9 years ago
parent 012b0f7c3e
commit 932663bd5f

@ -7,6 +7,7 @@ import (
)
const badChartDir = "testdata/badchartfile"
const badValuesFileDir = "testdata/badvaluesfile"
const badYamlFileDir = "testdata/albatross"
const goodChartDir = "testdata/goodone"
@ -40,13 +41,23 @@ func TestBadChart(t *testing.T) {
func TestInvalidYaml(t *testing.T) {
m := All(badYamlFileDir)
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") {
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) {
m := All(goodChartDir)
if len(m) != 0 {

@ -0,0 +1,4 @@
name: badvaluesfile
description: A Helm chart for Kubernetes
version: 0.0.1
home: ""

@ -0,0 +1,2 @@
metadata:
name: {{.name | default "foo" | title}}

@ -0,0 +1,2 @@
# Invalid value for badvaluesfile for testing lint fails with invalid toml format
name: "value"
Loading…
Cancel
Save