Skip to content

Commit a67a503

Browse files
authored
Merge pull request kubernetes-sigs#185 from mengqiy/testenv_fix
fix testenv
2 parents 4376e6e + dd4e86a commit a67a503

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/envtest/server.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ const (
4141
defaultKubebuilderPath = "/usr/local/kubebuilder/bin"
4242
StartTimeout = 60
4343
StopTimeout = 60
44+
45+
defaultKubebuilderControlPlaneStartTimeout = 20 * time.Second
46+
defaultKubebuilderControlPlaneStopTimeout = 20 * time.Second
4447
)
4548

4649
func defaultAssetPath(binary string) string {
@@ -118,12 +121,13 @@ func (te *Environment) Start() (*rest.Config, error) {
118121
} else {
119122
te.ControlPlane = integration.ControlPlane{}
120123
te.ControlPlane.APIServer = &integration.APIServer{Args: defaultKubeAPIServerFlags}
124+
te.ControlPlane.Etcd = &integration.Etcd{}
121125

122126
if os.Getenv(envKubeAPIServerBin) == "" {
123127
te.ControlPlane.APIServer.Path = defaultAssetPath("kube-apiserver")
124128
}
125129
if os.Getenv(envEtcdBin) == "" {
126-
te.ControlPlane.Etcd = &integration.Etcd{Path: defaultAssetPath("etcd")}
130+
te.ControlPlane.Etcd.Path = defaultAssetPath("etcd")
127131
}
128132
if os.Getenv(envKubectlBin) == "" {
129133
// we can't just set the path manually (it's behind a function), so set the environment variable instead
@@ -191,6 +195,8 @@ func (te *Environment) defaultTimeouts() error {
191195
if err != nil {
192196
return err
193197
}
198+
} else {
199+
te.ControlPlaneStartTimeout = defaultKubebuilderControlPlaneStartTimeout
194200
}
195201
}
196202

@@ -200,6 +206,8 @@ func (te *Environment) defaultTimeouts() error {
200206
if err != nil {
201207
return err
202208
}
209+
} else {
210+
te.ControlPlaneStopTimeout = defaultKubebuilderControlPlaneStopTimeout
203211
}
204212
}
205213
return nil

0 commit comments

Comments
 (0)