starsz commented on a change in pull request #1207:
URL: https://github.com/apache/apisix-dashboard/pull/1207#discussion_r552328054
##########
File path: api/internal/handler/route/route_test.go
##########
@@ -925,6 +927,42 @@ func TestRoute(t *testing.T) {
dataPage = retPage.(*store.ListOutput)
assert.Equal(t, len(dataPage.Rows), 0)
+ // list search and status match
+ listInput = &ListInput{}
+ reqBody = `{"page_size": 1, "page": 1, "status": "1"}`
+ err = json.Unmarshal([]byte(reqBody), listInput)
+ assert.Nil(t, err)
+ ctx.SetInput(listInput)
+ retPage, err = handler.List(ctx)
+ assert.Nil(t, err)
+ dataPage = retPage.(*store.ListOutput)
+ assert.Equal(t, len(dataPage.Rows), 1)
+
+ //sleep
+ time.Sleep(time.Duration(100) * time.Millisecond)
Review comment:
Style: redundant space.
##########
File path: api/internal/handler/route/route.go
##########
@@ -219,6 +220,10 @@ func (h *Handler) List(c droplet.Context) (interface{},
error) {
return false
}
+ if input.Status != "" && fmt.Sprintf("%d",
obj.(*entity.Route).Status) != input.Status {
Review comment:
I recommend using `strconv.Itoa` instead of `fmt.Sprintf`. Because the
former is faster than the latter in the benchmark test.
----------------------------------------------------------------
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]