-
Notifications
You must be signed in to change notification settings - Fork 3
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
Initial PR #1
Initial PR #1
Conversation
cbf2afe
to
76c6903
Compare
2f9fa5d
to
ed4fb6f
Compare
The integration testing environment is largely the same, as well as the script for generating the client. Although there are not currently tests for the OIDC & LDAP authenticators included in the client I left them in as a part of the integration testing infrastructure, it is zero cost to leave them in & we will definitely want to test against them in the future.
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.
Great stuff, awesome user documentation!!! I've reviewed a bunch. Let me know if there are other files on which I haven't commented that should be reviewed with special attention.
README.md
Outdated
a high level overview of the benefit of your project and its main use cases. | ||
| Java Client Version | API Version | | ||
| :-----------------: | :---------: | | ||
| 1.x.x | 5.1.1 | |
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.
Should the 5.1.1
API version be the currently supported OpenAPI Generator version (4.3.1
)?
Or if "API version" refers to a different repo than the OpenAPI Generator, can we add a hyperlink to that?
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.
The 5.1.1 version number corresponds to the Conjur API Version. I will try to make this more clear and add a link to the OpenAPI releases page.
# Docker-compose will pick this file up when starting containers | ||
# so we will have these variables in the container | ||
cat <<ENV > .env | ||
CONJUR_AUTHN_API_KEY=$admin_api_key |
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.
Add quotes:
CONJUR_AUTHN_API_KEY="$admin_api_key"
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 actually had to revert this one. Putting quotes around the substitution here also puts quotes around the variable when you retrieve it which causes issues in the client. Don't know if there is a way around this.
256d938
to
51be530
Compare
57c7238
to
ac4fa96
Compare
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.
Couple more comments.
I scrolled past the rest of the files, it looks like it's mostly generated scaffolding code?
bin/test_integration
Outdated
|
||
conjur_container_alive(){ | ||
if [ -z `docker-compose ps -q conjur` ]; then | ||
echo 1 |
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'm open for convincing... but for readability, my preference for a boolean bash function would be to just execute true
or false
(See https://stackoverflow.com/questions/2953646/how-can-i-declare-and-use-boolean-variables-in-a-shell-script).
For example:
conjur_container_alive(){
if [ -z `docker-compose ps -q conjur` ]; then
true
elif [ -z `docker ps -q --no-trunc | grep $(docker-compose ps -q conjur)` ]; then
true
else
false
fi
}
And then, when this function gets invoked, the conditional would be:
if [ "$no_rebuild_conjur" = false ] || conjur_container_alive; then
Here, the no_rebuild_conjur
would be initialized as:
no_rebuild_conjur=false
Another way to do it would be to echo the literal 'true'
or 'false'
in the function and for the variable initialization:
conjur_container_alive(){
if [ -z `docker-compose ps -q conjur` ]; then
echo 'true'
elif [ -z `docker ps -q --no-trunc | grep $(docker-compose ps -q conjur)` ]; then
echo 'true'
else
echo 'false'
fi
}
And then the function invocation would be:
if [ "$no_rebuild_conjur" = 'false' ] || [ "$(conjur_container_alive)" = 'true' ]; then
Here, the no_rebuild_conjur
would be initialized as:
no_rebuild_conjur='false'
FWIW, I made a "playground" bash script to experiment and validate these techniques:
#!/bin/bash
set -e
true_var=true
false_var=false
true_var_2='true'
false_var_2='false'
function true_func() {
true
}
function false_func() {
false
}
function true_func_2() {
echo 'true'
}
function false_func_2() {
echo 'false'
}
if "$true_var"; then
echo "true_var is true"
else
echo "true_var is false"
fi
if "$false_var"; then
echo "false_var is true"
else
echo "false_var is false"
fi
if [ "$true_var" = true ]; then
echo "true_var is true"
else
echo "true_var is false"
fi
if [ "$false_var" = true ]; then
echo "false_var is true"
else
echo "false_var is false"
fi
if [ "$true_var_2" = 'true' ]; then
echo "true_var_2 is 'true'"
else
echo "true_var_2 is 'false'"
fi
if [ "$false_var_2" = 'true' ]; then
echo "false_var_2 is 'true'"
else
echo "false_var_2 is 'false'"
fi
if true_func; then
echo "true_func returns true"
else
echo "true_func returns false"
fi
if false_func; then
echo "false_func returns true"
else
echo "false_func returns false"
fi
if [ "$(true_func_2)" = 'true' ]; then
echo "true_func_2 returns 'true'"
else
echo "true_func_2 returns 'false'"
fi
if [ "$(false_func_2)" = 'true' ]; then
echo "false_func_2 returns 'true'"
else
echo "false_func_2 returns 'false'"
fi
if $true_var && true_func; then
echo "Both true_var and true_func are true"
else
echo "true_var and true_func are not both true"
fi
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.
Thank you for pointing this out! I actually had no idea you could just execute true/false from a function. I updated the boolean variables, will probably go over to the openapi repo and make a few changes over there as well to clean things up.
bin/test_integration
Outdated
|
||
source bin/util | ||
|
||
no_regen_client=0 |
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.
Might be more readable to use literal 'true'
or 'false'
for boolean variables?
For example:
no_regen_client='false'
And conditional check would be:
if [ "$no_regen_client" = 'false' ]; then
# Do stuff
fi
Or, you can use true
or false
directly:
no_regen_client=false
And conditional check would be:
if [ "$no_regen_client" = false ]; then
# Do stuff
fi
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.
LGTM! Everything looks really great. I'm approving, though I only did a very quick scan of the generated scaffolding... I'm assuming that part will evolve and get thoroughly tested as you add more features.
CNJR-4234 - OpenAPI Specification - Java SDK - Added Automated testing
Initial Pull Request
Most of the code included in this PR is directly copied from the conjur-openapi-spec repo. Things to look closely at are the shell scripts which had to undergo some small changes to make them compatible with this new repository format, as well as the CONTRIBUTING & README documents which I have added some details to.
This PR is dependent on another PR being pulled into the OpenAPI repository. Without it setting secrets in the java client will not work. For manual testing purposes you can change a line in
bin/refresh_client
from:git clone https://github.com/cyberark/conjur-openapi-spec.git
togit clone -b update-request-body https://github.com/cyberark/conjur-openapi-spec.git
and everything should work.Checklist:
TODO:
README.md
, addressing all TODOsCONTRIBUTING.md
with development and contribution guidelines for your specificproject
CHANGELOG.md
with information on previous versions (if applicable).github/ISSUE_TEMPLATE/
if the defaults in https://github.com/cyberark/.githubdon't work for your use case
LICENSE
) - if you wouldprefer to use some other license, you'll need to revise this file
Migrating From Another Repo:
Important
.github/ISSUE_TEMPLATE/new-project.md
.github/pull_request_template.md
) - the project will use the default org PR template