Skip to content

Commit 150ade4

Browse files
committed
add test case to TestBuildConfiguration
1 parent 65e8a2a commit 150ade4

File tree

1 file changed

+69
-1
lines changed

1 file changed

+69
-1
lines changed

internal/mode/static/state/dataplane/configuration_test.go

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2154,6 +2154,56 @@ func TestBuildConfiguration(t *testing.T) {
21542154
},
21552155
ResolvedSecret: &secret1NsName,
21562156
},
2157+
{
2158+
Name: "tlsListener",
2159+
Source: v1.Listener{
2160+
Protocol: v1.TLSProtocolType,
2161+
Port: 8443,
2162+
},
2163+
Routes: make(map[graph.RouteKey]*graph.L7Route),
2164+
L4Routes: map[graph.L4RouteKey]*graph.L4Route{
2165+
{NamespacedName: types.NamespacedName{
2166+
Namespace: "default",
2167+
Name: "secure-app",
2168+
}}: {
2169+
Spec: graph.L4RouteSpec{
2170+
Hostnames: []v1.Hostname{"app.example.com", "cafe.example.com"},
2171+
BackendRef: graph.BackendRef{
2172+
SvcNsName: types.NamespacedName{
2173+
Namespace: "default",
2174+
Name: "secure-app",
2175+
},
2176+
ServicePort: apiv1.ServicePort{
2177+
Name: "https",
2178+
Protocol: "TCP",
2179+
Port: 8443,
2180+
TargetPort: intstr.IntOrString{
2181+
Type: intstr.Int,
2182+
IntVal: 8443,
2183+
},
2184+
},
2185+
Valid: true,
2186+
},
2187+
},
2188+
Valid: true,
2189+
},
2190+
{NamespacedName: types.NamespacedName{
2191+
Namespace: "default",
2192+
Name: "secure-app2",
2193+
}}: {},
2194+
{NamespacedName: types.NamespacedName{
2195+
Namespace: "default",
2196+
Name: "secure-app3",
2197+
}}: {
2198+
Valid: true,
2199+
Spec: graph.L4RouteSpec{
2200+
Hostnames: []v1.Hostname{"test.example.com"},
2201+
BackendRef: graph.BackendRef{},
2202+
},
2203+
},
2204+
},
2205+
Valid: true,
2206+
},
21572207
},
21582208
Policies: []*graph.Policy{gwPolicy1, gwPolicy2},
21592209
},
@@ -2286,6 +2336,24 @@ func TestBuildConfiguration(t *testing.T) {
22862336
},
22872337
},
22882338
Upstreams: []Upstream{fooUpstream},
2339+
StreamUpstreams: []Upstream{
2340+
{
2341+
Endpoints: fooEndpoints,
2342+
Name: "default_secure-app_8443",
2343+
},
2344+
},
2345+
TLSPassthroughServers: []Layer4VirtualServer{
2346+
{
2347+
Hostname: "app.example.com",
2348+
UpstreamName: "default_secure-app_8443",
2349+
Port: 443,
2350+
},
2351+
{
2352+
Hostname: "cafe.example.com",
2353+
UpstreamName: "default_secure-app_8443",
2354+
Port: 443,
2355+
},
2356+
},
22892357
BackendGroups: []BackendGroup{
22902358
expHRWithPolicyGroups[0],
22912359
expHTTPSHRWithPolicyGroups[0],
@@ -2294,7 +2362,7 @@ func TestBuildConfiguration(t *testing.T) {
22942362
HTTP2: true,
22952363
},
22962364
},
2297-
msg: "Simple Gateway and HTTPRoute with policies attached",
2365+
msg: "Simple Gateway, HTTPRoute with policies attached and TLSRoute",
22982366
},
22992367
}
23002368

0 commit comments

Comments
 (0)