kubernetes/pkg/api/validation
k8s-merge-robot 5a7b52b8d2 Merge pull request #26942 from xiangpengzhao/fix_testcase
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
```
2016-07-26 20:35:32 -07:00
..
testdata/v1 Check for an empty value in validateField 2016-05-30 14:12:18 +10:00
doc.go Use Go canonical import paths 2016-07-16 13:48:21 -04:00
events_test.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
events.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
name_test.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
name.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
schema_test.go Merge pull request #26942 from xiangpengzhao/fix_testcase 2016-07-26 20:35:32 -07:00
schema.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
validation_test.go Fix update validation for pods w/init containers. 2016-07-20 00:30:12 +03:00
validation.go Fix update validation for pods w/init containers. 2016-07-20 00:30:12 +03:00