Merge pull request #2982 from HotelsDotCom/pkg-lint-test-panics

Avoid panics if test is failing
pull/2990/head
Matthew Fisher 7 years ago committed by GitHub
commit b600ea475e

@ -68,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).Messages
if len(m) != 1 { if len(m) != 1 {
t.Errorf("All didn't fail with expected errors, got %#v", m) t.Fatalf("All didn't fail with expected errors, got %#v", m)
} }
if !strings.Contains(m[0].Err.Error(), "deliberateSyntaxError") { if !strings.Contains(m[0].Err.Error(), "deliberateSyntaxError") {
t.Errorf("All didn't have the error for deliberateSyntaxError") t.Errorf("All didn't have the error for deliberateSyntaxError")
@ -78,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).Messages
if len(m) != 1 { if len(m) != 1 {
t.Errorf("All didn't fail with expected errors, got %#v", m) t.Fatalf("All didn't fail with expected errors, got %#v", m)
} }
if !strings.Contains(m[0].Err.Error(), "cannot unmarshal") { if !strings.Contains(m[0].Err.Error(), "cannot unmarshal") {
t.Errorf("All didn't have the error for invalid key format: %s", m[0].Err) t.Errorf("All didn't have the error for invalid key format: %s", m[0].Err)

Loading…
Cancel
Save