[vtadmin] Add infrastructure for generating authz tests for vtadmin#10397
[vtadmin] Add infrastructure for generating authz tests for vtadmin#10397ajm188 merged 3 commits intovitessio:mainfrom
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Bug fixes
Non-trivial changes
New/Existing features
Backward compatibility
|
deepthi
left a comment
There was a problem hiding this comment.
This is a great idea!
What's the right spot for me to inject a make target to run go generate ./go/vt/vtadmin/... and go fmt ./go/vt/vtadmin ?
The pattern we have followed is to create a separate (new) make target for code generation AND add a CI check to make sure generated files are up to date.
The lack of verifying authz checks are where they should be is one of the most glaring issues in vtadmin (in my opinion; it's also my "fault" things are this way). At the same time, writing all the code by hand to verify every single endpoint would be a giant pain (which is the main reason things are this way). So, let's codegen all the bits we don't care about! The bonus here is that the config.json now can serve as authoritative on what permissions are required for what endpoints. The goal here is to have the config primarily specify the rules needed for each endpoint, with as minimal "overhead" (currently specifying test cases and mock data) as possible. I want to separate the introduction of this setup from its complete adoption, so I will submit a follow-up change that adds the rest of the endpoint tests. Signed-off-by: Andrew Mason <andrew@planetscale.com>
Signed-off-by: Andrew Mason <andrew@planetscale.com>
Signed-off-by: Andrew Mason <andrew@planetscale.com>
f5d03bb to
3bc56d1
Compare
Done!! @frouioui I will fully cop to admitting I just copied and modified the setup for |
frouioui
left a comment
There was a problem hiding this comment.
It looks good to me, nothing to report on the CI part! :)
Plus one on that 😃 |
@ajm188, the above is fine in the case where we see a difference in |
oh, yeah 😅 i was just demonstrating (without, ya know, actually making that clear at all) that if i change the config but don't re-gen, the check fails (as desired) |
Description
The lack of verifying authz checks are where they should be is one of the
most glaring issues in vtadmin (in my opinion; it's also my "fault" things
are this way). At the same time, writing all the code by hand to verify
every single endpoint would be a giant pain (which is the main reason
things are this way). So, let's codegen all the bits we don't care about!
The bonus here is that the config.json now can serve as authoritative on
what permissions are required for what endpoints.
The goal here is to have the config primarily specify the rules needed for
each endpoint, with as minimal "overhead" (currently specifying test cases
and mock data) as possible.
I want to separate the introduction of this setup from its complete
adoption, so I will submit a follow-up change that adds the rest of the
endpoint tests.
Outstanding questions
go generate ./go/vt/vtadmin/...andgo fmt ./go/vt/vtadmin?Related Issue(s)
Checklist
Deployment Notes