Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/e2e/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -63,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"`
Expand Down
12 changes: 6 additions & 6 deletions test/e2e/kubernetes/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand Down
9 changes: 6 additions & 3 deletions test/e2e/kubernetes/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
}
Expand All @@ -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)
}
Expand All @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions test/e2e/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ 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()
Expand Down