Skip to content

Commit 1215a9a

Browse files
committed
Add test for HTTP and HTTPS listeners with same hostname and port
1 parent 8df41ca commit 1215a9a

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

internal/controller/state/graph/gateway_listener_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,38 @@ func TestOverlappingTLSConfigCondition(t *testing.T) {
865865
},
866866
expectedCondition: false,
867867
},
868+
{
869+
name: "no overlap - HTTP and HTTPS listeners with same hostname and port",
870+
gateway: &v1.Gateway{
871+
ObjectMeta: metav1.ObjectMeta{
872+
Name: "gateway",
873+
Namespace: "test-ns",
874+
},
875+
Spec: v1.GatewaySpec{
876+
Listeners: []v1.Listener{
877+
{
878+
Name: "listener1",
879+
Port: 80,
880+
Protocol: v1.HTTPProtocolType,
881+
Hostname: helpers.GetPointer[v1.Hostname]("app.example.com"),
882+
},
883+
{
884+
Name: "listener2",
885+
Port: 80,
886+
Protocol: v1.HTTPSProtocolType,
887+
Hostname: helpers.GetPointer[v1.Hostname]("app.example.com"),
888+
TLS: &v1.GatewayTLSConfig{
889+
Mode: helpers.GetPointer(v1.TLSModeTerminate),
890+
CertificateRefs: []v1.SecretObjectReference{
891+
{Name: "secret1"},
892+
},
893+
},
894+
},
895+
},
896+
},
897+
},
898+
expectedCondition: false,
899+
},
868900
}
869901

870902
for _, test := range tests {

0 commit comments

Comments
 (0)