Improved disableaccesslog tests (#7463)

1. Added check to validate if nginx ingress controller is reachable after disabling access log.
2. Added disable-stream-access-log test
This commit is contained in:
yashikabadaya 2021-08-12 23:37:50 +05:30 committed by GitHub
parent 7842d732b0
commit b510b0e930
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,6 +22,7 @@ import (
"github.com/onsi/ginkgo"
"k8s.io/ingress-nginx/test/e2e/framework"
"net/http"
)
var _ = framework.DescribeAnnotation("disable-access-log disable-http-access-log disable-stream-access-log", func() {
@ -41,6 +42,12 @@ var _ = framework.DescribeAnnotation("disable-access-log disable-http-access-log
f.WaitForNginxConfiguration(func(ngx string) bool {
return strings.Contains(ngx, `access_log off;`)
})
f.HTTPTestClient().
GET("/").
WithHeader("Host", host).
Expect().
Status(http.StatusOK)
})
ginkgo.It("disable-http-access-log set access_log off", func() {
@ -53,5 +60,29 @@ var _ = framework.DescribeAnnotation("disable-access-log disable-http-access-log
f.WaitForNginxConfiguration(func(ngx string) bool {
return strings.Contains(ngx, `access_log off;`)
})
f.HTTPTestClient().
GET("/").
WithHeader("Host", host).
Expect().
Status(http.StatusOK)
})
ginkgo.It("disable-stream-access-log set access_log off", func() {
host := "disablehttpaccesslog.foo.com"
f.UpdateNginxConfigMapData("disable-stream-access-log", "true")
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, nil)
f.EnsureIngress(ing)
f.WaitForNginxConfiguration(func(ngx string) bool {
return strings.Contains(ngx, `access_log off;`)
})
f.HTTPTestClient().
GET("/").
WithHeader("Host", host).
Expect().
Status(http.StatusOK)
})
})