Add upstream keep alive tests
This commit is contained in:
parent
57fcbdfb73
commit
d149382743
1 changed files with 41 additions and 8 deletions
|
@ -18,6 +18,7 @@ package settings
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
|
@ -35,6 +36,7 @@ var _ = framework.DescribeSetting("keep-alive keep-alive-requests", func() {
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ginkgo.Context("Check the keep alive", func() {
|
||||||
ginkgo.It("should set keepalive_timeout", func() {
|
ginkgo.It("should set keepalive_timeout", func() {
|
||||||
f.UpdateNginxConfigMapData("keep-alive", "140")
|
f.UpdateNginxConfigMapData("keep-alive", "140")
|
||||||
|
|
||||||
|
@ -49,5 +51,36 @@ var _ = framework.DescribeSetting("keep-alive keep-alive-requests", func() {
|
||||||
f.WaitForNginxConfiguration(func(server string) bool {
|
f.WaitForNginxConfiguration(func(server string) bool {
|
||||||
return strings.Contains(server, fmt.Sprintf(`keepalive_requests 200;`))
|
return strings.Contains(server, fmt.Sprintf(`keepalive_requests 200;`))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
ginkgo.Context("Check the upstream keep alive", func() {
|
||||||
|
ginkgo.It("should set keepalive connection to upstream server", func() {
|
||||||
|
f.UpdateNginxConfigMapData("upstream-keepalive-connections", "128")
|
||||||
|
|
||||||
|
f.WaitForNginxConfiguration(func(server string) bool {
|
||||||
|
match, _ := regexp.MatchString(`upstream\supstream_balancer\s\{[\s\S]*keepalive 128;`, server)
|
||||||
|
return match
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
ginkgo.It("should set keep alive connection timeout to upstream server", func() {
|
||||||
|
f.UpdateNginxConfigMapData("upstream-keepalive-timeout", "120")
|
||||||
|
|
||||||
|
f.WaitForNginxConfiguration(func(server string) bool {
|
||||||
|
match, _ := regexp.MatchString(`upstream\supstream_balancer\s\{[\s\S]*keepalive_timeout\s*120s;`, server)
|
||||||
|
return match
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
ginkgo.It("should set the request count to upstream server through one keep alive connection", func() {
|
||||||
|
f.UpdateNginxConfigMapData("upstream-keepalive-requests", "200")
|
||||||
|
|
||||||
|
f.WaitForNginxConfiguration(func(server string) bool {
|
||||||
|
match, _ := regexp.MatchString(`upstream\supstream_balancer\s\{[\s\S]*keepalive_requests\s*200;`, server)
|
||||||
|
return match
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue