fix: ref check while deleting proto via Admin API#4575
Conversation
spacewander
left a comment
There was a problem hiding this comment.
Could you add a test as t/admin/proto.t, like the one in t/admin/upstream2.t?
ok |
已添加测试用例,路径是 t/admin/proto3.t |
| GET /t | ||
| --- response_body | ||
| [push] code: 200 message: passed | ||
| [delete] code: 200 message: passed |
There was a problem hiding this comment.
We need to refer to the proto in a route/service, so that we can test the path that returns 400.
There was a problem hiding this comment.
ok, I will modify proto test case.
There was a problem hiding this comment.
What's the problem for this? in Code Lint / lint (pull_request) phase。
The following is the error message:
"
=====bad style=====
echo '=====bad style====='
cat /tmp/error.log
reindex: t/admin/proto.t: done.
echo 'you need to run '''reindex''' to fix them. Read CONTRIBUTING.md for more details.'
you need to run 'reindex' to fix them. Read CONTRIBUTING.md for more details.
exit 1
make: *** [Makefile:121: lint] Error 1
Error: Process completed with exit code 2.
"
There was a problem hiding this comment.
|
|
||
|
|
||
|
|
||
| === TEST 3: put proto (id:2) |
There was a problem hiding this comment.
We can merge TEST 3~5 into one test? As they both use the Admin API and test for one thing.
问题:admin api proto delete 操作 异常。
原因:delete方法调用_M.check_proto_used()方法时,直接返回。如果插件grpc-transcode没有使用需要删除的protoid就会发生错误。
修改点:
1,将proto对象的check_proto_used方法修改为local方法(该方法没有其他地方使用,最好定义为local方法)。
2,对proto对象的delete方法调用check_proto_used方法的地方进行了修改。