k3s/pkg/controller/petset
Kubernetes Submit Queue 6c1c0b9842 Merge pull request #32027 from m1093782566/m109-petset-fix-test-err
Automatic merge from submit-queue

[BUG FIX] Fix bug of UT in Pet Set

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

**What this PR does / why we need it**:

Fix bug of UT in Pet Set.

[1] https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/petset/pet_set_test.go#L74-L75, 

I think` len(pl)` is not equal to `len(fc.pets)`, see [here](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/petset/fakes.go#L229-L233)

[2] https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/petset/fakes.go#L249

I think should change to 

```
if len(f.pets) <= index {
```

because when `len(f.pets)==index`, then [here](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/petset/fakes.go#L252-L254) will cause `index out of range` panic!

[3] https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/petset/fakes.go#L271

same reason with [2]

[4] https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/petset/pet_set_test.go#L79

which doesn't make use of the error returned by [setHealthy](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/petset/fakes.go#L248) and has a risk of letting the error out.

Should we catch the error and use `t.Errorf()` to stop the test?
2016-09-26 21:13:14 -07:00
..
fakes.go Merge pull request #32027 from m1093782566/m109-petset-fix-test-err 2016-09-26 21:13:14 -07:00
identity_mappers.go Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
identity_mappers_test.go Merge pull request #29502 from lixiaobing10051267/masterHostName 2016-08-12 00:31:53 -07:00
iterator.go let RC manager utilize the GC 2016-07-14 19:59:31 -07:00
iterator_test.go Run goimports 2016-08-02 15:12:39 +03:00
pet.go switch controller manager to generated clientset 2016-09-20 12:53:47 -04:00
pet_set.go switch controller manager to generated clientset 2016-09-20 12:53:47 -04:00
pet_set_test.go fix petset ut bug 2016-09-07 00:26:25 +08:00
pet_set_utils.go switch controller manager to generated clientset 2016-09-20 12:53:47 -04:00