Remove unused variables and verbose e2e logs
This commit is contained in:
parent
47b5e20a88
commit
10dcf0db15
35 changed files with 331 additions and 427 deletions
|
|
@ -37,13 +37,10 @@ var _ = framework.IngressNginxDescribe("[Shutdown] ingress controller", func() {
|
|||
|
||||
ginkgo.BeforeEach(func() {
|
||||
f.UpdateNginxConfigMapData("worker-shutdown-timeout", "600s")
|
||||
|
||||
f.NewSlowEchoDeployment()
|
||||
})
|
||||
|
||||
ginkgo.It("should shutdown in less than 60 secons without pending connections", func() {
|
||||
defer ginkgo.GinkgoRecover()
|
||||
|
||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, framework.SlowEchoService, 80, nil))
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
|
|
@ -64,11 +61,7 @@ var _ = framework.IngressNginxDescribe("[Shutdown] ingress controller", func() {
|
|||
assert.LessOrEqual(ginkgo.GinkgoT(), int(time.Since(startTime).Seconds()), 60, "waiting shutdown")
|
||||
})
|
||||
|
||||
type asyncResult struct {
|
||||
status int
|
||||
}
|
||||
|
||||
ginkgo.It("should shutdown after waiting 60 seconds for pending connections to be closed", func() {
|
||||
ginkgo.It("should shutdown after waiting 60 seconds for pending connections to be closed", func(done ginkgo.Done) {
|
||||
defer ginkgo.GinkgoRecover()
|
||||
|
||||
err := framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
|
||||
|
|
@ -92,11 +85,10 @@ var _ = framework.IngressNginxDescribe("[Shutdown] ingress controller", func() {
|
|||
return strings.Contains(server, "server_name shutdown")
|
||||
})
|
||||
|
||||
result := make(chan *asyncResult)
|
||||
|
||||
startTime := time.Now()
|
||||
|
||||
go func(host string, c chan *asyncResult) {
|
||||
result := make(chan int)
|
||||
go func(host string, c chan int) {
|
||||
defer ginkgo.GinkgoRecover()
|
||||
|
||||
resp := f.HTTPTestClient().
|
||||
|
|
@ -105,34 +97,19 @@ var _ = framework.IngressNginxDescribe("[Shutdown] ingress controller", func() {
|
|||
Expect().
|
||||
Raw()
|
||||
|
||||
code := 0
|
||||
if resp != nil {
|
||||
code = resp.StatusCode
|
||||
}
|
||||
|
||||
c <- &asyncResult{code}
|
||||
c <- resp.StatusCode
|
||||
}(host, result)
|
||||
|
||||
time.Sleep(5 * time.Second)
|
||||
framework.Sleep()
|
||||
|
||||
f.ScaleDeploymentToZero("nginx-ingress-controller")
|
||||
|
||||
ticker := time.NewTicker(time.Second * 10)
|
||||
assert.Equal(ginkgo.GinkgoT(), <-result, http.StatusOK, "expecting a valid response from HTTP request")
|
||||
assert.GreaterOrEqual(ginkgo.GinkgoT(), int(time.Since(startTime).Seconds()), 60, "waiting shutdown")
|
||||
close(done)
|
||||
}, 100)
|
||||
|
||||
for {
|
||||
select {
|
||||
case res := <-result:
|
||||
assert.Equal(ginkgo.GinkgoT(), res.status, http.StatusOK, "expecting a valid response from HTTP request")
|
||||
assert.GreaterOrEqual(ginkgo.GinkgoT(), int(time.Since(startTime).Seconds()), 60, "waiting shutdown")
|
||||
ticker.Stop()
|
||||
return
|
||||
case <-ticker.C:
|
||||
framework.Logf("waiting for request completion after shutdown")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
ginkgo.It("should shutdown after waiting 150 seconds for pending connections to be closed", func() {
|
||||
ginkgo.It("should shutdown after waiting 150 seconds for pending connections to be closed", func(done ginkgo.Done) {
|
||||
err := framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
|
||||
func(deployment *appsv1.Deployment) error {
|
||||
grace := int64(3600)
|
||||
|
|
@ -153,11 +130,10 @@ var _ = framework.IngressNginxDescribe("[Shutdown] ingress controller", func() {
|
|||
return strings.Contains(server, "server_name shutdown")
|
||||
})
|
||||
|
||||
result := make(chan *asyncResult)
|
||||
|
||||
startTime := time.Now()
|
||||
|
||||
go func(host string, c chan *asyncResult) {
|
||||
result := make(chan int)
|
||||
go func(host string, c chan int) {
|
||||
defer ginkgo.GinkgoRecover()
|
||||
|
||||
resp := f.HTTPTestClient().
|
||||
|
|
@ -166,30 +142,15 @@ var _ = framework.IngressNginxDescribe("[Shutdown] ingress controller", func() {
|
|||
Expect().
|
||||
Raw()
|
||||
|
||||
code := 0
|
||||
if resp != nil {
|
||||
code = resp.StatusCode
|
||||
}
|
||||
|
||||
c <- &asyncResult{code}
|
||||
c <- resp.StatusCode
|
||||
}(host, result)
|
||||
|
||||
time.Sleep(5 * time.Second)
|
||||
framework.Sleep()
|
||||
|
||||
f.ScaleDeploymentToZero("nginx-ingress-controller")
|
||||
|
||||
ticker := time.NewTicker(time.Second * 10)
|
||||
|
||||
for {
|
||||
select {
|
||||
case res := <-result:
|
||||
assert.Equal(ginkgo.GinkgoT(), res.status, http.StatusOK, "expecting a valid response from HTTP request")
|
||||
assert.GreaterOrEqual(ginkgo.GinkgoT(), int(time.Since(startTime).Seconds()), 150, "waiting shutdown")
|
||||
ticker.Stop()
|
||||
return
|
||||
case <-ticker.C:
|
||||
framework.Logf("waiting for request completion after shutdown")
|
||||
}
|
||||
}
|
||||
})
|
||||
assert.Equal(ginkgo.GinkgoT(), <-result, http.StatusOK, "expecting a valid response from HTTP request")
|
||||
assert.GreaterOrEqual(ginkgo.GinkgoT(), int(time.Since(startTime).Seconds()), 150, "waiting shutdown")
|
||||
close(done)
|
||||
}, 200)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package gracefulshutdown
|
|||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
|
||||
|
|
@ -55,7 +54,7 @@ var _ = framework.IngressNginxDescribe("[Shutdown] Graceful shutdown with pendin
|
|||
Status(http.StatusOK)
|
||||
}()
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
framework.Sleep()
|
||||
f.DeleteNGINXPod(60)
|
||||
<-done
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue