diff --git a/hack/.golint_failures b/hack/.golint_failures index f8a9b11d369..b88bf5a2d15 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -653,7 +653,6 @@ test/e2e/chaosmonkey test/e2e/cloud test/e2e/common test/e2e/framework -test/e2e/framework/ingress test/e2e/framework/providers/gce test/e2e/framework/providers/kubemark test/e2e/instrumentation diff --git a/test/e2e/framework/ingress/ingress_utils.go b/test/e2e/framework/ingress/ingress_utils.go index 0880eb4a73a..cbde86d5e23 100644 --- a/test/e2e/framework/ingress/ingress_utils.go +++ b/test/e2e/framework/ingress/ingress_utils.go @@ -53,28 +53,28 @@ import ( "k8s.io/kubernetes/test/e2e/manifest" testutils "k8s.io/kubernetes/test/utils" - . "github.com/onsi/ginkgo" + "github.com/onsi/ginkgo" ) const ( rsaBits = 2048 validFor = 365 * 24 * time.Hour - // Ingress class annotation defined in ingress repository. + // IngressClassKey is ingress class annotation defined in ingress repository. // TODO: All these annotations should be reused from // ingress-gce/pkg/annotations instead of duplicating them here. IngressClassKey = "kubernetes.io/ingress.class" - // Ingress class annotation value for multi cluster ingress. + // MulticlusterIngressClassValue is ingress class annotation value for multi cluster ingress. MulticlusterIngressClassValue = "gce-multi-cluster" - // Static IP annotation defined in ingress repository. + // IngressStaticIPKey is static IP annotation defined in ingress repository. IngressStaticIPKey = "kubernetes.io/ingress.global-static-ip-name" - // Allow HTTP annotation defined in ingress repository. + // IngressAllowHTTPKey is Allow HTTP annotation defined in ingress repository. IngressAllowHTTPKey = "kubernetes.io/ingress.allow-http" - // Pre-shared-cert annotation defined in ingress repository. + // IngressPreSharedCertKey is Pre-shared-cert annotation defined in ingress repository. IngressPreSharedCertKey = "ingress.gcp.kubernetes.io/pre-shared-cert" // ServiceApplicationProtocolKey annotation defined in ingress repository. @@ -95,45 +95,52 @@ const ( // General cloud resource poll timeout (eg: create static ip, firewall etc) cloudResourcePollTimeout = 5 * time.Minute - NEGAnnotation = "cloud.google.com/neg" + // NEGAnnotation is NEG annotation. + NEGAnnotation = "cloud.google.com/neg" + + // NEGStatusAnnotation is NEG status annotation. NEGStatusAnnotation = "cloud.google.com/neg-status" - NEGUpdateTimeout = 2 * time.Minute - InstanceGroupAnnotation = "ingress.gcp.kubernetes.io/instance-groups" - - // Prefix for annotation keys used by the ingress controller to specify the + // StatusPrefix is prefix for annotation keys used by the ingress controller to specify the // names of GCP resources such as forwarding rules, url maps, target proxies, etc // that it created for the corresponding ingress. StatusPrefix = "ingress.kubernetes.io" ) +// TestLogger is an interface for log. type TestLogger interface { Infof(format string, args ...interface{}) Errorf(format string, args ...interface{}) } +// GLogger is test logger. type GLogger struct{} +// Infof outputs log with info level. func (l *GLogger) Infof(format string, args ...interface{}) { klog.Infof(format, args...) } +// Errorf outputs log with error level. func (l *GLogger) Errorf(format string, args ...interface{}) { klog.Errorf(format, args...) } +// E2ELogger is test logger. type E2ELogger struct{} +// Infof outputs log. func (l *E2ELogger) Infof(format string, args ...interface{}) { framework.Logf(format, args...) } +// Errorf outputs log. func (l *E2ELogger) Errorf(format string, args ...interface{}) { framework.Logf(format, args...) } -// IngressConformanceTests contains a closure with an entry and exit log line. -type IngressConformanceTests struct { +// ConformanceTests contains a closure with an entry and exit log line. +type ConformanceTests struct { EntryLog string Execute func() ExitLog string @@ -152,7 +159,7 @@ type NegStatus struct { // CreateIngressComformanceTests generates an slice of sequential test cases: // a simple http ingress, ingress with HTTPS, ingress HTTPS with a modified hostname, // ingress https with a modified URLMap -func CreateIngressComformanceTests(jig *IngressTestJig, ns string, annotations map[string]string) []IngressConformanceTests { +func CreateIngressComformanceTests(jig *TestJig, ns string, annotations map[string]string) []ConformanceTests { manifestPath := filepath.Join(IngressManifestPath, "http") // These constants match the manifests used in IngressManifestPath tlsHost := "foo.bar.com" @@ -161,7 +168,7 @@ func CreateIngressComformanceTests(jig *IngressTestJig, ns string, annotations m updateURLMapHost := "bar.baz.com" updateURLMapPath := "/testurl" // Platform agnostic list of tests that must be satisfied by all controllers - tests := []IngressConformanceTests{ + tests := []ConformanceTests{ { fmt.Sprintf("should create a basic HTTP ingress"), func() { jig.CreateIngress(manifestPath, ns, annotations, annotations) }, @@ -201,7 +208,7 @@ func CreateIngressComformanceTests(jig *IngressTestJig, ns string, annotations m } ing.Spec.Rules = newRules }) - By("Checking that " + pathToFail + " is not exposed by polling for failure") + ginkgo.By("Checking that " + pathToFail + " is not exposed by polling for failure") route := fmt.Sprintf("http://%v%v", jig.Address, pathToFail) framework.ExpectNoError(framework.PollURL(route, updateURLMapHost, framework.LoadBalancerCleanupTimeout, jig.PollInterval, &http.Client{Timeout: IngressReqTimeout}, true)) }, @@ -210,7 +217,7 @@ func CreateIngressComformanceTests(jig *IngressTestJig, ns string, annotations m } // Skip the Update TLS cert test for kubemci: https://github.com/GoogleCloudPlatform/k8s-multicluster-ingress/issues/141. if jig.Class != MulticlusterIngressClassValue { - tests = append(tests, IngressConformanceTests{ + tests = append(tests, ConformanceTests{ fmt.Sprintf("should update SSL certificate with modified hostname %v", updatedTLSHost), func() { jig.Update(func(ing *extensions.Ingress) { @@ -351,8 +358,8 @@ func createTLSSecret(kubeClient clientset.Interface, namespace, secretName strin return host, cert, key, err } -// IngressTestJig holds the relevant state and parameters of the ingress test. -type IngressTestJig struct { +// TestJig holds the relevant state and parameters of the ingress test. +type TestJig struct { Client clientset.Interface Logger TestLogger @@ -369,8 +376,8 @@ type IngressTestJig struct { } // NewIngressTestJig instantiates struct with client -func NewIngressTestJig(c clientset.Interface) *IngressTestJig { - return &IngressTestJig{ +func NewIngressTestJig(c clientset.Interface) *TestJig { + return &TestJig{ Client: c, RootCAs: map[string][]byte{}, PollInterval: framework.LoadBalancerPollInterval, @@ -383,13 +390,13 @@ func NewIngressTestJig(c clientset.Interface) *IngressTestJig { // Optional: secret.yaml, ingAnnotations // If ingAnnotations is specified it will overwrite any annotations in ing.yaml // If svcAnnotations is specified it will overwrite any annotations in svc.yaml -func (j *IngressTestJig) CreateIngress(manifestPath, ns string, ingAnnotations map[string]string, svcAnnotations map[string]string) { +func (j *TestJig) CreateIngress(manifestPath, ns string, ingAnnotations map[string]string, svcAnnotations map[string]string) { var err error read := func(file string) string { - return string(testfiles.ReadOrDie(filepath.Join(manifestPath, file), Fail)) + return string(testfiles.ReadOrDie(filepath.Join(manifestPath, file), ginkgo.Fail)) } exists := func(file string) bool { - return testfiles.Exists(filepath.Join(manifestPath, file), Fail) + return testfiles.Exists(filepath.Join(manifestPath, file), ginkgo.Fail) } j.Logger.Infof("creating replication controller") @@ -426,7 +433,7 @@ func (j *IngressTestJig) CreateIngress(manifestPath, ns string, ingAnnotations m } // runCreate runs the required command to create the given ingress. -func (j *IngressTestJig) runCreate(ing *extensions.Ingress) (*extensions.Ingress, error) { +func (j *TestJig) runCreate(ing *extensions.Ingress) (*extensions.Ingress, error) { if j.Class != MulticlusterIngressClassValue { return j.Client.ExtensionsV1beta1().Ingresses(ing.Namespace).Create(ing) } @@ -440,7 +447,7 @@ func (j *IngressTestJig) runCreate(ing *extensions.Ingress) (*extensions.Ingress } // runUpdate runs the required command to update the given ingress. -func (j *IngressTestJig) runUpdate(ing *extensions.Ingress) (*extensions.Ingress, error) { +func (j *TestJig) runUpdate(ing *extensions.Ingress) (*extensions.Ingress, error) { if j.Class != MulticlusterIngressClassValue { return j.Client.ExtensionsV1beta1().Ingresses(ing.Namespace).Update(ing) } @@ -455,7 +462,7 @@ func (j *IngressTestJig) runUpdate(ing *extensions.Ingress) (*extensions.Ingress } // Update retrieves the ingress, performs the passed function, and then updates it. -func (j *IngressTestJig) Update(update func(ing *extensions.Ingress)) { +func (j *TestJig) Update(update func(ing *extensions.Ingress)) { var err error ns, name := j.Ingress.Namespace, j.Ingress.Name for i := 0; i < 3; i++ { @@ -477,7 +484,7 @@ func (j *IngressTestJig) Update(update func(ing *extensions.Ingress)) { } // AddHTTPS updates the ingress to add this secret for these hosts. -func (j *IngressTestJig) AddHTTPS(secretName string, hosts ...string) { +func (j *TestJig) AddHTTPS(secretName string, hosts ...string) { // TODO: Just create the secret in GetRootCAs once we're watching secrets in // the ingress controller. _, cert, _, err := createTLSSecret(j.Client, j.Ingress.Namespace, secretName, hosts...) @@ -490,7 +497,7 @@ func (j *IngressTestJig) AddHTTPS(secretName string, hosts ...string) { } // SetHTTPS updates the ingress to use only this secret for these hosts. -func (j *IngressTestJig) SetHTTPS(secretName string, hosts ...string) { +func (j *TestJig) SetHTTPS(secretName string, hosts ...string) { _, cert, _, err := createTLSSecret(j.Client, j.Ingress.Namespace, secretName, hosts...) framework.ExpectNoError(err) j.Logger.Infof("Updating ingress %v to only use secret %v for TLS termination", j.Ingress.Name, secretName) @@ -502,7 +509,7 @@ func (j *IngressTestJig) SetHTTPS(secretName string, hosts ...string) { // RemoveHTTPS updates the ingress to not use this secret for TLS. // Note: Does not delete the secret. -func (j *IngressTestJig) RemoveHTTPS(secretName string) { +func (j *TestJig) RemoveHTTPS(secretName string) { newTLS := []extensions.IngressTLS{} for _, ingressTLS := range j.Ingress.Spec.TLS { if secretName != ingressTLS.SecretName { @@ -517,7 +524,7 @@ func (j *IngressTestJig) RemoveHTTPS(secretName string) { } // PrepareTLSSecret creates a TLS secret and caches the cert. -func (j *IngressTestJig) PrepareTLSSecret(namespace, secretName string, hosts ...string) error { +func (j *TestJig) PrepareTLSSecret(namespace, secretName string, hosts ...string) error { _, cert, _, err := createTLSSecret(j.Client, namespace, secretName, hosts...) if err != nil { return err @@ -527,7 +534,7 @@ func (j *IngressTestJig) PrepareTLSSecret(namespace, secretName string, hosts .. } // GetRootCA returns a rootCA from the ingress test jig. -func (j *IngressTestJig) GetRootCA(secretName string) (rootCA []byte) { +func (j *TestJig) GetRootCA(secretName string) (rootCA []byte) { var ok bool rootCA, ok = j.RootCAs[secretName] if !ok { @@ -537,25 +544,18 @@ func (j *IngressTestJig) GetRootCA(secretName string) (rootCA []byte) { } // TryDeleteIngress attempts to delete the ingress resource and logs errors if they occur. -func (j *IngressTestJig) TryDeleteIngress() { - j.TryDeleteGivenIngress(j.Ingress) +func (j *TestJig) TryDeleteIngress() { + j.tryDeleteGivenIngress(j.Ingress) } -func (j *IngressTestJig) TryDeleteGivenIngress(ing *extensions.Ingress) { +func (j *TestJig) tryDeleteGivenIngress(ing *extensions.Ingress) { if err := j.runDelete(ing); err != nil { j.Logger.Infof("Error while deleting the ingress %v/%v with class %s: %v", ing.Namespace, ing.Name, j.Class, err) } } -func (j *IngressTestJig) TryDeleteGivenService(svc *v1.Service) { - err := j.Client.CoreV1().Services(svc.Namespace).Delete(svc.Name, nil) - if err != nil { - j.Logger.Infof("Error while deleting the service %v/%v: %v", svc.Namespace, svc.Name, err) - } -} - // runDelete runs the required command to delete the given ingress. -func (j *IngressTestJig) runDelete(ing *extensions.Ingress) error { +func (j *TestJig) runDelete(ing *extensions.Ingress) error { if j.Class != MulticlusterIngressClassValue { return j.Client.ExtensionsV1beta1().Ingresses(ing.Namespace).Delete(ing.Name, nil) } @@ -614,7 +614,7 @@ func getIngressAddress(client clientset.Interface, ns, name, class string) ([]st } // WaitForIngressAddress waits for the Ingress to acquire an address. -func (j *IngressTestJig) WaitForIngressAddress(c clientset.Interface, ns, ingName string, timeout time.Duration) (string, error) { +func (j *TestJig) WaitForIngressAddress(c clientset.Interface, ns, ingName string, timeout time.Duration) (string, error) { var address string err := wait.PollImmediate(10*time.Second, timeout, func() (bool, error) { ipOrNameList, err := getIngressAddress(c, ns, ingName, j.Class) @@ -632,7 +632,7 @@ func (j *IngressTestJig) WaitForIngressAddress(c clientset.Interface, ns, ingNam return address, err } -func (j *IngressTestJig) pollIngressWithCert(ing *extensions.Ingress, address string, knownHosts []string, cert []byte, waitForNodePort bool, timeout time.Duration) error { +func (j *TestJig) pollIngressWithCert(ing *extensions.Ingress, address string, knownHosts []string, cert []byte, waitForNodePort bool, timeout time.Duration) error { // Check that all rules respond to a simple GET. knownHostsSet := sets.NewString(knownHosts...) for _, rules := range ing.Spec.Rules { @@ -666,7 +666,8 @@ func (j *IngressTestJig) pollIngressWithCert(ing *extensions.Ingress, address st return nil } -func (j *IngressTestJig) WaitForIngress(waitForNodePort bool) { +// WaitForIngress waits for the Ingress to get an address. +func (j *TestJig) WaitForIngress(waitForNodePort bool) { if err := j.WaitForGivenIngressWithTimeout(j.Ingress, waitForNodePort, framework.LoadBalancerPollTimeout); err != nil { framework.Failf("error in waiting for ingress to get an address: %s", err) } @@ -677,7 +678,7 @@ func (j *IngressTestJig) WaitForIngress(waitForNodePort bool) { // http or https). If waitForNodePort is true, the NodePort of the Service // is verified before verifying the Ingress. NodePort is currently a // requirement for cloudprovider Ingress. -func (j *IngressTestJig) WaitForGivenIngressWithTimeout(ing *extensions.Ingress, waitForNodePort bool, timeout time.Duration) error { +func (j *TestJig) WaitForGivenIngressWithTimeout(ing *extensions.Ingress, waitForNodePort bool, timeout time.Duration) error { // Wait for the loadbalancer IP. address, err := j.WaitForIngressAddress(j.Client, ing.Namespace, ing.Name, timeout) if err != nil { @@ -693,12 +694,12 @@ func (j *IngressTestJig) WaitForGivenIngressWithTimeout(ing *extensions.Ingress, return j.pollIngressWithCert(ing, address, knownHosts, cert, waitForNodePort, timeout) } -// WaitForIngress waits till the ingress acquires an IP, then waits for its +// WaitForIngressWithCert waits till the ingress acquires an IP, then waits for its // hosts/urls to respond to a protocol check (either http or https). If // waitForNodePort is true, the NodePort of the Service is verified before // verifying the Ingress. NodePort is currently a requirement for cloudprovider // Ingress. Hostnames and certificate need to be explicitly passed in. -func (j *IngressTestJig) WaitForIngressWithCert(waitForNodePort bool, knownHosts []string, cert []byte) error { +func (j *TestJig) WaitForIngressWithCert(waitForNodePort bool, knownHosts []string, cert []byte) error { // Wait for the loadbalancer IP. address, err := j.WaitForIngressAddress(j.Client, j.Ingress.Namespace, j.Ingress.Name, framework.LoadBalancerPollTimeout) if err != nil { @@ -710,7 +711,7 @@ func (j *IngressTestJig) WaitForIngressWithCert(waitForNodePort bool, knownHosts // VerifyURL polls for the given iterations, in intervals, and fails if the // given url returns a non-healthy http code even once. -func (j *IngressTestJig) VerifyURL(route, host string, iterations int, interval time.Duration, httpClient *http.Client) error { +func (j *TestJig) VerifyURL(route, host string, iterations int, interval time.Duration, httpClient *http.Client) error { for i := 0; i < iterations; i++ { b, err := framework.SimpleGET(httpClient, route, host) if err != nil { @@ -723,7 +724,7 @@ func (j *IngressTestJig) VerifyURL(route, host string, iterations int, interval return nil } -func (j *IngressTestJig) pollServiceNodePort(ns, name string, port int) error { +func (j *TestJig) pollServiceNodePort(ns, name string, port int) error { // TODO: Curl all nodes? u, err := framework.GetNodePortURL(j.Client, ns, name, port) if err != nil { @@ -735,7 +736,7 @@ func (j *IngressTestJig) pollServiceNodePort(ns, name string, port int) error { // GetIngressNodePorts returns related backend services' nodePorts. // Current GCE ingress controller allows traffic to the default HTTP backend // by default, so retrieve its nodePort if includeDefaultBackend is true. -func (j *IngressTestJig) GetIngressNodePorts(includeDefaultBackend bool) []string { +func (j *TestJig) GetIngressNodePorts(includeDefaultBackend bool) []string { nodePorts := []string{} svcPorts := j.GetServicePorts(includeDefaultBackend) for _, svcPort := range svcPorts { @@ -747,7 +748,7 @@ func (j *IngressTestJig) GetIngressNodePorts(includeDefaultBackend bool) []strin // GetServicePorts returns related backend services' svcPorts. // Current GCE ingress controller allows traffic to the default HTTP backend // by default, so retrieve its nodePort if includeDefaultBackend is true. -func (j *IngressTestJig) GetServicePorts(includeDefaultBackend bool) map[string]v1.ServicePort { +func (j *TestJig) GetServicePorts(includeDefaultBackend bool) map[string]v1.ServicePort { svcPorts := make(map[string]v1.ServicePort) if includeDefaultBackend { defaultSvc, err := j.Client.CoreV1().Services(metav1.NamespaceSystem).Get(defaultBackendName, metav1.GetOptions{}) @@ -773,7 +774,7 @@ func (j *IngressTestJig) GetServicePorts(includeDefaultBackend bool) map[string] } // ConstructFirewallForIngress returns the expected GCE firewall rule for the ingress resource -func (j *IngressTestJig) ConstructFirewallForIngress(firewallRuleName string, nodeTags []string) *compute.Firewall { +func (j *TestJig) ConstructFirewallForIngress(firewallRuleName string, nodeTags []string) *compute.Firewall { nodePorts := j.GetIngressNodePorts(true) fw := compute.Firewall{} @@ -790,7 +791,7 @@ func (j *IngressTestJig) ConstructFirewallForIngress(firewallRuleName string, no } // GetDistinctResponseFromIngress tries GET call to the ingress VIP and return all distinct responses. -func (j *IngressTestJig) GetDistinctResponseFromIngress() (sets.String, error) { +func (j *TestJig) GetDistinctResponseFromIngress() (sets.String, error) { // Wait for the loadbalancer IP. address, err := j.WaitForIngressAddress(j.Client, j.Ingress.Namespace, j.Ingress.Name, framework.LoadBalancerPollTimeout) if err != nil { @@ -823,7 +824,7 @@ type NginxIngressController struct { // Init initializes the NginxIngressController func (cont *NginxIngressController) Init() { read := func(file string) string { - return string(testfiles.ReadOrDie(filepath.Join(IngressManifestPath, "nginx", file), Fail)) + return string(testfiles.ReadOrDie(filepath.Join(IngressManifestPath, "nginx", file), ginkgo.Fail)) } framework.Logf("initializing nginx ingress controller") framework.RunKubectlOrDieInput(read("rc.yaml"), "create", "-f", "-", fmt.Sprintf("--namespace=%v", cont.Ns)) @@ -921,7 +922,7 @@ func generateBacksideHTTPSDeploymentSpec() *apps.Deployment { } // SetUpBacksideHTTPSIngress sets up deployment, service and ingress with backside HTTPS configured. -func (j *IngressTestJig) SetUpBacksideHTTPSIngress(cs clientset.Interface, namespace string, staticIPName string) (*apps.Deployment, *v1.Service, *extensions.Ingress, error) { +func (j *TestJig) SetUpBacksideHTTPSIngress(cs clientset.Interface, namespace string, staticIPName string) (*apps.Deployment, *v1.Service, *extensions.Ingress, error) { deployCreated, err := cs.AppsV1().Deployments(namespace).Create(generateBacksideHTTPSDeploymentSpec()) if err != nil { return nil, nil, nil, err @@ -945,7 +946,7 @@ func (j *IngressTestJig) SetUpBacksideHTTPSIngress(cs clientset.Interface, names } // DeleteTestResource deletes given deployment, service and ingress. -func (j *IngressTestJig) DeleteTestResource(cs clientset.Interface, deploy *apps.Deployment, svc *v1.Service, ing *extensions.Ingress) []error { +func (j *TestJig) DeleteTestResource(cs clientset.Interface, deploy *apps.Deployment, svc *v1.Service, ing *extensions.Ingress) []error { var errs []error if ing != nil { if err := j.runDelete(ing); err != nil { diff --git a/test/e2e/network/ingress.go b/test/e2e/network/ingress.go index 96815c9dd9d..0785e7329bd 100644 --- a/test/e2e/network/ingress.go +++ b/test/e2e/network/ingress.go @@ -44,12 +44,17 @@ import ( . "github.com/onsi/gomega" ) +const ( + negUpdateTimeout = 2 * time.Minute + instanceGroupAnnotation = "ingress.gcp.kubernetes.io/instance-groups" +) + var _ = SIGDescribe("Loadbalancing: L7", func() { defer GinkgoRecover() var ( ns string - jig *ingress.IngressTestJig - conformanceTests []ingress.IngressConformanceTests + jig *ingress.TestJig + conformanceTests []ingress.ConformanceTests cloudConfig framework.CloudConfig ) f := framework.NewDefaultFramework("ingress") @@ -362,14 +367,14 @@ var _ = SIGDescribe("Loadbalancing: L7", func() { ing, err := f.ClientSet.ExtensionsV1beta1().Ingresses(ns).Get(name, metav1.GetOptions{}) framework.ExpectNoError(err) annotations := ing.Annotations - if annotations == nil || annotations[ingress.InstanceGroupAnnotation] == "" { - framework.Logf("Waiting for ingress to get %s annotation. Found annotations: %v", ingress.InstanceGroupAnnotation, annotations) + if annotations == nil || annotations[instanceGroupAnnotation] == "" { + framework.Logf("Waiting for ingress to get %s annotation. Found annotations: %v", instanceGroupAnnotation, annotations) return false, nil } return true, nil }) if pollErr != nil { - framework.ExpectNoError(fmt.Errorf("Timed out waiting for ingress %s to get %s annotation", name, ingress.InstanceGroupAnnotation)) + framework.ExpectNoError(fmt.Errorf("Timed out waiting for ingress %s to get %s annotation", name, instanceGroupAnnotation)) } // Verify that the ingress does not get other annotations like url-map, target-proxy, backends, etc. @@ -569,7 +574,7 @@ var _ = SIGDescribe("Loadbalancing: L7", func() { _, err = f.ClientSet.AppsV1().Deployments(ns).UpdateScale(name, scale) Expect(err).NotTo(HaveOccurred()) } - wait.Poll(10*time.Second, ingress.NEGUpdateTimeout, func() (bool, error) { + wait.Poll(10*time.Second, negUpdateTimeout, func() (bool, error) { res, err := jig.GetDistinctResponseFromIngress() if err != nil { return false, nil @@ -664,7 +669,7 @@ var _ = SIGDescribe("Loadbalancing: L7", func() { _, err = f.ClientSet.AppsV1().Deployments(ns).UpdateScale(name, scale) Expect(err).NotTo(HaveOccurred()) } - wait.Poll(10*time.Second, ingress.NEGUpdateTimeout, func() (bool, error) { + wait.Poll(10*time.Second, negUpdateTimeout, func() (bool, error) { svc, err := f.ClientSet.CoreV1().Services(ns).Get(name, metav1.GetOptions{}) Expect(err).NotTo(HaveOccurred()) @@ -982,7 +987,7 @@ func verifyKubemciStatusHas(name, expectedSubStr string) { } } -func executePresharedCertTest(f *framework.Framework, jig *ingress.IngressTestJig, staticIPName string) { +func executePresharedCertTest(f *framework.Framework, jig *ingress.TestJig, staticIPName string) { preSharedCertName := "test-pre-shared-cert" By(fmt.Sprintf("Creating ssl certificate %q on GCE", preSharedCertName)) testHostname := "test.ingress.com" @@ -1033,7 +1038,7 @@ func executePresharedCertTest(f *framework.Framework, jig *ingress.IngressTestJi Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("Unexpected error while waiting for ingress: %v", err)) } -func executeStaticIPHttpsOnlyTest(f *framework.Framework, jig *ingress.IngressTestJig, ipName, ip string) { +func executeStaticIPHttpsOnlyTest(f *framework.Framework, jig *ingress.TestJig, ipName, ip string) { jig.CreateIngress(filepath.Join(ingress.IngressManifestPath, "static-ip"), f.Namespace.Name, map[string]string{ ingress.IngressStaticIPKey: ipName, ingress.IngressAllowHTTPKey: "false", @@ -1047,7 +1052,7 @@ func executeStaticIPHttpsOnlyTest(f *framework.Framework, jig *ingress.IngressTe framework.ExpectNoError(framework.PollURL(fmt.Sprintf("http://%s/", ip), "", framework.LoadBalancerPollTimeout, jig.PollInterval, httpClient, true)) } -func executeBacksideBacksideHTTPSTest(f *framework.Framework, jig *ingress.IngressTestJig, staticIPName string) { +func executeBacksideBacksideHTTPSTest(f *framework.Framework, jig *ingress.TestJig, staticIPName string) { By("Creating a set of ingress, service and deployment that have backside re-encryption configured") deployCreated, svcCreated, ingCreated, err := jig.SetUpBacksideHTTPSIngress(f.ClientSet, f.Namespace.Name, staticIPName) defer func() { @@ -1079,7 +1084,7 @@ func executeBacksideBacksideHTTPSTest(f *framework.Framework, jig *ingress.Ingre Expect(err).NotTo(HaveOccurred(), "Failed to verify backside re-encryption ingress") } -func detectHttpVersionAndSchemeTest(f *framework.Framework, jig *ingress.IngressTestJig, address, version, scheme string) { +func detectHttpVersionAndSchemeTest(f *framework.Framework, jig *ingress.TestJig, address, version, scheme string) { timeoutClient := &http.Client{Timeout: ingress.IngressReqTimeout} resp := "" err := wait.PollImmediate(framework.LoadBalancerPollInterval, framework.LoadBalancerPollTimeout, func() (bool, error) { @@ -1102,7 +1107,7 @@ func detectHttpVersionAndSchemeTest(f *framework.Framework, jig *ingress.Ingress Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("Failed to get %s or %s, response body: %s", version, scheme, resp)) } -func detectNegAnnotation(f *framework.Framework, jig *ingress.IngressTestJig, gceController *gce.GCEIngressController, ns, name string, negs int) { +func detectNegAnnotation(f *framework.Framework, jig *ingress.TestJig, gceController *gce.GCEIngressController, ns, name string, negs int) { wait.Poll(5*time.Second, framework.LoadBalancerPollTimeout, func() (bool, error) { svc, err := f.ClientSet.CoreV1().Services(ns).Get(name, metav1.GetOptions{}) if err != nil { diff --git a/test/e2e/network/scale/ingress.go b/test/e2e/network/scale/ingress.go index a570321f3a2..696cc9bb4ee 100644 --- a/test/e2e/network/scale/ingress.go +++ b/test/e2e/network/scale/ingress.go @@ -62,7 +62,7 @@ var ( // IngressScaleFramework defines the framework for ingress scale testing. type IngressScaleFramework struct { Clientset clientset.Interface - Jig *ingress.IngressTestJig + Jig *ingress.TestJig GCEController *gce.GCEIngressController CloudConfig framework.CloudConfig Logger ingress.TestLogger diff --git a/test/e2e/upgrades/ingress.go b/test/e2e/upgrades/ingress.go index 75d6e14da46..35aa3af48be 100644 --- a/test/e2e/upgrades/ingress.go +++ b/test/e2e/upgrades/ingress.go @@ -44,7 +44,7 @@ type IngressUpgradeTest struct { gceController *gce.GCEIngressController // holds GCP resources pre-upgrade resourceStore *GCPResourceStore - jig *ingress.IngressTestJig + jig *ingress.TestJig httpClient *http.Client ip string ipName string