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:
Chen Chen 2023-08-31 15:36:48 +08:00 committed by GitHub
parent 46d87d3462
commit b3060bfbd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
253 changed files with 2434 additions and 2113 deletions

View file

@ -26,6 +26,8 @@ import (
"k8s.io/ingress-nginx/test/e2e/framework"
)
const authTLSFooHost = "authtls.foo.com"
var _ = framework.DescribeAnnotation("auth-tls-*", func() {
f := framework.NewDefaultFramework("authtls")
@ -34,7 +36,7 @@ var _ = framework.DescribeAnnotation("auth-tls-*", func() {
})
ginkgo.It("should set sslClientCertificate, sslVerifyClient and sslVerifyDepth with auth-tls-secret", func() {
host := "authtls.foo.com"
host := authTLSFooHost
nameSpace := f.Namespace
clientConfig, err := framework.CreateIngressMASecret(
@ -82,7 +84,7 @@ var _ = framework.DescribeAnnotation("auth-tls-*", func() {
})
ginkgo.It("should set valid auth-tls-secret, sslVerify to off, and sslVerifyDepth to 2", func() {
host := "authtls.foo.com"
host := authTLSFooHost
nameSpace := f.Namespace
_, err := framework.CreateIngressMASecret(
@ -112,7 +114,7 @@ var _ = framework.DescribeAnnotation("auth-tls-*", func() {
})
ginkgo.It("should 302 redirect to error page instead of 400 when auth-tls-error-page is set", func() {
host := "authtls.foo.com"
host := authTLSFooHost
nameSpace := f.Namespace
errorPath := "/error"
@ -159,7 +161,7 @@ var _ = framework.DescribeAnnotation("auth-tls-*", func() {
})
ginkgo.It("should pass URL-encoded certificate to upstream", func() {
host := "authtls.foo.com"
host := authTLSFooHost
nameSpace := f.Namespace
clientConfig, err := framework.CreateIngressMASecret(
@ -204,7 +206,7 @@ var _ = framework.DescribeAnnotation("auth-tls-*", func() {
})
ginkgo.It("should validate auth-tls-verify-client", func() {
host := "authtls.foo.com"
host := authTLSFooHost
nameSpace := f.Namespace
clientConfig, err := framework.CreateIngressMASecret(
@ -260,11 +262,10 @@ var _ = framework.DescribeAnnotation("auth-tls-*", func() {
WithHeader("Host", host).
Expect().
Status(http.StatusOK)
})
ginkgo.It("should return 403 using auth-tls-match-cn with no matching CN from client", func() {
host := "authtls.foo.com"
host := authTLSFooHost
nameSpace := f.Namespace
clientConfig, err := framework.CreateIngressMASecret(
@ -293,7 +294,7 @@ var _ = framework.DescribeAnnotation("auth-tls-*", func() {
})
ginkgo.It("should return 200 using auth-tls-match-cn with matching CN from client", func() {
host := "authtls.foo.com"
host := authTLSFooHost
nameSpace := f.Namespace
clientConfig, err := framework.CreateIngressMASecret(
@ -322,7 +323,7 @@ var _ = framework.DescribeAnnotation("auth-tls-*", func() {
})
ginkgo.It("should return 200 using auth-tls-match-cn where atleast one of the regex options matches CN from client", func() {
host := "authtls.foo.com"
host := authTLSFooHost
nameSpace := f.Namespace
clientConfig, err := framework.CreateIngressMASecret(
@ -351,7 +352,8 @@ var _ = framework.DescribeAnnotation("auth-tls-*", func() {
})
})
func assertSslClientCertificateConfig(f *framework.Framework, host string, verifyClient string, verifyDepth string) {
//nolint:unparam // Ignore the invariant param: host
func assertSslClientCertificateConfig(f *framework.Framework, host, verifyClient, verifyDepth string) {
sslClientCertDirective := fmt.Sprintf("ssl_client_certificate /etc/ingress-controller/ssl/%s-%s.pem;", f.Namespace, host)
sslVerify := fmt.Sprintf("ssl_verify_client %s;", verifyClient)
sslVerifyDepth := fmt.Sprintf("ssl_verify_depth %s;", verifyDepth)