mirror of https://github.com/k3s-io/k3s
Make poll period and timeout configurable.
Make poll period short for integration testing.pull/6/head
parent
9d001564bf
commit
e3838e1153
|
@ -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)
|
||||
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue