Skip to content

Commit 8a1511d

Browse files
authored
Merge pull request #189 from mjnichol2/mjnichol2
Removes logic that checks for a "port already in use" error
2 parents a8ea205 + a5c1704 commit 8a1511d

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

pkg/envtest/server.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ package envtest
1818

1919
import (
2020
"fmt"
21-
"net"
2221
"os"
2322
"path/filepath"
24-
"strings"
2523
"time"
2624

2725
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
@@ -169,17 +167,6 @@ func (te *Environment) startControlPlane() error {
169167
if err == nil {
170168
break
171169
}
172-
// code snippet copied from following answer on stackoverflow
173-
// https://stackoverflow.com/questions/51151973/catching-bind-address-already-in-use-in-golang
174-
if opErr, ok := err.(*net.OpError); ok {
175-
if opErr.Op == "listen" && strings.Contains(opErr.Error(), "address already in use") {
176-
if stopErr := te.ControlPlane.Stop(); stopErr != nil {
177-
return fmt.Errorf("failed to stop controlplane in response to bind error 'address already in use'")
178-
}
179-
}
180-
} else {
181-
return err
182-
}
183170
}
184171
if numTries == maxRetries {
185172
return fmt.Errorf("failed to start the controlplane. retried %d times", numTries)

0 commit comments

Comments
 (0)