File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
pkg/internal/testing/controlplane Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -47,13 +47,18 @@ type ControlPlane struct {
4747}
4848
4949// Start will start your control plane processes. To stop them, call Stop().
50- func (f * ControlPlane ) Start () error {
50+ func (f * ControlPlane ) Start () ( retErr error ) {
5151 if f .Etcd == nil {
5252 f .Etcd = & Etcd {}
5353 }
5454 if err := f .Etcd .Start (); err != nil {
5555 return err
5656 }
57+ defer func () {
58+ if retErr != nil {
59+ _ = f .Etcd .Stop ()
60+ }
61+ }()
5762
5863 if f .APIServer == nil {
5964 f .APIServer = & APIServer {}
@@ -62,6 +67,11 @@ func (f *ControlPlane) Start() error {
6267 if err := f .APIServer .Start (); err != nil {
6368 return err
6469 }
70+ defer func () {
71+ if retErr != nil {
72+ _ = f .APIServer .Stop ()
73+ }
74+ }()
6575
6676 // provision the default user -- can be removed when the related
6777 // methods are removed. The default user has admin permissions to
@@ -88,6 +98,7 @@ func (f *ControlPlane) Stop() error {
8898 errList = append (errList , err )
8999 }
90100 }
101+
91102 if f .Etcd != nil {
92103 if err := f .Etcd .Stop (); err != nil {
93104 errList = append (errList , err )
You can’t perform that action at this time.
0 commit comments