Listing pods only once when getting pods for RS in deployment

This commit is contained in:
Janet Kuo
2016-06-07 16:58:18 -07:00
parent c88c9584a9
commit 764df2e096
7 changed files with 113 additions and 54 deletions

View File

@@ -96,7 +96,7 @@ func newPod(now time.Time, ready bool, beforeSec int) api.Pod {
}
}
func TestGetReadyPodsCount(t *testing.T) {
func TestCountAvailablePods(t *testing.T) {
now := time.Now()
tests := []struct {
pods []api.Pod
@@ -124,7 +124,7 @@ func TestGetReadyPodsCount(t *testing.T) {
}
for _, test := range tests {
if count := getReadyPodsCount(test.pods, int32(test.minReadySeconds)); int(count) != test.expected {
if count := countAvailablePods(test.pods, int32(test.minReadySeconds)); int(count) != test.expected {
t.Errorf("Pods = %#v, minReadySeconds = %d, expected %d, got %d", test.pods, test.minReadySeconds, test.expected, count)
}
}