AlinsRan commented on code in PR #2632:
URL:
https://github.com/apache/apisix-ingress-controller/pull/2632#discussion_r2476143791
##########
test/e2e/ingress/annotations.go:
##########
@@ -610,5 +655,67 @@ spec:
s.RequestAssert(test)
}
})
+
+ It("proxy-rewrite with rewrite-target", func() {
+
Expect(s.CreateResourceFromString(fmt.Sprintf(ingressRewriteTarget,
s.Namespace()))).ShouldNot(HaveOccurred(), "creating Ingress")
+
+ time.Sleep(5 * time.Second)
+
+ s.RequestAssert(&scaffold.RequestAssert{
+ Method: "GET",
+ Path: "/test",
+ Host: "httpbin.example",
+ Check:
scaffold.WithExpectedStatus(http.StatusOK),
+ })
+
+ routes, err :=
s.DefaultDataplaneResource().Route().List(context.Background())
+ Expect(err).NotTo(HaveOccurred(), "listing Route")
+ Expect(routes).ToNot(BeEmpty(), "checking Route length")
+ Expect(routes[0].Plugins).To(HaveKey("proxy-rewrite"),
"checking Route has proxy-rewrite plugin")
+
+ jsonBytes, err :=
json.Marshal(routes[0].Plugins["proxy-rewrite"])
+ Expect(err).NotTo(HaveOccurred(), "marshalling
proxy-rewrite plugin config")
+ var rewriteConfig map[string]any
+ err = json.Unmarshal(jsonBytes, &rewriteConfig)
+ Expect(err).NotTo(HaveOccurred(), "unmarshalling
proxy-rewrite plugin config")
+ Expect(rewriteConfig["uri"]).To(Equal("/get"),
"checking proxy-rewrite uri")
+ })
+
+ It("proxy-rewrite with regex", func() {
+
Expect(s.CreateResourceFromString(fmt.Sprintf(ingressRewriteTargetRegex,
s.Namespace()))).ShouldNot(HaveOccurred(), "creating Ingress")
+
+ time.Sleep(5 * time.Second)
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]