Commit e67786b2 authored by Clayton Coleman's avatar Clayton Coleman

Shorten kubecfg test by adding private variable for duration

parent cacd2ac4
...@@ -107,6 +107,12 @@ func SaveNamespaceInfo(path string, ns *NamespaceInfo) error { ...@@ -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 ...@@ -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
......
...@@ -23,6 +23,7 @@ import ( ...@@ -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 ...@@ -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{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment