mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Shorten kubecfg test by adding private variable for duration
This commit is contained in:
parent
cacd2ac40b
commit
e67786b2f0
@ -107,6 +107,12 @@ func SaveNamespaceInfo(path string, ns *NamespaceInfo) error {
|
||||
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.
|
||||
// 'name' points to a replication controller.
|
||||
// 'client' is used for updating pods.
|
||||
@ -149,7 +155,7 @@ func Update(ctx api.Context, name string, client client.Interface, 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)
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"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) {
|
||||
fakeClient := client.Fake{
|
||||
PodsList: api.PodList{
|
||||
|
Loading…
Reference in New Issue
Block a user