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
|
|
@ -245,7 +245,6 @@ var _ = framework.IngressNginxDescribe("[Lua] dynamic certificates", func() {
|
|||
WithHeader("Host", host).
|
||||
Expect().
|
||||
Status(http.StatusOK)
|
||||
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
@ -254,7 +253,6 @@ func extractReloadCount(mf *dto.MetricFamily) (float64, error) {
|
|||
vec, err := expfmt.ExtractSamples(&expfmt.DecodeOptions{
|
||||
Timestamp: model.Now(),
|
||||
}, mf)
|
||||
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import (
|
|||
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
"github.com/stretchr/testify/assert"
|
||||
networking "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"k8s.io/ingress-nginx/test/e2e/framework"
|
||||
|
|
@ -199,20 +198,18 @@ var _ = framework.IngressNginxDescribe("[Lua] dynamic configuration", func() {
|
|||
})
|
||||
})
|
||||
|
||||
func ensureIngress(f *framework.Framework, host string, deploymentName string) *networking.Ingress {
|
||||
ing := createIngress(f, host, deploymentName)
|
||||
func ensureIngress(f *framework.Framework, host, deploymentName string) {
|
||||
createIngress(f, host, deploymentName)
|
||||
|
||||
f.HTTPTestClient().
|
||||
GET("/").
|
||||
WithHeader("Host", host).
|
||||
Expect().
|
||||
Status(http.StatusOK)
|
||||
|
||||
return ing
|
||||
}
|
||||
|
||||
func createIngress(f *framework.Framework, host string, deploymentName string) *networking.Ingress {
|
||||
ing := f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, deploymentName, 80,
|
||||
func createIngress(f *framework.Framework, host, deploymentName string) {
|
||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, deploymentName, 80,
|
||||
map[string]string{
|
||||
"nginx.ingress.kubernetes.io/load-balance": "ewma",
|
||||
},
|
||||
|
|
@ -223,21 +220,19 @@ func createIngress(f *framework.Framework, host string, deploymentName string) *
|
|||
return strings.Contains(server, fmt.Sprintf("server_name %s ;", host)) &&
|
||||
strings.Contains(server, "proxy_pass http://upstream_balancer;")
|
||||
})
|
||||
|
||||
return ing
|
||||
}
|
||||
|
||||
func ensureHTTPSRequest(f *framework.Framework, url string, host string, expectedDNSName string) {
|
||||
func ensureHTTPSRequest(f *framework.Framework, url, host, expectedDNSName string) {
|
||||
resp := f.HTTPTestClientWithTLSConfig(&tls.Config{
|
||||
ServerName: host,
|
||||
InsecureSkipVerify: true,
|
||||
InsecureSkipVerify: true, //nolint:gosec // Ignore the gosec error in testing
|
||||
}).
|
||||
GET("/").
|
||||
WithURL(url).
|
||||
WithHeader("Host", host).
|
||||
Expect().
|
||||
Raw()
|
||||
|
||||
defer resp.Body.Close()
|
||||
assert.Equal(ginkgo.GinkgoT(), resp.StatusCode, http.StatusOK)
|
||||
assert.Equal(ginkgo.GinkgoT(), len(resp.TLS.PeerCertificates), 1)
|
||||
assert.Equal(ginkgo.GinkgoT(), resp.TLS.PeerCertificates[0].DNSNames[0], expectedDNSName)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue