-
Notifications
You must be signed in to change notification settings - Fork 1.2k
tools.testing: Add methods to simplify gatekeeper development #11270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
to avoid manual curling to analyze GK issues let's add a way to dump all GK requests in a directory when the use specifies "DEBUG" env variable. Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
to simplify gatekeeper development add support for DEBUG_INPUT which can be used to report content from files gathered in DEBUG run. Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me and would have helped when I was debugging the gatekeeper issue. Thanks @ldoktor!
response = requests.get(url, headers=_GH_HEADERS, params=params, | ||
timeout=60) | ||
response.raise_for_status() | ||
output = response.json() | ||
if DEBUG_DIR: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit? if you have DEBUG_DIR and DEBUG_INPUT exported then it should ignore DEBUG_DIR? i.e., save the output json only if downloaded from internet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally I thought about it and then decided not to try to make the script smart and simply rely on users to use them as they want. So do you want me to put here if not DEBUG_INPUT and DEBUG_DIR:
or can it stay as is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wanted to bring it to your attention in case you hadn't noticed. But since it was a deliberated decision (not try to make it super smart) and it is debug code (not super critical); I'm fine to keep it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ldoktor !
Playing around with gatekeeper might be tedious with all the GH requests, let's add a way to record/provide some files instead.