moonming commented on a change in pull request #1606:
URL: https://github.com/apache/apisix-dashboard/pull/1606#discussion_r595953565



##########
File path: api/test/e2enew/route/route_test.go
##########
@@ -0,0 +1,151 @@
+/*
+ * 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 route
+
+import (
+       "net/http"
+
+       "github.com/onsi/ginkgo"
+       "github.com/onsi/ginkgo/extensions/table"
+
+       "github.com/apisix/manager-api/test/e2enew/base"
+)
+
+var _ = ginkgo.Describe("Route", func() {
+       table.DescribeTable("test route create and update",
+               func(tc base.HttpTestCase) {
+                       base.RunTestCase(tc)
+               },
+               table.Entry("create route1 success", base.HttpTestCase{
+                       Object: base.ManagerApiExpect(),
+                       Method: http.MethodPut,
+                       Path:   "/apisix/admin/routes/r1",
+                       Body: `{
+                                "name": "route1",
+                               "uri": "/hello_",
+                               "upstream": {
+                                       "nodes": {
+                                               "` + base.UpstreamIp + `:1980": 
1
+                                       },
+                                       "type": "roundrobin"
+                               }
+                       }`,
+                       Headers:      map[string]string{"Authorization": 
base.GetToken()},
+                       ExpectStatus: http.StatusOK,
+               }),
+               table.Entry("create route2 success", base.HttpTestCase{
+                       Object: base.ManagerApiExpect(),
+                       Method: http.MethodPut,
+                       Path:   "/apisix/admin/routes/r2",
+                       Body: `{
+                                "name": "route2",
+                               "uri": "/hello_",
+                               "upstream": {
+                                       "nodes": {
+                                               "` + base.UpstreamIp + `:1980": 
1
+                                       },
+                                       "type": "roundrobin"
+                               }
+                       }`,
+                       Headers:      map[string]string{"Authorization": 
base.GetToken()},
+                       ExpectStatus: http.StatusOK,
+               }),
+               table.Entry("create route failed, name existed", 
base.HttpTestCase{
+                       Object: base.ManagerApiExpect(),
+                       Method: http.MethodPost,
+                       Path:   "/apisix/admin/routes",
+                       Body: `{
+                                "name": "route2",
+                               "uri": "/hello_",
+                               "upstream": {
+                                       "nodes": {
+                                               "` + base.UpstreamIp + `:1980": 
1
+                                       },
+                                       "type": "roundrobin"
+                               }
+                       }`,
+                       Headers:      map[string]string{"Authorization": 
base.GetToken()},
+                       ExpectStatus: http.StatusBadRequest,
+                       ExpectBody:   `route name is existed`,
+                       Sleep:        base.SleepTime,
+               }),
+               table.Entry("update route2 failed, name existed", 
base.HttpTestCase{
+                       Object: base.ManagerApiExpect(),
+                       Method: http.MethodPut,
+                       Path:   "/apisix/admin/routes/r2",
+                       Body: `{
+                                "name": "route1",

Review comment:
       bad indentation

##########
File path: api/test/e2enew/route/route_test.go
##########
@@ -0,0 +1,151 @@
+/*
+ * 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 route
+
+import (
+       "net/http"
+
+       "github.com/onsi/ginkgo"
+       "github.com/onsi/ginkgo/extensions/table"
+
+       "github.com/apisix/manager-api/test/e2enew/base"
+)
+
+var _ = ginkgo.Describe("Route", func() {
+       table.DescribeTable("test route create and update",
+               func(tc base.HttpTestCase) {
+                       base.RunTestCase(tc)
+               },
+               table.Entry("create route1 success", base.HttpTestCase{
+                       Object: base.ManagerApiExpect(),
+                       Method: http.MethodPut,
+                       Path:   "/apisix/admin/routes/r1",
+                       Body: `{
+                                "name": "route1",
+                               "uri": "/hello_",
+                               "upstream": {
+                                       "nodes": {
+                                               "` + base.UpstreamIp + `:1980": 
1
+                                       },
+                                       "type": "roundrobin"
+                               }
+                       }`,
+                       Headers:      map[string]string{"Authorization": 
base.GetToken()},
+                       ExpectStatus: http.StatusOK,
+               }),
+               table.Entry("create route2 success", base.HttpTestCase{
+                       Object: base.ManagerApiExpect(),
+                       Method: http.MethodPut,
+                       Path:   "/apisix/admin/routes/r2",
+                       Body: `{
+                                "name": "route2",
+                               "uri": "/hello_",
+                               "upstream": {
+                                       "nodes": {
+                                               "` + base.UpstreamIp + `:1980": 
1
+                                       },
+                                       "type": "roundrobin"
+                               }
+                       }`,
+                       Headers:      map[string]string{"Authorization": 
base.GetToken()},
+                       ExpectStatus: http.StatusOK,
+               }),
+               table.Entry("create route failed, name existed", 
base.HttpTestCase{
+                       Object: base.ManagerApiExpect(),
+                       Method: http.MethodPost,
+                       Path:   "/apisix/admin/routes",
+                       Body: `{
+                                "name": "route2",
+                               "uri": "/hello_",
+                               "upstream": {
+                                       "nodes": {
+                                               "` + base.UpstreamIp + `:1980": 
1
+                                       },
+                                       "type": "roundrobin"
+                               }
+                       }`,
+                       Headers:      map[string]string{"Authorization": 
base.GetToken()},
+                       ExpectStatus: http.StatusBadRequest,
+                       ExpectBody:   `route name is existed`,

Review comment:
       I don't think the grammar is 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:
[email protected]


Reply via email to