Shorten kubecfg test by adding private variable for duration

This commit is contained in:
Clayton Coleman 2015-01-09 13:03:22 -05:00
parent cacd2ac40b
commit e67786b2f0
2 changed files with 12 additions and 1 deletions

View File

@ -107,6 +107,12 @@ func SaveNamespaceInfo(path string, ns *NamespaceInfo) error {
return err return err
} }
// extracted for test speed
var (
updatePollInterval = 5 * time.Second
updatePollTimeout = 300 * time.Second
)
// Update performs a rolling update of a collection of pods. // Update performs a rolling update of a collection of pods.
// 'name' points to a replication controller. // 'name' points to a replication controller.
// 'client' is used for updating pods. // 'client' is used for updating pods.
@ -149,7 +155,7 @@ func Update(ctx api.Context, name string, client client.Interface, updatePeriod
} }
time.Sleep(updatePeriod) time.Sleep(updatePeriod)
} }
return wait.Poll(time.Second*5, time.Second*300, func() (bool, error) { return wait.Poll(updatePollInterval, updatePollTimeout, func() (bool, error) {
podList, err := client.Pods(api.Namespace(ctx)).List(s) podList, err := client.Pods(api.Namespace(ctx)).List(s)
if err != nil { if err != nil {
return false, err return false, err

View File

@ -23,6 +23,7 @@ import (
"os" "os"
"reflect" "reflect"
"testing" "testing"
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client" "github.com/GoogleCloudPlatform/kubernetes/pkg/client"
@ -35,6 +36,10 @@ func validateAction(expectedAction, actualAction client.FakeAction, t *testing.T
} }
} }
func init() {
updatePollInterval = 1 * time.Millisecond
}
func TestUpdateWithPods(t *testing.T) { func TestUpdateWithPods(t *testing.T) {
fakeClient := client.Fake{ fakeClient := client.Fake{
PodsList: api.PodList{ PodsList: api.PodList{