diff --git a/pkg/api/validation/schema_test.go b/pkg/api/validation/schema_test.go index e51aaa34305..94c90b066e1 100644 --- a/pkg/api/validation/schema_test.go +++ b/pkg/api/validation/schema_test.go @@ -135,7 +135,7 @@ func TestLoad(t *testing.T) { func TestValidateOk(t *testing.T) { schema, err := loadSchemaForTest() if err != nil { - t.Errorf("Failed to load: %v", err) + t.Fatalf("Failed to load: %v", err) } tests := []struct { obj runtime.Object @@ -167,7 +167,7 @@ func TestValidateOk(t *testing.T) { func TestValidateDifferentApiVersions(t *testing.T) { schema, err := loadSchemaForTest() if err != nil { - t.Errorf("Failed to load: %v", err) + t.Fatalf("Failed to load: %v", err) } pod := &api.Pod{} @@ -203,7 +203,7 @@ func TestValidateDifferentApiVersions(t *testing.T) { func TestInvalid(t *testing.T) { schema, err := loadSchemaForTest() if err != nil { - t.Errorf("Failed to load: %v", err) + t.Fatalf("Failed to load: %v", err) } tests := []string{ "invalidPod1.json", // command is a string, instead of []string. @@ -227,7 +227,7 @@ func TestInvalid(t *testing.T) { func TestValid(t *testing.T) { schema, err := loadSchemaForTest() if err != nil { - t.Errorf("Failed to load: %v", err) + t.Fatalf("Failed to load: %v", err) } tests := []string{ "validPod.yaml", @@ -239,7 +239,7 @@ func TestValid(t *testing.T) { } err = schema.ValidateBytes(pod) if err != nil { - t.Errorf("unexpected error %s, for pod %s", err, pod) + t.Errorf("unexpected error: %s, for pod %s", err, pod) } } } @@ -274,7 +274,7 @@ func TestVersionRegex(t *testing.T) { // Tests that validation works fine when spec contains "type": "any" instead of "type": "object" // Ref: https://github.com/kubernetes/kubernetes/issues/24309 -func TestTypeOAny(t *testing.T) { +func TestTypeAny(t *testing.T) { data, err := readSwaggerFile() if err != nil { t.Errorf("failed to read swagger file: %v", err) @@ -283,7 +283,7 @@ func TestTypeOAny(t *testing.T) { newData := strings.Replace(string(data), `"type": "object"`, `"type": "any"`, -1) schema, err := NewSwaggerSchemaFromBytes([]byte(newData), nil) if err != nil { - t.Errorf("Failed to load: %v", err) + t.Fatalf("Failed to load: %v", err) } tests := []string{ "validPod.yaml", @@ -304,7 +304,7 @@ func TestTypeOAny(t *testing.T) { } err = schema.ValidateBytes(podBytes) if err != nil { - t.Errorf("unexpected error %s, for pod %s", err, string(podBytes)) + t.Errorf("unexpected error: %s, for pod %s", err, string(podBytes)) } } }