nic-chen commented on pull request #1558:
URL: https://github.com/apache/apisix-dashboard/pull/1558#issuecomment-792404725


   > > need some test cases for duplicate check, thanks. @batman-ezio
   > 
   > @nic-chen after I check duplicate name in create/update route api. some 
test cases failed. I think they are use the same route name to test before. 
some errors throw from the route test are very strange , like this
   > 
   > ```
   > === RUN   TestRoute_Create/create_route_success
   > panic: 
   > assert: mock: I don't know what to return because the method call was 
unexpected.
   >    Either do Mock.On("List").Return(...) first, or remove the List() call.
   >    This method was unexpected:
   >            List(store.ListInput)
   >            0: store.ListInput{Predicate:(func(interface {}) 
bool)(0x11bf5a0), Format:(func(interface {}) interface {})(nil), PageSize:0, 
PageNumber:0, Less:(func(interface {}, interface {}) bool)(nil)}
   >    at: [store_mock.go:35 route.go:537 route.go:311 route_test.go:1005] 
[recovered]
   >    panic: 
   > assert: mock: I don't know what to return because the method call was 
unexpected.
   >    Either do Mock.On("List").Return(...) first, or remove the List() call.
   >    This method was unexpected:
   >            List(store.ListInput)
   >            0: store.ListInput{Predicate:(func(interface {}) 
bool)(0x11bf5a0), Format:(func(interface {}) interface {})(nil), PageSize:0, 
PageNumber:0, Less:(func(interface {}, interface {}) bool)(nil)}
   >    at: [store_mock.go:35 route.go:537 route.go:311 route_test.go:1005]
   > ```
   > 
   > I have change the route name but still got this. can you help?
   
   
   hi @batman-ezio , you need to mock `routeStore.List` for  
`checkDuplicateName`
   
   you could refer to:
   
https://github.com/apache/apisix-dashboard/blob/2de2c72cfa8899e98045c3059d281b90cf544404/api/internal/handler/plugin_config/plugin_config_test.go#L694-L709
   
   
   


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