Skip to content

Commit 7595e6c

Browse files
committed
apply suggestions
1 parent 18f3894 commit 7595e6c

File tree

2 files changed

+4
-35
lines changed

2 files changed

+4
-35
lines changed

internal/controller/tcproute_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (r *TCPRouteReconciler) SetupWithManager(mgr ctrl.Manager) error {
6666
For(&gatewayv1alpha2.TCPRoute{}).
6767
WithEventFilter(predicate.GenerationChangedPredicate{}).
6868
Watches(&discoveryv1.EndpointSlice{},
69-
handler.EnqueueRequestsFromMapFunc(r.listTCPRoutesByServiceBef),
69+
handler.EnqueueRequestsFromMapFunc(r.listTCPRoutesByServiceRef),
7070
).
7171
Watches(&gatewayv1.Gateway{},
7272
handler.EnqueueRequestsFromMapFunc(r.listTCPRoutesForGateway),
@@ -475,7 +475,7 @@ func (r *TCPRouteReconciler) listTCPRoutesForReferenceGrant(ctx context.Context,
475475
return requests
476476
}
477477

478-
func (r *TCPRouteReconciler) listTCPRoutesByServiceBef(ctx context.Context, obj client.Object) []reconcile.Request {
478+
func (r *TCPRouteReconciler) listTCPRoutesByServiceRef(ctx context.Context, obj client.Object) []reconcile.Request {
479479
endpointSlice, ok := obj.(*discoveryv1.EndpointSlice)
480480
if !ok {
481481
r.Log.Error(fmt.Errorf("unexpected object type"), "failed to convert object to EndpointSlice")

test/e2e/gatewayapi/tcproute.go

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,44 +21,13 @@ import (
2121
"fmt"
2222
"time"
2323

24-
"github.com/apache/apisix-ingress-controller/test/e2e/framework"
2524
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
2625
. "github.com/onsi/ginkgo/v2"
2726
. "github.com/onsi/gomega"
2827
)
2928

3029
var _ = Describe("TCPRoute E2E Test", func() {
3130
s := scaffold.NewDefaultScaffold()
32-
33-
var gatewayProxyYaml = `
34-
apiVersion: apisix.apache.org/v1alpha1
35-
kind: GatewayProxy
36-
metadata:
37-
name: %s
38-
spec:
39-
provider:
40-
type: ControlPlane
41-
controlPlane:
42-
service:
43-
name: %s
44-
port: 9180
45-
auth:
46-
type: AdminKey
47-
adminKey:
48-
value: "%s"
49-
`
50-
getGatewayProxySpec := func() string {
51-
return fmt.Sprintf(gatewayProxyYaml, s.Namespace(), framework.ProviderType, s.AdminKey())
52-
}
53-
54-
var gatewayClassYaml = `
55-
apiVersion: gateway.networking.k8s.io/v1
56-
kind: GatewayClass
57-
metadata:
58-
name: %s
59-
spec:
60-
controllerName: %s
61-
`
6231
Context("TCPRoute Base", func() {
6332
var tcpGateway = `
6433
apiVersion: gateway.networking.k8s.io/v1
@@ -98,12 +67,12 @@ spec:
9867

9968
BeforeEach(func() {
10069
// Create GatewayProxy
101-
Expect(s.CreateResourceFromStringWithNamespace(getGatewayProxySpec(), s.Namespace())).
70+
Expect(s.CreateResourceFromStringWithNamespace(s.GetGatewayProxySpec(), s.Namespace())).
10271
NotTo(HaveOccurred(), "creating GatewayProxy")
10372

10473
// Create GatewayClass
10574
gatewayClassName := s.Namespace()
106-
Expect(s.CreateResourceFromStringWithNamespace(fmt.Sprintf(gatewayClassYaml, gatewayClassName, s.GetControllerName()), "")).
75+
Expect(s.CreateResourceFromStringWithNamespace(fmt.Sprintf(s.GetGatewayClassYaml(), gatewayClassName, s.GetControllerName()), "")).
10776
NotTo(HaveOccurred(), "creating GatewayClass")
10877
gcyaml, _ := s.GetResourceYaml("GatewayClass", gatewayClassName)
10978
s.ResourceApplied("GatewayClass", gatewayClassName, gcyaml, 1)

0 commit comments

Comments
 (0)