Make poll period and timeout configurable.

Make poll period short for integration testing.
pull/6/head
Brendan Burns 2014-07-07 09:36:55 -07:00
parent 9d001564bf
commit e3838e1153
3 changed files with 14 additions and 4 deletions

View File

@ -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)

View File

@ -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,
}
}

View File

@ -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,
}
}