Skip to content

Commit efaa605

Browse files
committed
resolve comment
1 parent 8e0f05e commit efaa605

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

internal/controller/ingressclass_controller.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66

7+
"github.com/api7/gopkg/pkg/log"
78
"github.com/go-logr/logr"
89
corev1 "k8s.io/api/core/v1"
910
networkingv1 "k8s.io/api/networking/v1"
@@ -16,8 +17,6 @@ import (
1617
"sigs.k8s.io/controller-runtime/pkg/predicate"
1718
"sigs.k8s.io/controller-runtime/pkg/reconcile"
1819

19-
"github.com/api7/gopkg/pkg/log"
20-
2120
"github.com/api7/api7-ingress-controller/api/v1alpha1"
2221
"github.com/api7/api7-ingress-controller/internal/controller/indexer"
2322
"github.com/api7/api7-ingress-controller/internal/provider"

test/e2e/ingress/ingress.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,12 @@ spec:
834834
secretKeyRef:
835835
name: control-plane-secret
836836
key: admin-key
837+
plugins:
838+
- name: response-rewrite
839+
enabled: true
840+
config:
841+
headers:
842+
X-Proxy-Test: "enabled"
837843
`
838844
const ingressClassSpec = `
839845
apiVersion: networking.k8s.io/v1
@@ -898,6 +904,10 @@ spec:
898904
Expect().Raw().StatusCode
899905
}).WithTimeout(8 * time.Second).ProbeEvery(time.Second).
900906
Should(Equal(http.StatusOK))
907+
s.NewAPISIXClient().
908+
GET("/get").
909+
WithHost("ingress.example.com").
910+
Expect().Header("X-Proxy-Test").IsEqual("enabled")
901911

902912
By("create additional gateway group to get new admin key")
903913
additionalGatewayGroupID, _, err = s.CreateAdditionalGatewayGroup("gateway-proxy-update")
@@ -928,6 +938,13 @@ spec:
928938
Expect().Raw().StatusCode
929939
}).WithTimeout(8 * time.Second).ProbeEvery(time.Second).
930940
Should(Equal(http.StatusOK))
941+
Eventually(func() string {
942+
return client.
943+
GET("/get").
944+
WithHost("ingress.example.com").
945+
Expect().Raw().Header.Get("X-Proxy-Test")
946+
}).WithTimeout(8 * time.Second).ProbeEvery(time.Second).
947+
Should(Equal("enabled"))
931948
})
932949
})
933950
})

0 commit comments

Comments
 (0)