mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-03-20 01:23:09 -04:00
Automatic merge from submit-queue Fix panic in schema test If the swagger files for testing are lost, the func `loadSchemaForTest` or `NewSwaggerSchemaFromBytes` will return a non-nil error and a nil schema. In this case, the calling for `ValidateBytes` will result in panic. So, call Fatalf instead of Errorf. Also fix minor typos. Test logs: ``` --- FAIL: TestLoad (0.01s) schema_test.go:131: Failed to load: open ../../../api/swagger-spec/v1.json: no such file or directory --- FAIL: TestValidateOk (0.00s) schema_test.go:138: Failed to load: open ../../../api/swagger-spec/v1.json: no such file or directory panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal 0xb code=0x1 addr=0x20 pc=0x4d52df] goroutine 10 [running]: panic(0x15fffa0, 0xc8200100a0) /usr/local/go/src/runtime/panic.go:481 +0x3e6 testing.tRunner.func1(0xc820085a70) /usr/local/go/src/testing/testing.go:467 +0x192 panic(0x15fffa0, 0xc8200100a0) /usr/local/go/src/runtime/panic.go:443 +0x4e9 k8s.io/kubernetes/pkg/api/validation.TestValidateOk(0xc820085a70) /go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/api/validation/schema_test.go:159 +0x79f testing.tRunner(0xc820085a70, 0x22aad68) /usr/local/go/src/testing/testing.go:473 +0x98 created by testing.RunTests /usr/local/go/src/testing/testing.go:582 +0x892 FAIL k8s.io/kubernetes/pkg/api/validation 0.048s ``` |
||
|---|---|---|
| .. | ||
| annotations | ||
| endpoints | ||
| errors | ||
| install | ||
| meta | ||
| pod | ||
| resource | ||
| rest | ||
| service | ||
| testapi | ||
| testing | ||
| unversioned | ||
| util | ||
| v1 | ||
| validation | ||
| context.go | ||
| context_test.go | ||
| conversion.go | ||
| conversion_test.go | ||
| copy_test.go | ||
| deep_copy_test.go | ||
| doc.go | ||
| field_constants.go | ||
| generate.go | ||
| generate_test.go | ||
| helpers.go | ||
| helpers_test.go | ||
| mapper.go | ||
| meta.go | ||
| meta_test.go | ||
| node_example.json | ||
| OWNERS | ||
| ref.go | ||
| ref_test.go | ||
| register.go | ||
| replication_controller_example.json | ||
| requestcontext.go | ||
| resource_helpers.go | ||
| resource_helpers_test.go | ||
| serialization_proto_test.go | ||
| serialization_test.go | ||
| types.generated.go | ||
| types.go | ||
| zz_generated.deepcopy.go | ||