Skip to content

Commit daae3c7

Browse files
committed
update SnippetsPolicy test cases
1 parent 36d8ca5 commit daae3c7

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

internal/controller/state/graph/policies_test.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2476,7 +2476,10 @@ func TestSnippetsPolicyPropagation(t *testing.T) {
24762476

24772477
// Create Routes
24782478
// Route 1: Attached to target gateway
2479-
route1Key := RouteKey{NamespacedName: types.NamespacedName{Namespace: testNs, Name: "route1"}, RouteType: RouteTypeHTTP}
2479+
route1Key := RouteKey{
2480+
NamespacedName: types.NamespacedName{Namespace: testNs, Name: "route1"},
2481+
RouteType: RouteTypeHTTP,
2482+
}
24802483
route1 := &L7Route{
24812484
Source: &v1.HTTPRoute{ObjectMeta: metav1.ObjectMeta{Name: "route1", Namespace: testNs}},
24822485
ParentRefs: []ParentRef{
@@ -2487,7 +2490,10 @@ func TestSnippetsPolicyPropagation(t *testing.T) {
24872490
}
24882491

24892492
// Route 2: Attached to other gateway
2490-
route2Key := RouteKey{NamespacedName: types.NamespacedName{Namespace: testNs, Name: "route2"}, RouteType: RouteTypeHTTP}
2493+
route2Key := RouteKey{
2494+
NamespacedName: types.NamespacedName{Namespace: testNs, Name: "route2"},
2495+
RouteType: RouteTypeHTTP,
2496+
}
24912497
route2 := &L7Route{
24922498
Source: &v1.HTTPRoute{ObjectMeta: metav1.ObjectMeta{Name: "route2", Namespace: testNs}},
24932499
ParentRefs: []ParentRef{
@@ -2498,7 +2504,10 @@ func TestSnippetsPolicyPropagation(t *testing.T) {
24982504
}
24992505

25002506
// Route 3: Attached to both gateways
2501-
route3Key := RouteKey{NamespacedName: types.NamespacedName{Namespace: testNs, Name: "route3"}, RouteType: RouteTypeHTTP}
2507+
route3Key := RouteKey{
2508+
NamespacedName: types.NamespacedName{Namespace: testNs, Name: "route3"},
2509+
RouteType: RouteTypeHTTP,
2510+
}
25022511
route3 := &L7Route{
25032512
Source: &v1.HTTPRoute{ObjectMeta: metav1.ObjectMeta{Name: "route3", Namespace: testNs}},
25042513
ParentRefs: []ParentRef{
@@ -2525,7 +2534,10 @@ func TestSnippetsPolicyPropagation(t *testing.T) {
25252534

25262535
// Verify Route Propagation
25272536
g.Expect(route1.Policies).To(ContainElement(snippetsPolicy), "Route1 attached to gateway should have policy")
2528-
g.Expect(route2.Policies).To(Not(ContainElement(snippetsPolicy)), "Route2 attached to other gateway should NOT have policy")
2537+
g.Expect(route2.Policies).To(
2538+
Not(ContainElement(snippetsPolicy)),
2539+
"Route2 attached to other gateway should NOT have policy",
2540+
)
25292541
g.Expect(route3.Policies).To(ContainElement(snippetsPolicy), "Route3 attached to gateway should have policy")
25302542

25312543
// Test 2: Other Policy (Non-Snippets) Propagation

0 commit comments

Comments
 (0)