/
githubmirror
/
origin
Обзор
Документация
Войти
/
githubmirror
/
origin
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/extended/router/reencrypt.go
81 строка
3 KB
Ross Brattain
Fix IPv6 handling in router tests.
23 окт 2024, 20:28
Не верифицирован
23 окт 2024, 20:28
507f35f
Код
Авторство
О чём код?
package router import ( "context" "fmt" "time" g "github.com/onsi/ginkgo/v2" o "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" admissionapi "k8s.io/pod-security-admission/api" routeclientset "github.com/openshift/client-go/route/clientset/versioned" exutil "github.com/openshift/origin/test/extended/util" ) var _ = g.Describe("[sig-network][Feature:Router][apigroup:route.openshift.io][apigroup:operator.openshift.io]", func() { defer g.GinkgoRecover() var ( configPath = exutil.FixturePath("testdata", "router", "reencrypt-serving-cert.yaml") oc *exutil.CLI ip, ns string ) // this hook must be registered before the framework namespace teardown // hook g.AfterEach(func() { if g.CurrentSpecReport().Failed() { client := routeclientset.NewForConfigOrDie(oc.AdminConfig()).RouteV1().Routes(ns) if routes, _ := client.List(context.Background(), metav1.ListOptions{}); routes != nil { outputIngress(routes.Items...) } exutil.DumpPodLogsStartingWithInNamespace("router", "openshift-ingress", oc.AsAdmin()) } }) oc = exutil.NewCLIWithPodSecurityLevel("router-reencrypt", admissionapi.LevelBaseline) g.BeforeEach(func() { var err error ip, err = exutil.WaitForRouterServiceIP(oc) o.Expect(err).NotTo(o.HaveOccurred()) ns = oc.KubeFramework().Namespace.Name }) g.Describe("The HAProxy router", func() { g.It("should support reencrypt to services backed by a serving certificate automatically", func() { routerURL := fmt.Sprintf("https://%s", exutil.IPUrl(ip)) execPod := exutil.CreateExecPodOrFail(oc.AdminKubeClient(), ns, "execpod") defer func() { oc.AdminKubeClient().CoreV1().Pods(ns).Delete(context.Background(), execPod.Name, *metav1.NewDeleteOptions(1)) }() g.By(fmt.Sprintf("deploying a service using a reencrypt route without a destinationCACertificate")) err := oc.Run("create").Args("-f", configPath).Execute() o.Expect(err).NotTo(o.HaveOccurred()) var hostname string err = wait.Poll(time.Second, changeTimeoutSeconds*time.Second, func() (bool, error) { route, err := oc.RouteClient().RouteV1().Routes(ns).Get(context.Background(), "serving-cert", metav1.GetOptions{}) if err != nil { return false, err } if len(route.Status.Ingress) == 0 || len(route.Status.Ingress[0].Host) == 0 { return false, nil } hostname = route.Status.Ingress[0].Host return true, nil }) o.Expect(err).NotTo(o.HaveOccurred()) // don't assume the router is available via external DNS, because of complexity err = waitForRouterOKResponseExec(ns, execPod.Name, routerURL, hostname, changeTimeoutSeconds) o.Expect(err).NotTo(o.HaveOccurred()) }) }) })