Fix golang-ci linter errors (#10128)
* Fix golang-ci linter errors Signed-off-by: z1cheng <imchench@gmail.com> * Fix gofmt errors Signed-off-by: z1cheng <imchench@gmail.com> * Add nolint comment to defaults.Backend in Configuration Signed-off-by: z1cheng <imchench@gmail.com> * Add #nosec comment to rand.New func Signed-off-by: z1cheng <imchench@gmail.com> * Fix errcheck warnings Signed-off-by: z1cheng <imchench@gmail.com> * Fix gofmt check Signed-off-by: z1cheng <imchench@gmail.com> * Fix unit tests and comments Signed-off-by: z1cheng <imchench@gmail.com> --------- Signed-off-by: z1cheng <imchench@gmail.com>
This commit is contained in:
parent
f50431a9f9
commit
d44a8e0045
37 changed files with 206 additions and 162 deletions
|
|
@ -63,8 +63,12 @@ var _ = framework.DescribeSetting("use-proxy-protocol", func() {
|
|||
defer conn.Close()
|
||||
|
||||
header := "PROXY TCP4 192.168.0.1 192.168.0.11 56324 1234\r\n"
|
||||
conn.Write([]byte(header))
|
||||
conn.Write([]byte("GET / HTTP/1.1\r\nHost: proxy-protocol\r\n\r\n"))
|
||||
if _, err := conn.Write([]byte(header)); err != nil {
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error writing header")
|
||||
}
|
||||
if _, err := conn.Write([]byte("GET / HTTP/1.1\r\nHost: proxy-protocol\r\n\r\n")); err != nil {
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error writing request")
|
||||
}
|
||||
|
||||
data, err := io.ReadAll(conn)
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error reading connection data")
|
||||
|
|
@ -96,8 +100,12 @@ var _ = framework.DescribeSetting("use-proxy-protocol", func() {
|
|||
defer conn.Close()
|
||||
|
||||
header := "PROXY TCP4 192.168.0.1 192.168.0.11 56324 443\r\n"
|
||||
conn.Write([]byte(header))
|
||||
conn.Write([]byte("GET / HTTP/1.1\r\nHost: proxy-protocol\r\n\r\n"))
|
||||
if _, err := conn.Write([]byte(header)); err != nil {
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error writing header")
|
||||
}
|
||||
if _, err := conn.Write([]byte("GET / HTTP/1.1\r\nHost: proxy-protocol\r\n\r\n")); err != nil {
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error writing request")
|
||||
}
|
||||
|
||||
data, err := io.ReadAll(conn)
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error reading connection data")
|
||||
|
|
@ -205,9 +213,12 @@ var _ = framework.DescribeSetting("use-proxy-protocol", func() {
|
|||
defer conn.Close()
|
||||
|
||||
header := "PROXY TCP4 192.168.0.1 192.168.0.11 56324 8080\r\n"
|
||||
conn.Write([]byte(header))
|
||||
conn.Write([]byte("GET / HTTP/1.1\r\nHost: proxy-protocol\r\n\r\n"))
|
||||
|
||||
if _, err := conn.Write([]byte(header)); err != nil {
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error writing header")
|
||||
}
|
||||
if _, err := conn.Write([]byte("GET / HTTP/1.1\r\nHost: proxy-protocol\r\n\r\n")); err != nil {
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error writing request")
|
||||
}
|
||||
_, err = io.ReadAll(conn)
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "unexpected error reading connection data")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue