|
|
|
@ -27,6 +27,7 @@ import (
|
|
|
|
|
var values = []byte{}
|
|
|
|
|
|
|
|
|
|
const namespace = "testNamespace"
|
|
|
|
|
const strict = false
|
|
|
|
|
|
|
|
|
|
const badChartDir = "rules/testdata/badchartfile"
|
|
|
|
|
const badValuesFileDir = "rules/testdata/badvaluesfile"
|
|
|
|
@ -34,7 +35,7 @@ const badYamlFileDir = "rules/testdata/albatross"
|
|
|
|
|
const goodChartDir = "rules/testdata/goodone"
|
|
|
|
|
|
|
|
|
|
func TestBadChart(t *testing.T) {
|
|
|
|
|
m := All(badChartDir, values, namespace).Messages
|
|
|
|
|
m := All(badChartDir, values, namespace, strict).Messages
|
|
|
|
|
if len(m) != 5 {
|
|
|
|
|
t.Errorf("Number of errors %v", len(m))
|
|
|
|
|
t.Errorf("All didn't fail with expected errors, got %#v", m)
|
|
|
|
@ -70,7 +71,7 @@ func TestBadChart(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestInvalidYaml(t *testing.T) {
|
|
|
|
|
m := All(badYamlFileDir, values, namespace).Messages
|
|
|
|
|
m := All(badYamlFileDir, values, namespace, strict).Messages
|
|
|
|
|
if len(m) != 1 {
|
|
|
|
|
t.Fatalf("All didn't fail with expected errors, got %#v", m)
|
|
|
|
|
}
|
|
|
|
@ -80,7 +81,7 @@ func TestInvalidYaml(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestBadValues(t *testing.T) {
|
|
|
|
|
m := All(badValuesFileDir, values, namespace).Messages
|
|
|
|
|
m := All(badValuesFileDir, values, namespace, strict).Messages
|
|
|
|
|
if len(m) != 1 {
|
|
|
|
|
t.Fatalf("All didn't fail with expected errors, got %#v", m)
|
|
|
|
|
}
|
|
|
|
@ -90,7 +91,7 @@ func TestBadValues(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestGoodChart(t *testing.T) {
|
|
|
|
|
m := All(goodChartDir, values, namespace).Messages
|
|
|
|
|
m := All(goodChartDir, values, namespace, strict).Messages
|
|
|
|
|
if len(m) != 0 {
|
|
|
|
|
t.Errorf("All failed but shouldn't have: %#v", m)
|
|
|
|
|
}
|
|
|
|
|