|
|
|
@ -39,18 +39,23 @@ const invalidChartFileDir = "rules/testdata/invalidchartfile"
|
|
|
|
|
|
|
|
|
|
func TestBadChart(t *testing.T) {
|
|
|
|
|
m := RunAll(badChartDir, values, namespace).Messages
|
|
|
|
|
if len(m) != 7 {
|
|
|
|
|
if len(m) != 8 {
|
|
|
|
|
t.Errorf("Number of errors %v", len(m))
|
|
|
|
|
t.Errorf("All didn't fail with expected errors, got %#v", m)
|
|
|
|
|
}
|
|
|
|
|
// There should be one INFO, and 2 ERROR messages, check for them
|
|
|
|
|
var i, e, e2, e3, e4, e5, e6 bool
|
|
|
|
|
// There should be one INFO, one WARNING, and 2 ERROR messages, check for them
|
|
|
|
|
var i, w, e, e2, e3, e4, e5, e6 bool
|
|
|
|
|
for _, msg := range m {
|
|
|
|
|
if msg.Severity == support.InfoSev {
|
|
|
|
|
if strings.Contains(msg.Err.Error(), "icon is recommended") {
|
|
|
|
|
i = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if msg.Severity == support.WarningSev {
|
|
|
|
|
if strings.Contains(msg.Err.Error(), "does not exist") {
|
|
|
|
|
w = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if msg.Severity == support.ErrorSev {
|
|
|
|
|
if strings.Contains(msg.Err.Error(), "version '0.0.0.0' is not a valid SemVer") {
|
|
|
|
|
e = true
|
|
|
|
@ -76,7 +81,7 @@ func TestBadChart(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !e || !e2 || !e3 || !e4 || !e5 || !i || !e6 {
|
|
|
|
|
if !e || !e2 || !e3 || !e4 || !e5 || !i || !e6 || !w {
|
|
|
|
|
t.Errorf("Didn't find all the expected errors, got %#v", m)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -93,7 +98,7 @@ func TestInvalidYaml(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
func TestInvalidChartYaml(t *testing.T) {
|
|
|
|
|
m := RunAll(invalidChartFileDir, values, namespace).Messages
|
|
|
|
|
if len(m) != 1 {
|
|
|
|
|
if len(m) != 2 {
|
|
|
|
|
t.Fatalf("All didn't fail with expected errors, got %#v", m)
|
|
|
|
|
}
|
|
|
|
|
if !strings.Contains(m[0].Err.Error(), "failed to strictly parse chart metadata file") {
|
|
|
|
|