Skip to content

Commit

Permalink
make chunkSize < len(host) and remove retries
Browse files Browse the repository at this point in the history
  • Loading branch information
chotiwat committed Oct 25, 2024
1 parent 525931b commit 6d8a420
Showing 1 changed file with 33 additions and 42 deletions.
75 changes: 33 additions & 42 deletions test/e2e/settings/ssl_passthrough.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,62 +214,53 @@ var _ = framework.IngressNginxDescribe("[Flag] enable-ssl-passthrough", func() {
conn, err := next(ctx, network, addr)
return &writeThrottledConn{
Conn: conn,
chunkSize: 50,
chunkSize: len(host) / 3,
}, err
}
}
tries := 3

ginkgo.It("should handle known traffic without Host header", func() {
for i := 0; i < tries; i++ {
f.HTTPTestClientWithTLSConfig(tlsConfig).
GET("/").
WithURL(url).
ForceResolve(f.GetNginxIP(), 443).
WithDialContextMiddleware(throttleMiddleware).
Expect().
Status(http.StatusOK)
}
f.HTTPTestClientWithTLSConfig(tlsConfig).
GET("/").
WithURL(url).
ForceResolve(f.GetNginxIP(), 443).
WithDialContextMiddleware(throttleMiddleware).
Expect().
Status(http.StatusOK)
})

ginkgo.It("should handle insecure traffic without Host header", func() {
for i := 0; i < tries; i++ {
//nolint:gosec // Ignore the gosec error in testing
f.HTTPTestClientWithTLSConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
GET("/").
WithURL(url).
ForceResolve(f.GetNginxIP(), 443).
WithDialContextMiddleware(throttleMiddleware).
Expect().
Status(http.StatusOK)
}
//nolint:gosec // Ignore the gosec error in testing
f.HTTPTestClientWithTLSConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
GET("/").
WithURL(url).
ForceResolve(f.GetNginxIP(), 443).
WithDialContextMiddleware(throttleMiddleware).
Expect().
Status(http.StatusOK)
})

ginkgo.It("should handle known traffic with Host header", func() {
for i := 0; i < tries; i++ {
f.HTTPTestClientWithTLSConfig(tlsConfig).
GET("/").
WithURL(url).
WithHeader("Host", host).
ForceResolve(f.GetNginxIP(), 443).
WithDialContextMiddleware(throttleMiddleware).
Expect().
Status(http.StatusOK)
}
f.HTTPTestClientWithTLSConfig(tlsConfig).
GET("/").
WithURL(url).
WithHeader("Host", host).
ForceResolve(f.GetNginxIP(), 443).
WithDialContextMiddleware(throttleMiddleware).
Expect().
Status(http.StatusOK)
})

ginkgo.It("should handle insecure traffic with Host header", func() {
for i := 0; i < tries; i++ {
//nolint:gosec // Ignore the gosec error in testing
f.HTTPTestClientWithTLSConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
GET("/").
WithURL(url).
WithHeader("Host", host).
ForceResolve(f.GetNginxIP(), 443).
WithDialContextMiddleware(throttleMiddleware).
Expect().
Status(http.StatusOK)
}
//nolint:gosec // Ignore the gosec error in testing
f.HTTPTestClientWithTLSConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
GET("/").
WithURL(url).
WithHeader("Host", host).
ForceResolve(f.GetNginxIP(), 443).
WithDialContextMiddleware(throttleMiddleware).
Expect().
Status(http.StatusOK)
})
})
})
Expand Down

0 comments on commit 6d8a420

Please sign in to comment.