From 80203705675d005f6e3bf0bd7629445f5202e5e0 Mon Sep 17 00:00:00 2001 From: Christina Lau Date: Thu, 16 May 2024 11:50:16 -0700 Subject: [PATCH 1/3] Temp remove login --- test/e2e/runner.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/e2e/runner.go b/test/e2e/runner.go index 262b326f7..91e54a390 100644 --- a/test/e2e/runner.go +++ b/test/e2e/runner.go @@ -63,10 +63,10 @@ func main() { log.Fatalf("Error while trying to setup azure account: %s\n", err) } - err := acct.Login() - if err != nil { - log.Fatalf("Error while trying to login to azure account! %s\n", err) - } + // err := acct.Login() + // if err != nil { + // log.Fatalf("Error while trying to login to azure account! %s\n", err) + // } err = acct.SetSubscription() if err != nil { From b2e39d3014ef42e8dcfb24873868cdba1a07dee0 Mon Sep 17 00:00:00 2001 From: Christina Lau Date: Thu, 16 May 2024 13:00:35 -0700 Subject: [PATCH 2/3] Add SkipAzLogin parameter to test --- test/e2e/config/config.go | 1 + test/e2e/runner.go | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test/e2e/config/config.go b/test/e2e/config/config.go index 9d1e89efc..1c7db2fd1 100644 --- a/test/e2e/config/config.go +++ b/test/e2e/config/config.go @@ -26,6 +26,7 @@ import ( // Config holds global test configuration type Config struct { + SkipAzLogin bool `envconfig:"SKIP_AZ_LOGIN" default:"false"` SkipTest bool `envconfig:"SKIP_TEST" default:"false"` SkipLogsCollection bool `envconfig:"SKIP_LOGS_COLLECTION" default:"true"` Orchestrator string `envconfig:"ORCHESTRATOR" default:"kubernetes"` diff --git a/test/e2e/runner.go b/test/e2e/runner.go index 91e54a390..5d8d597a9 100644 --- a/test/e2e/runner.go +++ b/test/e2e/runner.go @@ -63,10 +63,12 @@ func main() { log.Fatalf("Error while trying to setup azure account: %s\n", err) } - // err := acct.Login() - // if err != nil { - // log.Fatalf("Error while trying to login to azure account! %s\n", err) - // } + if !cfg.SkipAzLogin { + err := acct.Login() + if err != nil { + log.Fatalf("Error while trying to login to azure account! %s\n", err) + } + } err = acct.SetSubscription() if err != nil { From ee8cf51b0c85fe16a49aef463ecda0fe6c2b1522 Mon Sep 17 00:00:00 2001 From: Christina Lau Date: Thu, 16 May 2024 17:25:51 -0700 Subject: [PATCH 3/3] Add CheckIngressIPOnly parameter --- test/e2e/config/config.go | 1 + test/e2e/kubernetes/kubernetes_test.go | 12 ++++++------ test/e2e/kubernetes/service/service.go | 9 ++++++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/test/e2e/config/config.go b/test/e2e/config/config.go index 1c7db2fd1..523e57432 100644 --- a/test/e2e/config/config.go +++ b/test/e2e/config/config.go @@ -64,6 +64,7 @@ type Config struct { AddNodePoolInput string `envconfig:"ADD_NODE_POOL_INPUT" default:""` TestPVC bool `envconfig:"TEST_PVC" default:"false"` CleanPVC bool `envconfig:"CLEAN_PVC" default:"true"` + CheckIngressIPOnly bool `envconfig:"CHECK_INGRESS_IP_ONLY" default:"false"` SubscriptionID string `envconfig:"SUBSCRIPTION_ID"` ClientID string `envconfig:"CLIENT_ID"` ClientSecret string `envconfig:"CLIENT_SECRET"` diff --git a/test/e2e/kubernetes/kubernetes_test.go b/test/e2e/kubernetes/kubernetes_test.go index 94514ac6f..281f3fa18 100644 --- a/test/e2e/kubernetes/kubernetes_test.go +++ b/test/e2e/kubernetes/kubernetes_test.go @@ -1779,7 +1779,7 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu Expect(err).NotTo(HaveOccurred()) By("Ensuring we can connect to the ELB service on the service IP") - err = sELB.ValidateWithRetry("(Welcome to nginx)", 30*time.Second, cfg.Timeout) + err = sELB.ValidateWithRetry("(Welcome to nginx)", cfg.CheckIngressIPOnly, 30*time.Second, cfg.Timeout) Expect(err).NotTo(HaveOccurred()) By("Ensuring we can connect to the ELB service from another pod") @@ -1793,7 +1793,7 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu log.Printf("%s\n", string(out)) Expect(err).NotTo(HaveOccurred()) } - err = sELB.ValidateWithRetry("(Welcome to nginx)", 30*time.Second, cfg.Timeout) + err = sELB.ValidateWithRetry("(Welcome to nginx)", cfg.CheckIngressIPOnly, 30*time.Second, cfg.Timeout) Expect(err).NotTo(HaveOccurred()) err = sELB.Delete(util.DefaultDeleteRetries) @@ -2223,7 +2223,7 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu Expect(err).NotTo(HaveOccurred()) By("Verifying that the service is reachable and returns the default IIS start page") - err = iisService.ValidateWithRetry("(IIS Windows Server)", sleepBetweenRetriesWhenWaitingForPodReady, cfg.Timeout) + err = iisService.ValidateWithRetry("(IIS Windows Server)", cfg.CheckIngressIPOnly, sleepBetweenRetriesWhenWaitingForPodReady, cfg.Timeout) Expect(err).NotTo(HaveOccurred()) By("Checking that each pod can reach the internet") @@ -2253,7 +2253,7 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu Expect(len(iisPods)).To(Equal(5)) By("Verifying that the service is reachable and returns the default IIS start page") - err = iisService.ValidateWithRetry("(IIS Windows Server)", sleepBetweenRetriesWhenWaitingForPodReady, cfg.Timeout) + err = iisService.ValidateWithRetry("(IIS Windows Server)", cfg.CheckIngressIPOnly, sleepBetweenRetriesWhenWaitingForPodReady, cfg.Timeout) Expect(err).NotTo(HaveOccurred()) By("Checking that each pod can reach the internet") @@ -2277,7 +2277,7 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu Expect(len(iisPods)).To(Equal(2)) By("Verifying that the service is reachable and returns the default IIS start page") - err = iisService.ValidateWithRetry("(IIS Windows Server)", sleepBetweenRetriesWhenWaitingForPodReady, cfg.Timeout) + err = iisService.ValidateWithRetry("(IIS Windows Server)", cfg.CheckIngressIPOnly, sleepBetweenRetriesWhenWaitingForPodReady, cfg.Timeout) Expect(err).NotTo(HaveOccurred()) By("Checking that each pod can reach the internet") @@ -2298,7 +2298,7 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu log.Printf("%s\n", string(out)) Expect(err).NotTo(HaveOccurred()) } - err = iisService.ValidateWithRetry("(IIS Windows Server)", 30*time.Second, cfg.Timeout) + err = iisService.ValidateWithRetry("(IIS Windows Server)", cfg.CheckIngressIPOnly, 30*time.Second, cfg.Timeout) Expect(err).NotTo(HaveOccurred()) By("Verifying pods & services can be deleted") diff --git a/test/e2e/kubernetes/service/service.go b/test/e2e/kubernetes/service/service.go index bd335df41..c72f43539 100644 --- a/test/e2e/kubernetes/service/service.go +++ b/test/e2e/kubernetes/service/service.go @@ -278,7 +278,7 @@ func WaitOnDeleted(servicePrefix, namespace string, sleep, timeout time.Duration } // ValidateWithRetry waits for an Ingress to be provisioned -func (s *Service) ValidateWithRetry(bodyResponseTextMatch string, sleep, timeout time.Duration) error { +func (s *Service) ValidateWithRetry(bodyResponseTextMatch string, checkIngressIPOnly bool, sleep, timeout time.Duration) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() var mostRecentValidateWithRetryError error @@ -289,7 +289,7 @@ func (s *Service) ValidateWithRetry(bodyResponseTextMatch string, sleep, timeout case <-ctx.Done(): return default: - ch <- s.Validate(bodyResponseTextMatch) + ch <- s.Validate(bodyResponseTextMatch, checkIngressIPOnly) time.Sleep(sleep) } } @@ -312,7 +312,7 @@ func (s *Service) ValidateWithRetry(bodyResponseTextMatch string, sleep, timeout } // Validate will attempt to run an http.Get against the root service url -func (s *Service) Validate(bodyResponseTextMatch string) error { +func (s *Service) Validate(bodyResponseTextMatch string, checkIngressIPOnly bool) error { if len(s.Status.LoadBalancer.Ingress) < 1 { return errors.Errorf("No LB ingress IP for service %s", s.Metadata.Name) } @@ -329,6 +329,9 @@ func (s *Service) Validate(bodyResponseTextMatch string) error { if err != nil { return errors.Errorf("Unable to parse response body: %s", err) } + if checkIngressIPOnly { + return nil + } matched, err := regexp.MatchString(bodyResponseTextMatch, string(body)) if err != nil { return errors.Errorf("Unable to evalute response body against a regular expression match: %s", err)