@@ -27,62 +27,70 @@ var DynamicResolverBackendTest = suite.ConformanceTest{
27
27
"testdata/httproute-with-dynamic-resolver-backend.yaml" ,
28
28
},
29
29
Test : func (t * testing.T , suite * suite.ConformanceTestSuite ) {
30
- ns := "gateway-conformance-infra"
31
- routeNN := types.NamespacedName {Name : "httproute-with-dynamic-resolver-backend" , Namespace : ns }
32
- gwNN := types.NamespacedName {Name : "same-namespace" , Namespace : ns }
30
+ gwNN := types.NamespacedName {Name : "same-namespace" , Namespace : ConformanceInfraNamespace }
31
+ routeNN := types.NamespacedName {Name : "httproute-with-dynamic-resolver-backend" , Namespace : ConformanceInfraNamespace }
33
32
gwAddr := kubernetes .GatewayAndHTTPRoutesMustBeAccepted (t , suite .Client , suite .TimeoutConfig , suite .ControllerName , kubernetes .NewGatewayRef (gwNN ), routeNN )
34
- BackendMustBeAccepted (t , suite .Client , types.NamespacedName {Name : "backend-dynamic-resolver" , Namespace : ns })
33
+ BackendMustBeAccepted (t , suite .Client , types.NamespacedName {Name : "backend-dynamic-resolver" , Namespace : ConformanceInfraNamespace })
35
34
36
35
t .Run ("route to service foo" , func (t * testing.T ) {
37
36
expectedResponse := http.ExpectedResponse {
38
37
Request : http.Request {
39
- Host : "test-service-foo.gateway-conformance-infra" ,
38
+ Host : "test-service-foo.gateway-conformance-infra.svc.cluster.local " ,
40
39
Path : "/" ,
41
40
},
42
41
Response : http.Response {
43
42
StatusCode : 200 ,
44
43
},
45
- Namespace : ns ,
44
+ Namespace : ConformanceInfraNamespace ,
46
45
}
47
46
48
47
http .MakeRequestAndExpectEventuallyConsistentResponse (t , suite .RoundTripper , suite .TimeoutConfig , gwAddr , expectedResponse )
49
48
})
50
49
t .Run ("route to service bar" , func (t * testing.T ) {
51
50
expectedResponse := http.ExpectedResponse {
52
51
Request : http.Request {
53
- Host : "test-service-bar.gateway-conformance-infra" ,
52
+ Host : "test-service-bar.gateway-conformance-infra.svc.cluster.local " ,
54
53
Path : "/" ,
55
54
},
56
55
Response : http.Response {
57
56
StatusCode : 200 ,
58
57
},
59
- Namespace : ns ,
58
+ Namespace : ConformanceInfraNamespace ,
60
59
}
61
60
62
61
http .MakeRequestAndExpectEventuallyConsistentResponse (t , suite .RoundTripper , suite .TimeoutConfig , gwAddr , expectedResponse )
63
62
})
64
-
65
63
t .Run ("route to external service with app protocol" , func (t * testing.T ) {
66
- routeNN := types.NamespacedName {Name : "httproute-with-dynamic-resolver-backend-with-app-protocol" , Namespace : ns }
64
+ routeNN := types.NamespacedName {Name : "httproute-with-dynamic-resolver-backend-with-app-protocol" , Namespace : ConformanceInfraNamespace }
67
65
gwAddr := kubernetes .GatewayAndHTTPRoutesMustBeAccepted (t , suite .Client , suite .TimeoutConfig , suite .ControllerName , kubernetes .NewGatewayRef (gwNN ), routeNN )
68
- BackendMustBeAccepted (t , suite .Client , types.NamespacedName {Name : "backend-dynamic-resolver-with-app-protocol" , Namespace : ns })
66
+ BackendMustBeAccepted (t , suite .Client , types.NamespacedName {Name : "backend-dynamic-resolver-with-app-protocol" , Namespace : ConformanceInfraNamespace })
69
67
70
- expectedResponse := http.ExpectedResponse {
68
+ http . MakeRequestAndExpectEventuallyConsistentResponse ( t , suite . RoundTripper , suite . TimeoutConfig , gwAddr , http.ExpectedResponse {
71
69
Request : http.Request {
72
70
Host : "httpbin.org" ,
73
71
Path : "/status/200" ,
74
72
},
75
- ExpectedRequest : & http.ExpectedRequest {
76
- Request : http.Request {
77
- Host : "" ,
78
- },
73
+ Response : http.Response {
74
+ StatusCode : 502 , // request will fail because httpbin.org doesn't support http2.0
75
+ },
76
+ })
77
+
78
+ // test with nghttp2.org, it support http2.0
79
+ // https://github.com/postmanlabs/httpbin/issues/373#issuecomment-354534597
80
+ req := http .MakeRequest (t , & http.ExpectedResponse {
81
+ Request : http.Request {
82
+ Host : "nghttp2.org" ,
83
+ Path : "httpbin/status/200" ,
79
84
},
80
85
Response : http.Response {
81
86
StatusCode : 200 ,
82
87
},
83
- }
84
-
85
- http .MakeRequestAndExpectEventuallyConsistentResponse (t , suite .RoundTripper , suite .TimeoutConfig , gwAddr , expectedResponse )
88
+ }, gwAddr , "HTTP" , "http" )
89
+ http .WaitForConsistentResponse (t , suite .RoundTripper , req , http.ExpectedResponse {
90
+ Response : http.Response {
91
+ StatusCode : 200 ,
92
+ },
93
+ }, suite .TimeoutConfig .RequiredConsecutiveSuccesses , suite .TimeoutConfig .MaxTimeToConsistency )
86
94
})
87
95
},
88
96
}
0 commit comments