Skip to content

Commit 1e41132

Browse files
committed
use require.Contains
Signed-off-by: zirain <[email protected]>
1 parent 535cb73 commit 1e41132

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

internal/provider/kubernetes/kubernetes_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,8 @@ func testHTTPRoute(ctx context.Context, t *testing.T, provider *Provider, resour
852852
},
853853
}
854854

855-
for _, testCase := range testCases {
855+
for i := range testCases {
856+
testCase := testCases[i]
856857
t.Run(testCase.name, func(t *testing.T) {
857858
require.NoError(t, cli.Create(ctx, &testCase.route))
858859
defer func() {
@@ -879,7 +880,7 @@ func testHTTPRoute(ctx context.Context, t *testing.T, provider *Provider, resour
879880

880881
res := resources.GetResourcesByGatewayClass(gc.Name)
881882
require.NotNil(t, res)
882-
require.Equal(t, &testCase.route, res.HTTPRoutes[0])
883+
require.Contains(t, res.HTTPRoutes, &testCase.route)
883884

884885
// Ensure the HTTPRoute Namespace is in the Namespace resource map.
885886
require.Eventually(t, func() bool {
@@ -1001,7 +1002,8 @@ func testTLSRoute(ctx context.Context, t *testing.T, provider *Provider, resourc
10011002
},
10021003
}
10031004

1004-
for _, testCase := range testCases {
1005+
for i := range testCases {
1006+
testCase := testCases[i]
10051007
t.Run(testCase.name, func(t *testing.T) {
10061008
require.NoError(t, cli.Create(ctx, &testCase.route))
10071009
defer func() {
@@ -1028,7 +1030,7 @@ func testTLSRoute(ctx context.Context, t *testing.T, provider *Provider, resourc
10281030

10291031
res := resources.GetResourcesByGatewayClass(gc.Name)
10301032
require.NotNil(t, res)
1031-
require.Equal(t, &testCase.route, res.TLSRoutes[0])
1033+
require.Contains(t, res.TLSRoutes, &testCase.route)
10321034

10331035
// Ensure the HTTPRoute Namespace is in the Namespace resource map.
10341036
require.Eventually(t, func() bool {

0 commit comments

Comments
 (0)