You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/12/01 03:43:56 UTC

[GitHub] [apisix-dashboard] idbeta commented on a change in pull request #893: test: add route with priority

idbeta commented on a change in pull request #893:
URL: https://github.com/apache/apisix-dashboard/pull/893#discussion_r533053807



##########
File path: api/test/e2e/route_with_priority_test.go
##########
@@ -0,0 +1,108 @@
+/*
+ * 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_priority(t *testing.T) {
+	tests := []HttpTestCase{
+		{
+			caseDesc: "add another route with no priority (default 0)",
+			Object:   MangerApiExpect(t),
+			Method:   http.MethodPut,
+			Path:     "/apisix/admin/routes/r1",
+			Body: `{
+					  "uri": "/server_port",
+					  "methods": ["GET"],
+					  "upstream": {
+						  "type": "roundrobin",
+						  "nodes": [{
+							  "host": "172.16.238.20",
+							  "port": 1981,
+							  "weight": 1
+						  }]
+					  }
+				  }`,
+			Headers:      map[string]string{"Authorization": token},
+			ExpectStatus: http.StatusOK,
+		},
+		{
+			caseDesc:     "access the route",
+			Object:       APISIXExpect(t),
+			Method:       http.MethodGet,
+			Path:         "/server_port",
+			ExpectStatus: http.StatusOK,
+			ExpectBody:   "1981",
+			Sleep:        sleepTime,
+		},
+		{
+			caseDesc: "add another route with valid priority (1), upstream is different from the others",
+			Object:   MangerApiExpect(t),
+			Method:   http.MethodPut,

Review comment:
       fixed. ping @moonming Can you review it when you have time?




----------------------------------------------------------------
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:
users@infra.apache.org