make api-test filed
Bug report
Describe the bug
I got the newest code of master branch, and then exec make api-test. unfortunate, not pass all test.
How to Reproduce
And this failed test making a dirty data in etcd.

Screenshots

System information
- OS: [e.g. macOS, Windows]
- Browser (if applies) [e.g. Chrome, Safari, Edge]
- Version: [e.g. 2.0-rc3]
Additional context
Add any other context about the problem here.
cc @idbeta
Get more information by adding some log.
After the first time to exec make api-test, get a test error. at the same time, dirty data keep in etcd.
TestRoute: route_test.go:396:
Error Trace: route_test.go:396
Error: Expected nil, but got: &errors.errorString{s:"schema validate failed: script: String length must be greater than or equal to 10"}

Then, exec make api-test will repeat this problem.
Failure assertion code is:
https://github.com/apache/apisix-dashboard/blob/b4ad55d405cb61b97b9147d2924ab8121fa0e406/api/internal/handler/route/route_test.go#L393
The Verified format is so complex, find where making wrong is difficult for me 😬 😬 .
I also reproduced in the local environment. @nic-chen
maybe i know what things happened.
in apisix project script filed used to make lua code by using loadstring function, code in here:
https://github.com/apache/apisix/blob/2472db56c8adbd1495707fffc0e3e4f00a8cab88/apisix/admin/routes.lua#L136-L146
so the type of script is string, schema is script = {type = "string", minLength = 10, maxLength = 102400}. but in this test, script is a object. convert it to go structure, and then make string for lua code. code in here:
https://github.com/apache/apisix-dashboard/blob/c574813eea82edcd6d95a2ea0f8857b736049717/api/internal/handler/route/route.go#L220-L237
answer is clear, the route schema is not suitable. maybe we should use new schema which different from apisix project, but is difficut to maintain in the future, so i think we should keep it consistent.
what do you think?
cc @nic-chen @membphis why CI pass?
@JieTrancender
Currently, the Manager API relies on Lua and lib dag-to-lua. That's why you run test failed.
please have a look at:
https://github.com/apache/apisix-dashboard/blob/master/.github/workflows/backend-unit-test.yml#L27-L32
and
https://github.com/apache/apisix-dashboard/blob/master/.github/workflows/backend-unit-test.yml#L39-L42
cc @moonming
Developers may not know this tip, FAQ is a good place 😁
Currently, the Manager API relies on Lua and lib
dag-to-lua. That's why you run test failed.
Run make api-test, should check dag-to-lua dependencies, if the dependencies are not installed, we need to download and install.
All of those steps, we'd better write them in Makefile.