From 709b68807621707714c50671560ff57a64b2c6f1 Mon Sep 17 00:00:00 2001 From: Camila Macedo Date: Sun, 31 Mar 2024 10:26:01 +0100 Subject: [PATCH] test --- test/e2e/v4/plugin_cluster_test.go | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/test/e2e/v4/plugin_cluster_test.go b/test/e2e/v4/plugin_cluster_test.go index fad1ee7b495..9ab480256a3 100644 --- a/test/e2e/v4/plugin_cluster_test.go +++ b/test/e2e/v4/plugin_cluster_test.go @@ -134,6 +134,24 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller bool) { err = kbc.LoadImageToKindCluster() ExpectWithOffset(1, err).NotTo(HaveOccurred()) + By("ensuring all cert-manager pods are ready") + certManagerPodsReady := func() error { + output, err := kbc.Kubectl.Get( + true, + "pods", + "--namespace", "cert-manager", + "--field-selector=status.phase!=Running", + ) + if err != nil { + return err + } + if output != "" { + return fmt.Errorf("not all cert-manager pods are running: %s", output) + } + return nil + } + Eventually(certManagerPodsReady, 5*time.Minute, 10*time.Second).Should(Succeed()) + var output []byte if !isToUseInstaller { // NOTE: If you want to run the test against a GKE cluster, you will need to grant yourself permission. @@ -158,7 +176,7 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller bool) { // https://cloud.google.com/kubernetes-engine/docs/how-to/role-based-access-control By("deploying the controller-manager with the installer") - _, err = kbc.Kubectl.Apply(true, "-f", "dist/install.yaml") + _, err = kbc.Kubectl.Apply(true, "--save-config", "-f", "dist/install.yaml") ExpectWithOffset(1, err).NotTo(HaveOccurred()) } @@ -217,6 +235,16 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller bool) { "secrets", "webhook-server-cert") return err }, time.Minute, time.Second).Should(Succeed()) + + By("checking cert-manager webhook is ready") + _, err = kbc.Kubectl.Get( + true, + "pods", + "-l", "app.kubernetes.io/name=webhook", + "-n", "cert-manager", + "-o", "jsonpath={.items[*].status.conditions[?(@.type=='Ready')].status}", + ) + Expect(err).NotTo(HaveOccurred(), "cert-manager webhook should be ready") } By("validating that the Prometheus manager has provisioned the Service")