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



##########
File path: api/go.sum
##########
@@ -1,43 +1,14 @@
-cloud.google.com/go v0.34.0/go.mod 
h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=

Review comment:
       why we delete so many dependency libraries? 
   
   they are only used for testing?

##########
File path: api/test/e2e/route_test.go
##########
@@ -0,0 +1,164 @@
+/*
+ * 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"
+       "time"
+)
+
+func TestRoute_Host(t *testing.T) {
+
+       //create route use hosts

Review comment:
       bad indentation

##########
File path: .github/workflows/deploy-api.yml
##########
@@ -0,0 +1,60 @@
+name: Deploy API to Azure
+
+on:

Review comment:
       one PR for one thing, for E2E test, I think we do not need to update 
`deploy-api.yml`, all right?

##########
File path: api/test/e2e/route_test.go
##########
@@ -0,0 +1,164 @@
+/*
+ * 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"
+       "time"
+)
+
+func TestRoute_Host(t *testing.T) {
+
+       //create route use hosts
+    MangerApiExpect(t).PUT("/apisix/admin/routes/r1").WithText(`{
+        "uri": "/hello_",
+        "hosts": ["foo.com", "*.bar.com"],
+        "upstream": {
+            "nodes": {
+                "172.16.238.120:1980": 1
+            },
+            "type": "roundrobin"
+        }
+    }`).
+           WithHeader("Authorization", accessToken).
+           Expect().
+           Status(http.StatusOK)
+
+       //sleep
+       time.Sleep(time.Duration(100) * time.Millisecond)
+
+       //hit route -- not found
+       APISIXExpect(t).GET("/not_found").
+               Expect().
+               Status(http.StatusNotFound)
+
+       //hit route -- not found, wrong host
+       APISIXExpect(t).GET("/hello_").
+               WithHeader("Host", "not_found.com").
+               Expect().
+               Status(http.StatusNotFound)
+
+       //hit route - ok
+       APISIXExpect(t).GET("/hello_").
+               WithHeader("Host", "foo.com").
+               Expect().
+               Status(http.StatusOK)
+
+       //create route  -- invalid hosts
+       MangerApiExpect(t).PUT("/apisix/admin/routes/r2").WithText(`{
+        "uri": "/hello_",
+        "hosts": ["$%$foo.com", "*.bar.com"],
+        "upstream": {
+            "nodes": {
+                "172.16.238.120:1980": 1
+            },
+            "type": "roundrobin"
+        }
+    }`).

Review comment:
       bad indentation? if yes, please fix other similar points




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