integration tests: add env. variable for etcd URL.
Many integration tests delete all keys in etcd as part of their cleanup. To run these tests in parallel we must run several etcd daemons, each on different port and pass etcd url to the test suite.
This commit is contained in:
@@ -28,6 +28,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/storage"
|
||||
etcdstorage "k8s.io/kubernetes/pkg/storage/etcd"
|
||||
"k8s.io/kubernetes/pkg/storage/etcd/etcdtest"
|
||||
"k8s.io/kubernetes/pkg/util/env"
|
||||
)
|
||||
|
||||
// If you need to start an etcd instance by hand, you also need to insert a key
|
||||
@@ -37,9 +38,15 @@ func init() {
|
||||
RequireEtcd()
|
||||
}
|
||||
|
||||
func GetEtcdURLFromEnv() string {
|
||||
url := env.GetEnvAsStringOrFallback("KUBE_INTEGRATION_ETCD_URL", "http://127.0.0.1:4001")
|
||||
glog.V(4).Infof("Using KUBE_INTEGRATION_ETCD_URL=%q", url)
|
||||
return url
|
||||
}
|
||||
|
||||
func NewEtcdClient() etcd.Client {
|
||||
cfg := etcd.Config{
|
||||
Endpoints: []string{"http://127.0.0.1:4001"},
|
||||
Endpoints: []string{GetEtcdURLFromEnv()},
|
||||
}
|
||||
client, err := etcd.New(cfg)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user