1502shivam-singh commented on a change in pull request #2237: URL: https://github.com/apache/apisix-dashboard/pull/2237#discussion_r770251226
########## File path: api/test/e2enew/balancer/balancer_test.go ########## @@ -0,0 +1,212 @@ +/* + * 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 balancer + +import ( + "net/http" + "time" + + "github.com/onsi/ginkgo" + "github.com/onsi/ginkgo/extensions/table" + "github.com/stretchr/testify/assert" + + "github.com/apisix/manager-api/test/e2enew/base" +) + +var _ = ginkgo.Describe("Balancer", func() { + table.DescribeTable("test create upstream and route", + func(tc base.HttpTestCase) { + base.RunTestCase(tc) + }, + table.Entry("create upstream (roundrobin with same weight)", base.HttpTestCase{ + Object: base.ManagerApiExpect(), + Method: http.MethodPut, + Path: "/apisix/admin/upstreams/1", + Body: `{ + "nodes": [{ + "host": "` + base.UpstreamIp + `", + "port": 1980, + "weight": 1 + }, + { + "host": "` + base.UpstreamIp + `", + "port": 1981, + "weight": 1 + }, + { + "host": "` + base.UpstreamIp + `", + "port": 1982, + "weight": 1 + }], + "type": "roundrobin" + }`, + Headers: map[string]string{"Authorization": base.GetToken()}, + ExpectStatus: http.StatusOK, + }), + table.Entry("create route using the upstream just created", base.HttpTestCase{ + Object: base.ManagerApiExpect(), + Method: http.MethodPut, + Path: "/apisix/admin/routes/1", + Body: `{ + "name": "route1", + "uri": "/server_port", + "upstream_id": "1" + }`, + Headers: map[string]string{"Authorization": base.GetToken()}, + ExpectStatus: http.StatusOK, + Sleep: base.SleepTime, + }), + ) + ginkgo.It("verify balancer by access count(same weight)", func() { + time.Sleep(base.SleepTime) + // batch test /server_port api + res := base.BatchTestServerPort(18, nil, "") Review comment: Are we like going to add more tests to extend, in the future (I'm pretty sure we are, but asking for validation) ? Asking this as the `headers` & `queryString` parameter of `BatchTestServerPort` are always the same here but still a function parameter. -- 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]
