Fix golangci-lint errors (#10196)
* Fix golangci-lint errors Signed-off-by: z1cheng <imchench@gmail.com> * Fix dupl errors Signed-off-by: z1cheng <imchench@gmail.com> * Fix comments Signed-off-by: z1cheng <imchench@gmail.com> * Fix errcheck lint errors Signed-off-by: z1cheng <imchench@gmail.com> * Fix assert in e2e test Signed-off-by: z1cheng <imchench@gmail.com> * Not interrupt the waitForPodsReady Signed-off-by: z1cheng <imchench@gmail.com> * Replace string with constant Signed-off-by: z1cheng <imchench@gmail.com> * Fix comments Signed-off-by: z1cheng <imchench@gmail.com> * Revert write file permision Signed-off-by: z1cheng <imchench@gmail.com> --------- Signed-off-by: z1cheng <imchench@gmail.com>
This commit is contained in:
parent
46d87d3462
commit
b3060bfbd0
253 changed files with 2434 additions and 2113 deletions
|
|
@ -33,8 +33,10 @@ import (
|
|||
"k8s.io/ingress-nginx/test/e2e/framework"
|
||||
)
|
||||
|
||||
const proxyProtocol = "proxy-protocol"
|
||||
|
||||
var _ = framework.DescribeSetting("use-proxy-protocol", func() {
|
||||
f := framework.NewDefaultFramework("proxy-protocol")
|
||||
f := framework.NewDefaultFramework(proxyProtocol)
|
||||
|
||||
setting := "use-proxy-protocol"
|
||||
|
||||
|
|
@ -42,9 +44,9 @@ var _ = framework.DescribeSetting("use-proxy-protocol", func() {
|
|||
f.NewEchoDeployment()
|
||||
f.UpdateNginxConfigMapData(setting, "false")
|
||||
})
|
||||
|
||||
//nolint:dupl // Ignore dupl errors for similar test case
|
||||
ginkgo.It("should respect port passed by the PROXY Protocol", func() {
|
||||
host := "proxy-protocol"
|
||||
host := proxyProtocol
|
||||
|
||||
f.UpdateNginxConfigMapData(setting, "true")
|
||||
|
||||
|
|
@ -73,14 +75,15 @@ var _ = framework.DescribeSetting("use-proxy-protocol", func() {
|
|||
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error reading connection data")
|
||||
|
||||
body := string(data)
|
||||
assert.Contains(ginkgo.GinkgoT(), body, fmt.Sprintf("host=%v", "proxy-protocol"))
|
||||
assert.Contains(ginkgo.GinkgoT(), body, fmt.Sprintf("host=%v", proxyProtocol))
|
||||
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-port=1234")
|
||||
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-proto=http")
|
||||
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-for=192.168.0.1")
|
||||
})
|
||||
|
||||
//nolint:dupl // Ignore dupl errors for similar test case
|
||||
ginkgo.It("should respect proto passed by the PROXY Protocol server port", func() {
|
||||
host := "proxy-protocol"
|
||||
host := proxyProtocol
|
||||
|
||||
f.UpdateNginxConfigMapData(setting, "true")
|
||||
|
||||
|
|
@ -109,14 +112,14 @@ var _ = framework.DescribeSetting("use-proxy-protocol", func() {
|
|||
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error reading connection data")
|
||||
|
||||
body := string(data)
|
||||
assert.Contains(ginkgo.GinkgoT(), body, fmt.Sprintf("host=%v", "proxy-protocol"))
|
||||
assert.Contains(ginkgo.GinkgoT(), body, fmt.Sprintf("host=%v", proxyProtocol))
|
||||
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-port=443")
|
||||
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-proto=https")
|
||||
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-for=192.168.0.1")
|
||||
})
|
||||
|
||||
ginkgo.It("should enable PROXY Protocol for HTTPS", func() {
|
||||
host := "proxy-protocol"
|
||||
host := proxyProtocol
|
||||
|
||||
f.UpdateNginxConfigMapData(setting, "true")
|
||||
|
||||
|
|
@ -151,7 +154,7 @@ var _ = framework.DescribeSetting("use-proxy-protocol", func() {
|
|||
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error reading connection data")
|
||||
|
||||
body := string(data)
|
||||
assert.Contains(ginkgo.GinkgoT(), body, fmt.Sprintf("host=%v", "proxy-protocol"))
|
||||
assert.Contains(ginkgo.GinkgoT(), body, fmt.Sprintf("host=%v", proxyProtocol))
|
||||
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-port=1234")
|
||||
assert.Contains(ginkgo.GinkgoT(), body, "x-forwarded-proto=https")
|
||||
assert.Contains(ginkgo.GinkgoT(), body, "x-scheme=https")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue