diff --git a/controllers/suite_test.go b/controllers/suite_test.go index d52ec084..29a05bc2 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -372,13 +372,20 @@ func setUpTestProxy() { true, "", testProxyHost, isOpenshift) createOrOverwriteResource(testProxyIngress) + Eventually(func(g Gomega) { + tlsConn, tlsErr := tls.Dial("tcp", clusterIngressHost+":443", + &tls.Config{ServerName: testProxyHost, InsecureSkipVerify: true}) + g.Expect(tlsErr).Should(BeNil()) + tlsConn.Close() + }, existingClusterTimeout, existingClusterInterval).Should(Succeed()) + http.DefaultTransport = &http.Transport{ DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { tlsConn, tlsErr := tls.Dial("tcp", clusterIngressHost+":443", &tls.Config{ServerName: testProxyHost, InsecureSkipVerify: true}) if tlsErr != nil { testProxyLog.V(1).Info("Error creating tls connection", "addr", addr, "error", tlsErr) - return nil, tlsErr + return nil, fmt.Errorf("Error creating tls connection to %s: %v", addr, tlsErr) } sshConn, sshChans, sshReqs, sshErr := ssh.NewClientConn(tlsConn, "127.0.0.1:2022", &ssh.ClientConfig{ @@ -388,9 +395,8 @@ func setUpTestProxy() { }) if sshErr != nil { testProxyLog.V(1).Info("Error creating SSH connection", "addr", addr, "error", sshErr) - fmt.Printf("\nError creating SSH tunnel to %s: %v", addr, sshErr) tlsConn.Close() - return nil, sshErr + return nil, fmt.Errorf("Error creating SSH connection to %s: %v", addr, sshErr) } sshClient := ssh.NewClient(sshConn, sshChans, sshReqs) @@ -401,7 +407,7 @@ func setUpTestProxy() { sshClient.Close() sshConn.Close() tlsConn.Close() - return nil, sshClientErr + return nil, fmt.Errorf("Error creating SSH tunnel to %s: %v", addr, sshClientErr) } testProxyLog.V(1).Info("Opened SSH tunnel", "addr", addr)