nic-chen commented on a change in pull request #1067:
URL: https://github.com/apache/apisix-dashboard/pull/1067#discussion_r546313793
##########
File path: api/internal/handler/route/route_test.go
##########
@@ -754,6 +754,20 @@ func TestRoute(t *testing.T) {
_, err = handler.Update(ctx)
assert.Nil(t, err)
+ //sleep
+ time.Sleep(time.Duration(100) * time.Millisecond)
+
+ // check ID discrepancy on Update
+ errRoute := &UpdateInput{}
+ errRoute.ID = "2"
+ err = json.Unmarshal([]byte(reqBody), errRoute)
+ assert.Nil(t, err)
+ ctx.SetInput(errRoute)
+ ret, err = handler.Update(ctx)
+ assert.NotNil(t, err)
+ assert.EqualError(t, err, "ID on path (2) doesn't match ID on body (1)")
+ assert.Equal(t, http.StatusBadRequest,
ret.(*data.SpecCodeResponse).StatusCode)
+
Review comment:
For historical reasons, id supports int and stringing.
so we need test case for int ID in body.
----------------------------------------------------------------
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]