@@ -78,6 +78,7 @@ var _ = framework.IngressNginxDescribe("[Flag] enable-ssl-passthrough", func() {
78
78
ginkgo .Context ("when handling traffic" , func () {
79
79
var tlsConfig * tls.Config
80
80
host := "testpassthrough.com"
81
+ url := "https://" + net .JoinHostPort (host , "443" )
81
82
echoName := "echopass"
82
83
secretName := host
83
84
@@ -153,6 +154,7 @@ var _ = framework.IngressNginxDescribe("[Flag] enable-ssl-passthrough", func() {
153
154
ginkgo .It ("should pass unknown traffic to default backend and handle known traffic" , func () {
154
155
/* This one should not receive traffic as it does not contain passthrough annotation */
155
156
hostBad := "noannotationnopassthrough.com"
157
+ urlBad := "https://" + net .JoinHostPort (hostBad , "443" )
156
158
ingBad := f .EnsureIngress (framework .NewSingleIngressWithTLS (hostBad ,
157
159
"/" ,
158
160
hostBad ,
@@ -173,34 +175,30 @@ var _ = framework.IngressNginxDescribe("[Flag] enable-ssl-passthrough", func() {
173
175
return strings .Contains (server , "listen 442" )
174
176
})
175
177
176
- //nolint:gosec // Ignore the gosec error in testing
177
178
f .HTTPTestClientWithTLSConfig (& tls.Config {ServerName : host , InsecureSkipVerify : true }).
178
179
GET ("/" ).
179
- WithURL ("https://" + net . JoinHostPort ( host , "443" ) ).
180
+ WithURL (url ).
180
181
ForceResolve (f .GetNginxIP (), 443 ).
181
182
Expect ().
182
183
Status (http .StatusOK )
183
184
184
- //nolint:gosec // Ignore the gosec error in testing
185
185
f .HTTPTestClientWithTLSConfig (& tls.Config {ServerName : hostBad , InsecureSkipVerify : true }).
186
186
GET ("/" ).
187
- WithURL ("https://" + net . JoinHostPort ( hostBad , "443" ) ).
187
+ WithURL (urlBad ).
188
188
ForceResolve (f .GetNginxIP (), 443 ).
189
189
Expect ().
190
190
Status (http .StatusNotFound )
191
191
192
- //nolint:gosec // Ignore the gosec error in testing
193
192
f .HTTPTestClientWithTLSConfig (tlsConfig ).
194
193
GET ("/" ).
195
- WithURL ("https://" + net . JoinHostPort ( host , "443" ) ).
194
+ WithURL (url ).
196
195
ForceResolve (f .GetNginxIP (), 443 ).
197
196
Expect ().
198
197
Status (http .StatusOK )
199
198
200
- //nolint:gosec // Ignore the gosec error in testing
201
199
f .HTTPTestClientWithTLSConfig (tlsConfigBad ).
202
200
GET ("/" ).
203
- WithURL ("https://" + net . JoinHostPort ( hostBad , "443" ) ).
201
+ WithURL (urlBad ).
204
202
ForceResolve (f .GetNginxIP (), 443 ).
205
203
Expect ().
206
204
Status (http .StatusNotFound )
@@ -222,10 +220,9 @@ var _ = framework.IngressNginxDescribe("[Flag] enable-ssl-passthrough", func() {
222
220
223
221
ginkgo .It ("should handle known traffic without Host header" , func () {
224
222
for i := 0 ; i < tries ; i ++ {
225
- //nolint:gosec // Ignore the gosec error in testing
226
223
f .HTTPTestClientWithTLSConfig (& tls.Config {ServerName : host , InsecureSkipVerify : true }).
227
224
GET ("/" ).
228
- WithURL ("https://" + net . JoinHostPort ( host , "443" ) ).
225
+ WithURL (url ).
229
226
ForceResolve (f .GetNginxIP (), 443 ).
230
227
WithDialContextMiddleware (throttleMiddleware ).
231
228
Expect ().
@@ -235,10 +232,9 @@ var _ = framework.IngressNginxDescribe("[Flag] enable-ssl-passthrough", func() {
235
232
236
233
ginkgo .It ("should handle known traffic with Host header" , func () {
237
234
for i := 0 ; i < tries ; i ++ {
238
- //nolint:gosec // Ignore the gosec error in testing
239
235
f .HTTPTestClientWithTLSConfig (tlsConfig ).
240
236
GET ("/" ).
241
- WithURL ("https://" + net . JoinHostPort ( host , "443" ) ).
237
+ WithURL (url ).
242
238
WithHeader ("Host" , host ).
243
239
ForceResolve (f .GetNginxIP (), 443 ).
244
240
WithDialContextMiddleware (throttleMiddleware ).
@@ -249,10 +245,9 @@ var _ = framework.IngressNginxDescribe("[Flag] enable-ssl-passthrough", func() {
249
245
250
246
ginkgo .It ("should handle insecure traffic with Host header" , func () {
251
247
for i := 0 ; i < tries ; i ++ {
252
- //nolint:gosec // Ignore the gosec error in testing
253
248
f .HTTPTestClientWithTLSConfig (& tls.Config {ServerName : host , InsecureSkipVerify : true }).
254
249
GET ("/" ).
255
- WithURL ("https://" + net . JoinHostPort ( host , "443" ) ).
250
+ WithURL (url ).
256
251
WithHeader ("Host" , host ).
257
252
ForceResolve (f .GetNginxIP (), 443 ).
258
253
WithDialContextMiddleware (throttleMiddleware ).
0 commit comments