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, "")
|
m := master.New(servers, machineList, fakePodInfoGetter{}, nil, "")
|
||||||
apiserver := httptest.NewServer(m.ConstructHandler("/api/v1beta1"))
|
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)
|
controllerManager.Run(1 * time.Second)
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||||
|
@ -69,6 +70,9 @@ type Client struct {
|
||||||
host string
|
host string
|
||||||
auth *AuthInfo
|
auth *AuthInfo
|
||||||
httpClient *http.Client
|
httpClient *http.Client
|
||||||
|
Sync bool
|
||||||
|
PollPeriod time.Duration
|
||||||
|
Timeout time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new client object.
|
// 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,
|
verb: verb,
|
||||||
c: c,
|
c: c,
|
||||||
path: "/api/v1beta1",
|
path: "/api/v1beta1",
|
||||||
sync: false,
|
sync: c.Sync,
|
||||||
timeout: 20 * time.Second,
|
timeout: c.Timeout,
|
||||||
pollPeriod: 20 * time.Second,
|
pollPeriod: c.PollPeriod,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue