Refactored client body buffer size TC-s.
This commit is contained in:
parent
5c2c052361
commit
a182ca799b
1 changed files with 37 additions and 30 deletions
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package annotations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
|
@ -32,92 +33,98 @@ var _ = framework.DescribeAnnotation("client-body-buffer-size", func() {
|
|||
})
|
||||
|
||||
ginkgo.It("should set client_body_buffer_size to 1000", func() {
|
||||
host := "proxy.foo.com"
|
||||
annotations := map[string]string{
|
||||
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1000",
|
||||
}
|
||||
host := "client-body-buffer-size.com"
|
||||
|
||||
clientBodyBufferSize := "1000"
|
||||
annotations := make(map[string]string)
|
||||
annotations["nginx.ingress.kubernetes.io/client-body-buffer-size"] = clientBodyBufferSize
|
||||
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
return strings.Contains(server, "client_body_buffer_size 1000;")
|
||||
return strings.Contains(server, fmt.Sprintf("client_body_buffer_size %s;", clientBodyBufferSize))
|
||||
})
|
||||
})
|
||||
|
||||
ginkgo.It("should set client_body_buffer_size to 1K", func() {
|
||||
host := "proxy.foo.com"
|
||||
annotations := map[string]string{
|
||||
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1K",
|
||||
}
|
||||
host := "client-body-buffer-size.com"
|
||||
|
||||
clientBodyBufferSize := "1K"
|
||||
annotations := make(map[string]string)
|
||||
annotations["nginx.ingress.kubernetes.io/client-body-buffer-size"] = clientBodyBufferSize
|
||||
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
return strings.Contains(server, "client_body_buffer_size 1K;")
|
||||
return strings.Contains(server, fmt.Sprintf("client_body_buffer_size %s;", clientBodyBufferSize))
|
||||
})
|
||||
})
|
||||
|
||||
ginkgo.It("should set client_body_buffer_size to 1k", func() {
|
||||
host := "proxy.foo.com"
|
||||
annotations := map[string]string{
|
||||
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1k",
|
||||
}
|
||||
host := "client-body-buffer-size.com"
|
||||
|
||||
clientBodyBufferSize := "1k"
|
||||
annotations := make(map[string]string)
|
||||
annotations["nginx.ingress.kubernetes.io/client-body-buffer-size"] = clientBodyBufferSize
|
||||
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
return strings.Contains(server, "client_body_buffer_size 1k;")
|
||||
return strings.Contains(server, fmt.Sprintf("client_body_buffer_size %s;", clientBodyBufferSize))
|
||||
})
|
||||
})
|
||||
|
||||
ginkgo.It("should set client_body_buffer_size to 1m", func() {
|
||||
host := "proxy.foo.com"
|
||||
annotations := map[string]string{
|
||||
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1m",
|
||||
}
|
||||
host := "client-body-buffer-size.com"
|
||||
|
||||
clientBodyBufferSize := "1m"
|
||||
annotations := make(map[string]string)
|
||||
annotations["nginx.ingress.kubernetes.io/client-body-buffer-size"] = clientBodyBufferSize
|
||||
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
return strings.Contains(server, "client_body_buffer_size 1m;")
|
||||
return strings.Contains(server, fmt.Sprintf("client_body_buffer_size %s;", clientBodyBufferSize))
|
||||
})
|
||||
})
|
||||
|
||||
ginkgo.It("should set client_body_buffer_size to 1M", func() {
|
||||
host := "proxy.foo.com"
|
||||
annotations := map[string]string{
|
||||
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1M",
|
||||
}
|
||||
host := "client-body-buffer-size.com"
|
||||
|
||||
clientBodyBufferSize := "1M"
|
||||
annotations := make(map[string]string)
|
||||
annotations["nginx.ingress.kubernetes.io/client-body-buffer-size"] = clientBodyBufferSize
|
||||
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
return strings.Contains(server, "client_body_buffer_size 1M;")
|
||||
return strings.Contains(server, fmt.Sprintf("client_body_buffer_size %s;", clientBodyBufferSize))
|
||||
})
|
||||
})
|
||||
|
||||
ginkgo.It("should not set client_body_buffer_size to invalid 1b", func() {
|
||||
host := "proxy.foo.com"
|
||||
annotations := map[string]string{
|
||||
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1b",
|
||||
}
|
||||
host := "client-body-buffer-size.com"
|
||||
|
||||
clientBodyBufferSize := "1b"
|
||||
annotations := make(map[string]string)
|
||||
annotations["nginx.ingress.kubernetes.io/client-body-buffer-size"] = clientBodyBufferSize
|
||||
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, annotations)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
return !strings.Contains(server, "client_body_buffer_size 1b;")
|
||||
return !strings.Contains(server, fmt.Sprintf("client_body_buffer_size %s;", clientBodyBufferSize))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue