Skip to content

Commit

Permalink
Merge pull request #185 from mengqiy/testenv_fix
Browse files Browse the repository at this point in the history
fix testenv
  • Loading branch information
k8s-ci-robot committed Oct 26, 2018
2 parents 4376e6e + dd4e86a commit a67a503
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/envtest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ const (
defaultKubebuilderPath = "/usr/local/kubebuilder/bin"
StartTimeout = 60
StopTimeout = 60

defaultKubebuilderControlPlaneStartTimeout = 20 * time.Second
defaultKubebuilderControlPlaneStopTimeout = 20 * time.Second
)

func defaultAssetPath(binary string) string {
Expand Down Expand Up @@ -118,12 +121,13 @@ func (te *Environment) Start() (*rest.Config, error) {
} else {
te.ControlPlane = integration.ControlPlane{}
te.ControlPlane.APIServer = &integration.APIServer{Args: defaultKubeAPIServerFlags}
te.ControlPlane.Etcd = &integration.Etcd{}

if os.Getenv(envKubeAPIServerBin) == "" {
te.ControlPlane.APIServer.Path = defaultAssetPath("kube-apiserver")
}
if os.Getenv(envEtcdBin) == "" {
te.ControlPlane.Etcd = &integration.Etcd{Path: defaultAssetPath("etcd")}
te.ControlPlane.Etcd.Path = defaultAssetPath("etcd")
}
if os.Getenv(envKubectlBin) == "" {
// we can't just set the path manually (it's behind a function), so set the environment variable instead
Expand Down Expand Up @@ -191,6 +195,8 @@ func (te *Environment) defaultTimeouts() error {
if err != nil {
return err
}
} else {
te.ControlPlaneStartTimeout = defaultKubebuilderControlPlaneStartTimeout
}
}

Expand All @@ -200,6 +206,8 @@ func (te *Environment) defaultTimeouts() error {
if err != nil {
return err
}
} else {
te.ControlPlaneStopTimeout = defaultKubebuilderControlPlaneStopTimeout
}
}
return nil
Expand Down

0 comments on commit a67a503

Please sign in to comment.