Skip to content

Commit b00d2bb

Browse files
authored
Merge pull request #2179 from levikobi/attached-routes-conformance
Improve AttachedRoutes conformance test
2 parents e9859d0 + 1c9ddc8 commit b00d2bb

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

conformance/tests/gateway-with-attached-routes.go

+34
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,39 @@ var GatewayWithAttachedRoutes = suite.ConformanceTest{
7676

7777
kubernetes.GatewayStatusMustHaveListeners(t, s.Client, s.TimeoutConfig, gwNN, listeners)
7878
})
79+
80+
t.Run("Gateway listener should have attached route by specifying the sectionName", func(t *testing.T) {
81+
gwNN := types.NamespacedName{Name: "gateway-with-two-listeners-and-one-attached-route", Namespace: "gateway-conformance-infra"}
82+
listeners := []v1beta1.ListenerStatus{
83+
{
84+
Name: v1beta1.SectionName("http-unattached"),
85+
SupportedKinds: []v1beta1.RouteGroupKind{{
86+
Group: (*v1beta1.Group)(&v1beta1.GroupVersion.Group),
87+
Kind: v1beta1.Kind("HTTPRoute"),
88+
}},
89+
Conditions: []metav1.Condition{{
90+
Type: string(v1beta1.ListenerConditionAccepted),
91+
Status: metav1.ConditionTrue,
92+
Reason: "", // any reason
93+
}},
94+
AttachedRoutes: 0,
95+
},
96+
{
97+
Name: v1beta1.SectionName("http"),
98+
SupportedKinds: []v1beta1.RouteGroupKind{{
99+
Group: (*v1beta1.Group)(&v1beta1.GroupVersion.Group),
100+
Kind: v1beta1.Kind("HTTPRoute"),
101+
}},
102+
Conditions: []metav1.Condition{{
103+
Type: string(v1beta1.ListenerConditionAccepted),
104+
Status: metav1.ConditionTrue,
105+
Reason: "", // any reason
106+
}},
107+
AttachedRoutes: 1,
108+
},
109+
}
110+
111+
kubernetes.GatewayStatusMustHaveListeners(t, s.Client, s.TimeoutConfig, gwNN, listeners)
112+
})
79113
},
80114
}

conformance/tests/gateway-with-attached-routes.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,44 @@ spec:
8686
- backendRefs:
8787
- name: infra-backend-v1
8888
port: 8080
89+
---
90+
apiVersion: gateway.networking.k8s.io/v1beta1
91+
kind: Gateway
92+
metadata:
93+
name: gateway-with-two-listeners-and-one-attached-route
94+
namespace: gateway-conformance-infra
95+
spec:
96+
gatewayClassName: "{GATEWAY_CLASS_NAME}"
97+
listeners:
98+
- name: http-unattached
99+
port: 8080
100+
protocol: HTTP
101+
allowedRoutes:
102+
kinds:
103+
- kind: HTTPRoute
104+
namespaces:
105+
from: All
106+
- name: http
107+
port: 80
108+
protocol: HTTP
109+
allowedRoutes:
110+
kinds:
111+
- kind: HTTPRoute
112+
namespaces:
113+
from: All
114+
---
115+
apiVersion: gateway.networking.k8s.io/v1beta1
116+
kind: HTTPRoute
117+
metadata:
118+
name: http-route-4
119+
namespace: gateway-conformance-infra
120+
spec:
121+
parentRefs:
122+
- kind: Gateway
123+
name: gateway-with-two-listeners-and-one-attached-route
124+
namespace: gateway-conformance-infra
125+
sectionName: http
126+
rules:
127+
- backendRefs:
128+
- name: infra-backend-v1
129+
port: 8080

0 commit comments

Comments
 (0)