From e3838e1153ed4ddb01362b05f0dd2bf9c4685637 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Mon, 7 Jul 2014 09:36:55 -0700 Subject: [PATCH] Make poll period and timeout configurable. Make poll period short for integration testing. --- cmd/integration/integration.go | 5 ++++- pkg/client/client.go | 7 +++++++ pkg/client/request.go | 6 +++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cmd/integration/integration.go b/cmd/integration/integration.go index 12239f59a8..2369162b8e 100644 --- a/cmd/integration/integration.go +++ b/cmd/integration/integration.go @@ -76,7 +76,10 @@ func startComponents(manifestURL string) (apiServerURL string) { m := master.New(servers, machineList, fakePodInfoGetter{}, nil, "") apiserver := httptest.NewServer(m.ConstructHandler("/api/v1beta1")) - controllerManager := controller.MakeReplicationManager(etcd.NewClient(servers), client.New(apiserver.URL, nil)) + kClient := client.New(apiserver.URL, nil) + kClient.PollPeriod = time.Second * 1 + kClient.Sync = true + controllerManager := controller.MakeReplicationManager(etcd.NewClient(servers), kClient) controllerManager.Run(1 * time.Second) diff --git a/pkg/client/client.go b/pkg/client/client.go index effccae056..44dba84900 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -22,6 +22,7 @@ import ( "io" "io/ioutil" "net/http" + "time" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/labels" @@ -69,6 +70,9 @@ type Client struct { host string auth *AuthInfo httpClient *http.Client + Sync bool + PollPeriod time.Duration + Timeout time.Duration } // Create a new client object. @@ -83,6 +87,9 @@ func New(host string, auth *AuthInfo) *Client { }, }, }, + Sync: false, + PollPeriod: time.Second * 20, + Timeout: time.Second * 20, } } diff --git a/pkg/client/request.go b/pkg/client/request.go index 1850bce226..16da594aec 100644 --- a/pkg/client/request.go +++ b/pkg/client/request.go @@ -46,9 +46,9 @@ func (c *Client) Verb(verb string) *Request { verb: verb, c: c, path: "/api/v1beta1", - sync: false, - timeout: 20 * time.Second, - pollPeriod: 20 * time.Second, + sync: c.Sync, + timeout: c.Timeout, + pollPeriod: c.PollPeriod, } }