Skip to content

Commit 3305c90

Browse files
committed
Rename http routekey
1 parent e38aeac commit 3305c90

File tree

1 file changed

+53
-53
lines changed

1 file changed

+53
-53
lines changed

internal/mode/static/state/change_processor_test.go

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -422,21 +422,21 @@ var _ = Describe("ChangeProcessor", func() {
422422

423423
Describe("Process gateway resources", Ordered, func() {
424424
var (
425-
gcUpdated *v1.GatewayClass
426-
diffNsTLSSecret, sameNsTLSSecret *apiv1.Secret
427-
hr1, hr1Updated, hr2 *v1.HTTPRoute
428-
gr1, gr1Updated, gr2 *v1.GRPCRoute
429-
tr1, tr1Updated, tr2 *v1alpha2.TLSRoute
430-
gw1, gw1Updated, gw2 *v1.Gateway
431-
secretRefGrant, hrServiceRefGrant *v1beta1.ReferenceGrant
432-
grServiceRefGrant, trServiceRefGrant *v1beta1.ReferenceGrant
433-
expGraph *graph.Graph
434-
expRouteHR1, expRouteHR2 *graph.L7Route
435-
expRouteGR1, expRouteGR2 *graph.L7Route
436-
expRouteTR1, expRouteTR2 *graph.L4Route
437-
gatewayAPICRD, gatewayAPICRDUpdated *metav1.PartialObjectMetadata
438-
routeKey1, routeKey2, grpcRouteKey1, grpcRouteKey2 graph.RouteKey
439-
trKey1, trKey2 graph.L4RouteKey
425+
gcUpdated *v1.GatewayClass
426+
diffNsTLSSecret, sameNsTLSSecret *apiv1.Secret
427+
hr1, hr1Updated, hr2 *v1.HTTPRoute
428+
gr1, gr1Updated, gr2 *v1.GRPCRoute
429+
tr1, tr1Updated, tr2 *v1alpha2.TLSRoute
430+
gw1, gw1Updated, gw2 *v1.Gateway
431+
secretRefGrant, hrServiceRefGrant *v1beta1.ReferenceGrant
432+
grServiceRefGrant, trServiceRefGrant *v1beta1.ReferenceGrant
433+
expGraph *graph.Graph
434+
expRouteHR1, expRouteHR2 *graph.L7Route
435+
expRouteGR1, expRouteGR2 *graph.L7Route
436+
expRouteTR1, expRouteTR2 *graph.L4Route
437+
gatewayAPICRD, gatewayAPICRDUpdated *metav1.PartialObjectMetadata
438+
httpRouteKey1, httpRouteKey2, grpcRouteKey1, grpcRouteKey2 graph.RouteKey
439+
trKey1, trKey2 graph.L4RouteKey
440440
)
441441

442442
processAndValidateGraph := func(expGraph *graph.Graph) {
@@ -473,11 +473,11 @@ var _ = Describe("ChangeProcessor", func() {
473473
}
474474

475475
hr1 = createHTTPRoute("hr-1", "gateway-1", "foo.example.com", crossNsHTTPBackendRef)
476-
routeKey1 = graph.CreateRouteKey(hr1)
476+
httpRouteKey1 = graph.CreateRouteKey(hr1)
477477
hr1Updated = hr1.DeepCopy()
478478
hr1Updated.Generation++
479479
hr2 = createHTTPRoute("hr-2", "gateway-2", "bar.example.com")
480-
routeKey2 = graph.CreateRouteKey(hr2)
480+
httpRouteKey2 = graph.CreateRouteKey(hr2)
481481

482482
gr1 = createGRPCRoute("gr-1", "gateway-1", "foo.example.com", grpcBackendRef)
483483
grpcRouteKey1 = graph.CreateRouteKey(gr1)
@@ -897,7 +897,7 @@ var _ = Describe("ChangeProcessor", func() {
897897
Source: gw1.Spec.Listeners[0],
898898
Valid: true,
899899
Attachable: true,
900-
Routes: map[graph.RouteKey]*graph.L7Route{routeKey1: expRouteHR1, grpcRouteKey1: expRouteGR1},
900+
Routes: map[graph.RouteKey]*graph.L7Route{httpRouteKey1: expRouteHR1, grpcRouteKey1: expRouteGR1},
901901
L4Routes: map[graph.L4RouteKey]*graph.L4Route{},
902902
SupportedKinds: []v1.RouteGroupKind{
903903
{Kind: v1.Kind(kinds.HTTPRoute), Group: helpers.GetPointer[v1.Group](v1.GroupName)},
@@ -909,7 +909,7 @@ var _ = Describe("ChangeProcessor", func() {
909909
Source: gw1.Spec.Listeners[1],
910910
Valid: true,
911911
Attachable: true,
912-
Routes: map[graph.RouteKey]*graph.L7Route{routeKey1: expRouteHR1, grpcRouteKey1: expRouteGR1},
912+
Routes: map[graph.RouteKey]*graph.L7Route{httpRouteKey1: expRouteHR1, grpcRouteKey1: expRouteGR1},
913913
L4Routes: map[graph.L4RouteKey]*graph.L4Route{},
914914
ResolvedSecret: helpers.GetPointer(client.ObjectKeyFromObject(diffNsTLSSecret)),
915915
SupportedKinds: []v1.RouteGroupKind{
@@ -933,7 +933,7 @@ var _ = Describe("ChangeProcessor", func() {
933933
},
934934
IgnoredGateways: map[types.NamespacedName]*v1.Gateway{},
935935
L4Routes: map[graph.L4RouteKey]*graph.L4Route{trKey1: expRouteTR1},
936-
Routes: map[graph.RouteKey]*graph.L7Route{routeKey1: expRouteHR1, grpcRouteKey1: expRouteGR1},
936+
Routes: map[graph.RouteKey]*graph.L7Route{httpRouteKey1: expRouteHR1, grpcRouteKey1: expRouteGR1},
937937
ReferencedSecrets: map[types.NamespacedName]*graph.Secret{},
938938
ReferencedServices: map[types.NamespacedName]struct{}{
939939
{
@@ -1010,7 +1010,7 @@ var _ = Describe("ChangeProcessor", func() {
10101010
expGraph.Gateway.Listeners = nil
10111011

10121012
// no ref grant exists yet for the routes
1013-
expGraph.Routes[routeKey1].Conditions = []conditions.Condition{
1013+
expGraph.Routes[httpRouteKey1].Conditions = []conditions.Condition{
10141014
staticConds.NewRouteBackendRefRefNotPermitted(
10151015
"Backend ref to Service service-ns/service not permitted by any ReferenceGrant",
10161016
),
@@ -1029,11 +1029,11 @@ var _ = Describe("ChangeProcessor", func() {
10291029
}
10301030

10311031
// gateway class does not exist so routes cannot attach
1032-
expGraph.Routes[routeKey1].ParentRefs[0].Attachment = &graph.ParentRefAttachmentStatus{
1032+
expGraph.Routes[httpRouteKey1].ParentRefs[0].Attachment = &graph.ParentRefAttachmentStatus{
10331033
AcceptedHostnames: map[string][]string{},
10341034
FailedCondition: staticConds.NewRouteNoMatchingParent(),
10351035
}
1036-
expGraph.Routes[routeKey1].ParentRefs[1].Attachment = &graph.ParentRefAttachmentStatus{
1036+
expGraph.Routes[httpRouteKey1].ParentRefs[1].Attachment = &graph.ParentRefAttachmentStatus{
10371037
AcceptedHostnames: map[string][]string{},
10381038
FailedCondition: staticConds.NewRouteNoMatchingParent(),
10391039
}
@@ -1092,20 +1092,20 @@ var _ = Describe("ChangeProcessor", func() {
10921092
}
10931093

10941094
listener80 := getListenerByName(expGraph.Gateway, httpListenerName)
1095-
listener80.Routes[routeKey1].ParentRefs[0].Attachment = expAttachment80
1096-
listener443.Routes[routeKey1].ParentRefs[1].Attachment = expAttachment443
1095+
listener80.Routes[httpRouteKey1].ParentRefs[0].Attachment = expAttachment80
1096+
listener443.Routes[httpRouteKey1].ParentRefs[1].Attachment = expAttachment443
10971097
listener80.Routes[grpcRouteKey1].ParentRefs[0].Attachment = expAttachment80
10981098
listener443.Routes[grpcRouteKey1].ParentRefs[1].Attachment = expAttachment443
10991099

11001100
// no ref grant exists yet for hr1
1101-
expGraph.Routes[routeKey1].Conditions = []conditions.Condition{
1101+
expGraph.Routes[httpRouteKey1].Conditions = []conditions.Condition{
11021102
staticConds.NewRouteInvalidListener(),
11031103
staticConds.NewRouteBackendRefRefNotPermitted(
11041104
"Backend ref to Service service-ns/service not permitted by any ReferenceGrant",
11051105
),
11061106
}
1107-
expGraph.Routes[routeKey1].ParentRefs[0].Attachment = expAttachment80
1108-
expGraph.Routes[routeKey1].ParentRefs[1].Attachment = expAttachment443
1107+
expGraph.Routes[httpRouteKey1].ParentRefs[0].Attachment = expAttachment80
1108+
expGraph.Routes[httpRouteKey1].ParentRefs[1].Attachment = expAttachment443
11091109

11101110
// no ref grant exists yet for gr1
11111111
expGraph.Routes[grpcRouteKey1].Conditions = []conditions.Condition{
@@ -1139,7 +1139,7 @@ var _ = Describe("ChangeProcessor", func() {
11391139
processor.CaptureUpsertChange(secretRefGrant)
11401140

11411141
// no ref grant exists yet for hr1
1142-
expGraph.Routes[routeKey1].Conditions = []conditions.Condition{
1142+
expGraph.Routes[httpRouteKey1].Conditions = []conditions.Condition{
11431143
staticConds.NewRouteBackendRefRefNotPermitted(
11441144
"Backend ref to Service service-ns/service not permitted by any ReferenceGrant",
11451145
),
@@ -1283,10 +1283,10 @@ var _ = Describe("ChangeProcessor", func() {
12831283
processor.CaptureUpsertChange(hr1Updated)
12841284

12851285
listener443 := getListenerByName(expGraph.Gateway, httpsListenerName)
1286-
listener443.Routes[routeKey1].Source.SetGeneration(hr1Updated.Generation)
1286+
listener443.Routes[httpRouteKey1].Source.SetGeneration(hr1Updated.Generation)
12871287

12881288
listener80 := getListenerByName(expGraph.Gateway, httpListenerName)
1289-
listener80.Routes[routeKey1].Source.SetGeneration(hr1Updated.Generation)
1289+
listener80.Routes[httpRouteKey1].Source.SetGeneration(hr1Updated.Generation)
12901290
expGraph.ReferencedSecrets[client.ObjectKeyFromObject(diffNsTLSSecret)] = &graph.Secret{
12911291
Source: diffNsTLSSecret,
12921292
}
@@ -1407,12 +1407,12 @@ var _ = Describe("ChangeProcessor", func() {
14071407
expGraph.IgnoredGateways = map[types.NamespacedName]*v1.Gateway{
14081408
{Namespace: "test", Name: "gateway-2"}: gw2,
14091409
}
1410-
expGraph.Routes[routeKey2] = expRouteHR2
1411-
expGraph.Routes[routeKey2].ParentRefs[0].Attachment = &graph.ParentRefAttachmentStatus{
1410+
expGraph.Routes[httpRouteKey2] = expRouteHR2
1411+
expGraph.Routes[httpRouteKey2].ParentRefs[0].Attachment = &graph.ParentRefAttachmentStatus{
14121412
AcceptedHostnames: map[string][]string{},
14131413
FailedCondition: staticConds.NewRouteNotAcceptedGatewayIgnored(),
14141414
}
1415-
expGraph.Routes[routeKey2].ParentRefs[1].Attachment = &graph.ParentRefAttachmentStatus{
1415+
expGraph.Routes[httpRouteKey2].ParentRefs[1].Attachment = &graph.ParentRefAttachmentStatus{
14161416
AcceptedHostnames: map[string][]string{},
14171417
FailedCondition: staticConds.NewRouteNotAcceptedGatewayIgnored(),
14181418
}
@@ -1430,12 +1430,12 @@ var _ = Describe("ChangeProcessor", func() {
14301430
expGraph.IgnoredGateways = map[types.NamespacedName]*v1.Gateway{
14311431
{Namespace: "test", Name: "gateway-2"}: gw2,
14321432
}
1433-
expGraph.Routes[routeKey2] = expRouteHR2
1434-
expGraph.Routes[routeKey2].ParentRefs[0].Attachment = &graph.ParentRefAttachmentStatus{
1433+
expGraph.Routes[httpRouteKey2] = expRouteHR2
1434+
expGraph.Routes[httpRouteKey2].ParentRefs[0].Attachment = &graph.ParentRefAttachmentStatus{
14351435
AcceptedHostnames: map[string][]string{},
14361436
FailedCondition: staticConds.NewRouteNotAcceptedGatewayIgnored(),
14371437
}
1438-
expGraph.Routes[routeKey2].ParentRefs[1].Attachment = &graph.ParentRefAttachmentStatus{
1438+
expGraph.Routes[httpRouteKey2].ParentRefs[1].Attachment = &graph.ParentRefAttachmentStatus{
14391439
AcceptedHostnames: map[string][]string{},
14401440
FailedCondition: staticConds.NewRouteNotAcceptedGatewayIgnored(),
14411441
}
@@ -1464,12 +1464,12 @@ var _ = Describe("ChangeProcessor", func() {
14641464
expGraph.IgnoredGateways = map[types.NamespacedName]*v1.Gateway{
14651465
{Namespace: "test", Name: "gateway-2"}: gw2,
14661466
}
1467-
expGraph.Routes[routeKey2] = expRouteHR2
1468-
expGraph.Routes[routeKey2].ParentRefs[0].Attachment = &graph.ParentRefAttachmentStatus{
1467+
expGraph.Routes[httpRouteKey2] = expRouteHR2
1468+
expGraph.Routes[httpRouteKey2].ParentRefs[0].Attachment = &graph.ParentRefAttachmentStatus{
14691469
AcceptedHostnames: map[string][]string{},
14701470
FailedCondition: staticConds.NewRouteNotAcceptedGatewayIgnored(),
14711471
}
1472-
expGraph.Routes[routeKey2].ParentRefs[1].Attachment = &graph.ParentRefAttachmentStatus{
1472+
expGraph.Routes[httpRouteKey2].ParentRefs[1].Attachment = &graph.ParentRefAttachmentStatus{
14731473
AcceptedHostnames: map[string][]string{},
14741474
FailedCondition: staticConds.NewRouteNotAcceptedGatewayIgnored(),
14751475
}
@@ -1515,23 +1515,23 @@ var _ = Describe("ChangeProcessor", func() {
15151515
listener443.Source = gw2.Spec.Listeners[1]
15161516
tlsListener.Source = gw2.Spec.Listeners[2]
15171517

1518-
delete(listener80.Routes, routeKey1)
1519-
delete(listener443.Routes, routeKey1)
1518+
delete(listener80.Routes, httpRouteKey1)
1519+
delete(listener443.Routes, httpRouteKey1)
15201520
delete(listener80.Routes, grpcRouteKey1)
15211521
delete(listener443.Routes, grpcRouteKey1)
15221522
delete(tlsListener.L4Routes, trKey1)
15231523

1524-
listener80.Routes[routeKey2] = expRouteHR2
1525-
listener443.Routes[routeKey2] = expRouteHR2
1524+
listener80.Routes[httpRouteKey2] = expRouteHR2
1525+
listener443.Routes[httpRouteKey2] = expRouteHR2
15261526
listener80.Routes[grpcRouteKey2] = expRouteGR2
15271527
listener443.Routes[grpcRouteKey2] = expRouteGR2
15281528
tlsListener.L4Routes[trKey2] = expRouteTR2
15291529

1530-
delete(expGraph.Routes, routeKey1)
1530+
delete(expGraph.Routes, httpRouteKey1)
15311531
delete(expGraph.Routes, grpcRouteKey1)
15321532
delete(expGraph.L4Routes, trKey1)
15331533

1534-
expGraph.Routes[routeKey2] = expRouteHR2
1534+
expGraph.Routes[httpRouteKey2] = expRouteHR2
15351535
expGraph.Routes[grpcRouteKey2] = expRouteGR2
15361536
expGraph.L4Routes[trKey2] = expRouteTR2
15371537

@@ -1569,8 +1569,8 @@ var _ = Describe("ChangeProcessor", func() {
15691569
listener443.Source = gw2.Spec.Listeners[1]
15701570
tlsListener.Source = gw2.Spec.Listeners[2]
15711571

1572-
delete(listener80.Routes, routeKey1)
1573-
delete(listener443.Routes, routeKey1)
1572+
delete(listener80.Routes, httpRouteKey1)
1573+
delete(listener443.Routes, httpRouteKey1)
15741574
delete(listener80.Routes, grpcRouteKey1)
15751575
delete(listener443.Routes, grpcRouteKey1)
15761576
delete(tlsListener.L4Routes, trKey1)
@@ -1579,7 +1579,7 @@ var _ = Describe("ChangeProcessor", func() {
15791579
listener443.Routes[grpcRouteKey2] = expRouteGR2
15801580
tlsListener.L4Routes[trKey2] = expRouteTR2
15811581

1582-
delete(expGraph.Routes, routeKey1)
1582+
delete(expGraph.Routes, httpRouteKey1)
15831583
delete(expGraph.Routes, grpcRouteKey1)
15841584
expGraph.Routes[grpcRouteKey2] = expRouteGR2
15851585

@@ -1618,8 +1618,8 @@ var _ = Describe("ChangeProcessor", func() {
16181618
listener443.Source = gw2.Spec.Listeners[1]
16191619
tlsListener.Source = gw2.Spec.Listeners[2]
16201620

1621-
delete(listener80.Routes, routeKey1)
1622-
delete(listener443.Routes, routeKey1)
1621+
delete(listener80.Routes, httpRouteKey1)
1622+
delete(listener443.Routes, httpRouteKey1)
16231623
delete(listener80.Routes, grpcRouteKey1)
16241624
delete(listener443.Routes, grpcRouteKey1)
16251625
delete(tlsListener.L4Routes, trKey1)
@@ -1662,8 +1662,8 @@ var _ = Describe("ChangeProcessor", func() {
16621662
listener443.Source = gw2.Spec.Listeners[1]
16631663
tlsListener.Source = gw2.Spec.Listeners[2]
16641664

1665-
delete(listener80.Routes, routeKey1)
1666-
delete(listener443.Routes, routeKey1)
1665+
delete(listener80.Routes, httpRouteKey1)
1666+
delete(listener443.Routes, httpRouteKey1)
16671667
delete(listener80.Routes, grpcRouteKey1)
16681668
delete(listener443.Routes, grpcRouteKey1)
16691669
delete(tlsListener.L4Routes, trKey1)

0 commit comments

Comments
 (0)