|
|
@ -24,13 +24,15 @@ import (
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const namespace = "testNamespace"
|
|
|
|
|
|
|
|
|
|
|
|
const badChartDir = "rules/testdata/badchartfile"
|
|
|
|
const badChartDir = "rules/testdata/badchartfile"
|
|
|
|
const badValuesFileDir = "rules/testdata/badvaluesfile"
|
|
|
|
const badValuesFileDir = "rules/testdata/badvaluesfile"
|
|
|
|
const badYamlFileDir = "rules/testdata/albatross"
|
|
|
|
const badYamlFileDir = "rules/testdata/albatross"
|
|
|
|
const goodChartDir = "rules/testdata/goodone"
|
|
|
|
const goodChartDir = "rules/testdata/goodone"
|
|
|
|
|
|
|
|
|
|
|
|
func TestBadChart(t *testing.T) {
|
|
|
|
func TestBadChart(t *testing.T) {
|
|
|
|
m := All(badChartDir).Messages
|
|
|
|
m := All(badChartDir, namespace).Messages
|
|
|
|
if len(m) != 5 {
|
|
|
|
if len(m) != 5 {
|
|
|
|
t.Errorf("Number of errors %v", len(m))
|
|
|
|
t.Errorf("Number of errors %v", len(m))
|
|
|
|
t.Errorf("All didn't fail with expected errors, got %#v", m)
|
|
|
|
t.Errorf("All didn't fail with expected errors, got %#v", m)
|
|
|
@ -66,7 +68,7 @@ func TestBadChart(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestInvalidYaml(t *testing.T) {
|
|
|
|
func TestInvalidYaml(t *testing.T) {
|
|
|
|
m := All(badYamlFileDir).Messages
|
|
|
|
m := All(badYamlFileDir, namespace).Messages
|
|
|
|
if len(m) != 1 {
|
|
|
|
if len(m) != 1 {
|
|
|
|
t.Fatalf("All didn't fail with expected errors, got %#v", m)
|
|
|
|
t.Fatalf("All didn't fail with expected errors, got %#v", m)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -76,7 +78,7 @@ func TestInvalidYaml(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestBadValues(t *testing.T) {
|
|
|
|
func TestBadValues(t *testing.T) {
|
|
|
|
m := All(badValuesFileDir).Messages
|
|
|
|
m := All(badValuesFileDir, namespace).Messages
|
|
|
|
if len(m) != 1 {
|
|
|
|
if len(m) != 1 {
|
|
|
|
t.Fatalf("All didn't fail with expected errors, got %#v", m)
|
|
|
|
t.Fatalf("All didn't fail with expected errors, got %#v", m)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -86,7 +88,7 @@ func TestBadValues(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestGoodChart(t *testing.T) {
|
|
|
|
func TestGoodChart(t *testing.T) {
|
|
|
|
m := All(goodChartDir).Messages
|
|
|
|
m := All(goodChartDir, namespace).Messages
|
|
|
|
if len(m) != 0 {
|
|
|
|
if len(m) != 0 {
|
|
|
|
t.Errorf("All failed but shouldn't have: %#v", m)
|
|
|
|
t.Errorf("All failed but shouldn't have: %#v", m)
|
|
|
|
}
|
|
|
|
}
|
|
|
|