Skip to content

Commit ba8f9dd

Browse files
committed
Update build graph test
1 parent 5edbbcd commit ba8f9dd

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

internal/controller/state/graph/graph_test.go

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,19 +778,59 @@ func TestBuildGraph(t *testing.T) {
778778
NamespacedName: client.ObjectKeyFromObject(gw1.Source),
779779
EffectiveNginxProxy: np1Effective,
780780
},
781+
Attachment: &ParentRefAttachmentStatus{
782+
AcceptedHostnames: map[string][]string{},
783+
Attached: false,
784+
FailedConditions: []conditions.Condition{conditions.NewRouteNotAllowedByListeners()},
785+
},
786+
SectionName: &gw1.Source.Spec.Listeners[0].Name,
787+
},
788+
{
789+
Idx: 1,
790+
Gateway: &ParentRefGateway{
791+
NamespacedName: client.ObjectKeyFromObject(gw1.Source),
792+
EffectiveNginxProxy: np1Effective,
793+
},
794+
Attachment: &ParentRefAttachmentStatus{
795+
AcceptedHostnames: map[string][]string{},
796+
Attached: false,
797+
FailedConditions: []conditions.Condition{conditions.NewRouteNotAllowedByListeners()},
798+
},
799+
SectionName: &gw1.Source.Spec.Listeners[1].Name,
800+
},
801+
{
802+
Idx: 2,
803+
Gateway: &ParentRefGateway{
804+
NamespacedName: client.ObjectKeyFromObject(gw1.Source),
805+
EffectiveNginxProxy: np1Effective,
806+
},
781807
Attachment: &ParentRefAttachmentStatus{
782808
Attached: true,
783809
AcceptedHostnames: map[string][]string{
784810
CreateGatewayListenerKey(
785811
client.ObjectKeyFromObject(gw1.Source),
786812
"listener-443-2",
787813
): {"fizz.example.org"},
814+
},
815+
},
816+
SectionName: &gw1.Source.Spec.Listeners[2].Name,
817+
},
818+
{
819+
Idx: 3,
820+
Gateway: &ParentRefGateway{
821+
NamespacedName: client.ObjectKeyFromObject(gw1.Source),
822+
EffectiveNginxProxy: np1Effective,
823+
},
824+
Attachment: &ParentRefAttachmentStatus{
825+
Attached: true,
826+
AcceptedHostnames: map[string][]string{
788827
CreateGatewayListenerKey(
789828
client.ObjectKeyFromObject(gw1.Source),
790829
"listener-8443",
791830
): {"fizz.example.org"},
792831
},
793832
},
833+
SectionName: &gw1.Source.Spec.Listeners[3].Name,
794834
},
795835
},
796836
Spec: L4RouteSpec{
@@ -820,11 +860,51 @@ func TestBuildGraph(t *testing.T) {
820860
NamespacedName: client.ObjectKeyFromObject(gw1.Source),
821861
EffectiveNginxProxy: np1Effective,
822862
},
863+
Attachment: &ParentRefAttachmentStatus{
864+
Attached: false,
865+
AcceptedHostnames: map[string][]string{},
866+
FailedConditions: []conditions.Condition{conditions.NewRouteNotAllowedByListeners()},
867+
},
868+
SectionName: &gw1.Source.Spec.Listeners[0].Name,
869+
},
870+
{
871+
Idx: 1,
872+
Gateway: &ParentRefGateway{
873+
NamespacedName: client.ObjectKeyFromObject(gw1.Source),
874+
EffectiveNginxProxy: np1Effective,
875+
},
876+
Attachment: &ParentRefAttachmentStatus{
877+
AcceptedHostnames: map[string][]string{},
878+
Attached: false,
879+
FailedConditions: []conditions.Condition{conditions.NewRouteNotAllowedByListeners()},
880+
},
881+
SectionName: &gw1.Source.Spec.Listeners[1].Name,
882+
},
883+
{
884+
Idx: 2,
885+
Gateway: &ParentRefGateway{
886+
NamespacedName: client.ObjectKeyFromObject(gw1.Source),
887+
EffectiveNginxProxy: np1Effective,
888+
},
889+
Attachment: &ParentRefAttachmentStatus{
890+
Attached: false,
891+
AcceptedHostnames: map[string][]string{},
892+
FailedConditions: []conditions.Condition{conditions.NewRouteHostnameConflict()},
893+
},
894+
SectionName: &gw1.Source.Spec.Listeners[2].Name,
895+
},
896+
{
897+
Idx: 3,
898+
Gateway: &ParentRefGateway{
899+
NamespacedName: client.ObjectKeyFromObject(gw1.Source),
900+
EffectiveNginxProxy: np1Effective,
901+
},
823902
Attachment: &ParentRefAttachmentStatus{
824903
Attached: false,
825904
AcceptedHostnames: map[string][]string{},
826905
FailedConditions: []conditions.Condition{conditions.NewRouteHostnameConflict()},
827906
},
907+
SectionName: &gw1.Source.Spec.Listeners[3].Name,
828908
},
829909
},
830910
Spec: L4RouteSpec{

0 commit comments

Comments
 (0)