Skip to content

Commit

Permalink
Use built-in checker to ensure webhook is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
kajinamit committed Jul 14, 2023
1 parent e92421b commit 3cc2be8
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions tests/functional/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ package functional_test

import (
"context"
"crypto/tls"
"fmt"
"net"
"net/http"
"path/filepath"
"testing"
"time"
Expand Down Expand Up @@ -177,15 +175,9 @@ var _ = BeforeSuite(func() {
}()

// wait for the webhook server to get ready
dialer := &net.Dialer{Timeout: time.Duration(10) * time.Second}
addrPort := fmt.Sprintf("%s:%d", webhookInstallOptions.LocalServingHost, webhookInstallOptions.LocalServingPort)
Eventually(func() error {
conn, err := tls.DialWithDialer(dialer, "tcp", addrPort, &tls.Config{InsecureSkipVerify: true})
if err != nil {
return err
}
conn.Close()
return nil
checker := k8sManager.GetWebhookServer().StartedChecker()
return checker(&http.Request{})
}).Should(Succeed())
})

Expand Down

0 comments on commit 3cc2be8

Please sign in to comment.