Skip to content

Commit

Permalink
Adjust nginx lb timeout in tests
Browse files Browse the repository at this point in the history
In addition delete the service & lb before ending to test to avoid the case
when deleting the namespace times out due to long LB deletion.

Ref.  kubernetes#82695
  • Loading branch information
mm4tt committed Sep 16, 2019
1 parent 9fa7889 commit 532298c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/e2e/framework/ingress/ingress_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,7 @@ type NginxIngressController struct {
rc *v1.ReplicationController
pod *v1.Pod
Client clientset.Interface
lbSvc *v1.Service
}

// Init initializes the NginxIngressController
Expand All @@ -848,8 +849,8 @@ func (cont *NginxIngressController) Init() {
{Name: "https", Port: 443},
{Name: "stats", Port: 18080}}
})
svc := serviceJig.WaitForLoadBalancerOrFail(cont.Ns, "nginx-ingress-lb", e2eservice.LoadBalancerCreateTimeoutDefault)
serviceJig.SanityCheckService(svc, v1.ServiceTypeLoadBalancer)
cont.lbSvc = serviceJig.WaitForLoadBalancerOrFail(cont.Ns, "nginx-ingress-lb", e2eservice.GetServiceLoadBalancerCreationTimeout(cont.Client))
serviceJig.SanityCheckService(cont.lbSvc, v1.ServiceTypeLoadBalancer)

read := func(file string) string {
return string(testfiles.ReadOrDie(filepath.Join(IngressManifestPath, "nginx", file)))
Expand All @@ -873,6 +874,15 @@ func (cont *NginxIngressController) Init() {
framework.Logf("ingress controller running in pod %v", cont.pod.Name)
}

// TearDown cleans up the NginxIngressController.
func (cont *NginxIngressController) TearDown() {
if cont.lbSvc == nil {
framework.Logf("No LoadBalancer service created, no cleanup necessary")
return
}
e2eservice.WaitForServiceDeletedWithFinalizer(cont.Client, cont.Ns, cont.lbSvc.Name)
}

func generateBacksideHTTPSIngressSpec(ns string) *networkingv1beta1.Ingress {
return &networkingv1beta1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Expand Down
1 change: 1 addition & 0 deletions test/e2e/network/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
if ginkgo.CurrentGinkgoTestDescription().Failed {
framework.DescribeIng(ns)
}
defer nginxController.TearDown()
if jig.Ingress == nil {
ginkgo.By("No ingress created, no cleanup necessary")
return
Expand Down

0 comments on commit 532298c

Please sign in to comment.