@@ -35,16 +35,17 @@ import (
35
35
"k8s.io/ingress-nginx/test/e2e/framework"
36
36
)
37
37
38
- const echoHost = "echo"
38
+ const (
39
+ echoHost = "echo"
40
+ host = "grpc"
41
+ )
39
42
40
43
var _ = framework .DescribeAnnotation ("backend-protocol - GRPC" , func () {
41
44
f := framework .NewDefaultFramework ("grpc" , framework .WithHTTPBunEnabled ())
42
45
43
46
ginkgo .It ("should use grpc_pass in the configuration file" , func () {
44
47
f .NewGRPCFortuneTellerDeployment ()
45
48
46
- host := "grpc"
47
-
48
49
annotations := map [string ]string {
49
50
"nginx.ingress.kubernetes.io/backend-protocol" : "GRPC" ,
50
51
}
@@ -259,4 +260,48 @@ var _ = framework.DescribeAnnotation("backend-protocol - GRPC", func() {
259
260
metadata := res .GetMetadata ()
260
261
assert .Equal (ginkgo .GinkgoT (), metadata ["content-type" ].Values [0 ], "application/grpc" )
261
262
})
263
+
264
+ ginkgo .It ("should set valid grpc timeouts for grpc" , func () {
265
+ proxyConnectTimeout := "5"
266
+ proxySendTimeout := "30"
267
+ proxyReadtimeout := "30"
268
+
269
+ annotations := make (map [string ]string )
270
+ annotations ["nginx.ingress.kubernetes.io/backend-protocol" ] = "grpc"
271
+ annotations ["nginx.ingress.kubernetes.io/proxy-connect-timeout" ] = proxyConnectTimeout
272
+ annotations ["nginx.ingress.kubernetes.io/proxy-send-timeout" ] = proxySendTimeout
273
+ annotations ["nginx.ingress.kubernetes.io/proxy-read-timeout" ] = proxyReadtimeout
274
+
275
+ ing := framework .NewSingleIngress (host , "/" , host , f .Namespace , framework .EchoService , 80 , annotations )
276
+ f .EnsureIngress (ing )
277
+
278
+ f .WaitForNginxServer (host ,
279
+ func (server string ) bool {
280
+ return strings .Contains (server , fmt .Sprintf ("grpc_connect_timeout %ss;" , proxyConnectTimeout )) &&
281
+ strings .Contains (server , fmt .Sprintf ("grpc_send_timeout %ss;" , proxySendTimeout )) &&
282
+ strings .Contains (server , fmt .Sprintf ("grpc_read_timeout %ss;" , proxyReadtimeout ))
283
+ })
284
+ })
285
+
286
+ ginkgo .It ("should set valid grpc timeouts for grpcs" , func () {
287
+ proxyConnectTimeout := "5"
288
+ proxySendTimeout := "30"
289
+ proxyReadtimeout := "30"
290
+
291
+ annotations := make (map [string ]string )
292
+ annotations ["nginx.ingress.kubernetes.io/backend-protocol" ] = "grpcs"
293
+ annotations ["nginx.ingress.kubernetes.io/proxy-connect-timeout" ] = proxyConnectTimeout
294
+ annotations ["nginx.ingress.kubernetes.io/proxy-send-timeout" ] = proxySendTimeout
295
+ annotations ["nginx.ingress.kubernetes.io/proxy-read-timeout" ] = proxyReadtimeout
296
+
297
+ ing := framework .NewSingleIngress (host , "/" , host , f .Namespace , framework .EchoService , 80 , annotations )
298
+ f .EnsureIngress (ing )
299
+
300
+ f .WaitForNginxServer (host ,
301
+ func (server string ) bool {
302
+ return strings .Contains (server , fmt .Sprintf ("grpc_connect_timeout %ss;" , proxyConnectTimeout )) &&
303
+ strings .Contains (server , fmt .Sprintf ("grpc_send_timeout %ss;" , proxySendTimeout )) &&
304
+ strings .Contains (server , fmt .Sprintf ("grpc_read_timeout %ss;" , proxyReadtimeout ))
305
+ })
306
+ })
262
307
})
0 commit comments