membphis commented on a change in pull request #885:
URL: https://github.com/apache/apisix-dashboard/pull/885#discussion_r531077878



##########
File path: api/test/e2e/route_with_other_plugin_test.go
##########
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package e2e
+
+import (
+       "net/http"
+       "testing"
+)
+
+func TestRoute_With_Other_Plugin(t *testing.T) {

Review comment:
       bad name, mainly about `proxy-rewrite` plugin

##########
File path: api/test/e2e/route_with_other_plugin_test.go
##########
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package e2e
+
+import (
+       "net/http"
+       "testing"
+)
+
+func TestRoute_With_Other_Plugin(t *testing.T) {
+       tests := []HttpTestCase{
+               {
+                       caseDesc:     "make sure the route is not created ",

Review comment:
       remove the last space

##########
File path: api/test/e2e/route_with_other_plugin_test.go
##########
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package e2e
+
+import (
+       "net/http"
+       "testing"
+)
+
+func TestRoute_With_Other_Plugin(t *testing.T) {
+       tests := []HttpTestCase{
+               {
+                       caseDesc:     "make sure the route is not created ",
+                       Object:       APISIXExpect(t),
+                       Method:       http.MethodGet,
+                       Path:         "/hello",
+                       ExpectStatus: http.StatusNotFound,
+                       ExpectBody:   `{"error_msg":"404 Route Not Found"}`,
+               },
+               {
+                       caseDesc: "create route that will rewrite host and uri",
+                       Object:   MangerApiExpect(t),
+                       Method:   http.MethodPut,
+                       Path:     "/apisix/admin/routes/r1",
+                       Body: `{
+                               "uri": "/hello",
+                               "plugins": {
+                                       "proxy-rewrite": {
+                                               "uri": "/plugin_proxy_rewrite",
+                                               "host": "test.com"
+                                       }
+                               },
+                               "upstream": {
+                                       "type": "roundrobin",
+                                       "nodes": [{
+                                               "host": "172.16.238.20",
+                                               "port": 1981,
+                                               "weight": 1
+                                       }]
+                               }
+                       }`,
+                       Headers:      map[string]string{"Authorization": token},
+                       ExpectStatus: http.StatusOK,
+               },
+               {
+                       caseDesc:     "verify route that rewrite host and uri",
+                       Object:       APISIXExpect(t),
+                       Method:       http.MethodGet,
+                       Path:         "/hello",
+                       ExpectStatus: http.StatusOK,
+                       ExpectBody:   "uri: /plugin_proxy_rewrite\nhost: 
test.com",
+                       Sleep:        sleepTime,
+               },
+               {
+                       caseDesc: "create route that will rewrite headers",
+                       Object:   MangerApiExpect(t),
+                       Method:   http.MethodPut,
+                       Path:     "/apisix/admin/routes/r1",
+                       Body: `{
+                               "uri": "/hello",
+                               "plugins": {
+                                       "proxy-rewrite": {
+                                               "uri": 
"/uri/plugin_proxy_rewrite",
+                                               "headers": {
+                                                       "X-Api-Version": "v2"
+                                               }
+                                       }
+                               },
+                               "upstream": {
+                                       "type": "roundrobin",
+                                       "nodes": [{
+                                               "host": "172.16.238.20",
+                                               "port": 1981,
+                                               "weight": 1
+                                       }]
+                               }
+                       }`,
+                       Headers:      map[string]string{"Authorization": token},
+                       ExpectStatus: http.StatusOK,
+               },
+               {
+                       caseDesc:     "verify route that rewrite headers",
+                       Object:       APISIXExpect(t),
+                       Method:       http.MethodGet,
+                       Path:         "/hello",
+                       Headers:      map[string]string{"X-Api-Version": "v1"},
+                       ExpectStatus: http.StatusOK,
+                       ExpectBody:   "x-api-version: v2",
+                       Sleep:        sleepTime,
+               },
+               {
+                       caseDesc: "create route that using regex_uri",

Review comment:
       ditto

##########
File path: api/test/e2e/route_with_other_plugin_test.go
##########
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package e2e
+
+import (
+       "net/http"
+       "testing"
+)
+
+func TestRoute_With_Other_Plugin(t *testing.T) {

Review comment:
       and please update the file name too

##########
File path: api/test/e2e/route_with_other_plugin_test.go
##########
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package e2e
+
+import (
+       "net/http"
+       "testing"
+)
+
+func TestRoute_With_Other_Plugin(t *testing.T) {
+       tests := []HttpTestCase{
+               {
+                       caseDesc:     "make sure the route is not created ",
+                       Object:       APISIXExpect(t),
+                       Method:       http.MethodGet,
+                       Path:         "/hello",
+                       ExpectStatus: http.StatusNotFound,
+                       ExpectBody:   `{"error_msg":"404 Route Not Found"}`,
+               },
+               {
+                       caseDesc: "create route that will rewrite host and uri",
+                       Object:   MangerApiExpect(t),
+                       Method:   http.MethodPut,
+                       Path:     "/apisix/admin/routes/r1",
+                       Body: `{
+                               "uri": "/hello",
+                               "plugins": {
+                                       "proxy-rewrite": {
+                                               "uri": "/plugin_proxy_rewrite",
+                                               "host": "test.com"
+                                       }
+                               },
+                               "upstream": {
+                                       "type": "roundrobin",
+                                       "nodes": [{
+                                               "host": "172.16.238.20",
+                                               "port": 1981,
+                                               "weight": 1
+                                       }]
+                               }
+                       }`,
+                       Headers:      map[string]string{"Authorization": token},
+                       ExpectStatus: http.StatusOK,
+               },
+               {
+                       caseDesc:     "verify route that rewrite host and uri",
+                       Object:       APISIXExpect(t),
+                       Method:       http.MethodGet,
+                       Path:         "/hello",
+                       ExpectStatus: http.StatusOK,
+                       ExpectBody:   "uri: /plugin_proxy_rewrite\nhost: 
test.com",
+                       Sleep:        sleepTime,
+               },
+               {
+                       caseDesc: "create route that will rewrite headers",

Review comment:
       should be `update`, all right?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to