Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve AttachedRoutes conformance test #2179

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions conformance/tests/gateway-with-attached-routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,39 @@ var GatewayWithAttachedRoutes = suite.ConformanceTest{

kubernetes.GatewayStatusMustHaveListeners(t, s.Client, s.TimeoutConfig, gwNN, listeners)
})

t.Run("Gateway listener should have attached route by specifying the sectionName", func(t *testing.T) {
gwNN := types.NamespacedName{Name: "gateway-with-two-listeners-and-one-attached-route", Namespace: "gateway-conformance-infra"}
listeners := []v1beta1.ListenerStatus{
{
Name: v1beta1.SectionName("http-unattached"),
SupportedKinds: []v1beta1.RouteGroupKind{{
Group: (*v1beta1.Group)(&v1beta1.GroupVersion.Group),
Kind: v1beta1.Kind("HTTPRoute"),
}},
Conditions: []metav1.Condition{{
Type: string(v1beta1.ListenerConditionAccepted),
Status: metav1.ConditionTrue,
levikobi marked this conversation as resolved.
Show resolved Hide resolved
Reason: "", // any reason
}},
AttachedRoutes: 0,
},
{
Name: v1beta1.SectionName("http"),
SupportedKinds: []v1beta1.RouteGroupKind{{
Group: (*v1beta1.Group)(&v1beta1.GroupVersion.Group),
Kind: v1beta1.Kind("HTTPRoute"),
}},
Conditions: []metav1.Condition{{
Type: string(v1beta1.ListenerConditionAccepted),
Status: metav1.ConditionTrue,
Reason: "", // any reason
}},
AttachedRoutes: 1,
},
}

kubernetes.GatewayStatusMustHaveListeners(t, s.Client, s.TimeoutConfig, gwNN, listeners)
})
},
}
41 changes: 41 additions & 0 deletions conformance/tests/gateway-with-attached-routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,44 @@ spec:
- backendRefs:
- name: infra-backend-v1
port: 8080
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: gateway-with-two-listeners-and-one-attached-route
namespace: gateway-conformance-infra
spec:
gatewayClassName: "{GATEWAY_CLASS_NAME}"
listeners:
- name: http-unattached
port: 8080
protocol: HTTP
allowedRoutes:
kinds:
- kind: HTTPRoute
namespaces:
from: All
- name: http
port: 80
protocol: HTTP
allowedRoutes:
kinds:
- kind: HTTPRoute
namespaces:
from: All
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: http-route-4
namespace: gateway-conformance-infra
spec:
parentRefs:
- kind: Gateway
name: gateway-with-two-listeners-and-one-attached-route
namespace: gateway-conformance-infra
sectionName: http
rules:
- backendRefs:
- name: infra-backend-v1
port: 8080