-
Notifications
You must be signed in to change notification settings - Fork 123
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
Validate/test all default configs #1268
Conversation
Great! Is this the right target branch though? I see a couple of unrelated commits. |
Oh, yea I rebased off the version/4.0.0 branch before opening the PR but then targeted main. I think this best targets main since its unrelated to the CSS code itself, maybe after the 4.0.0 release this can be cleaned up. EDIT: fixed with rebase off main after release |
bb074da
to
a9bda29
Compare
.github/workflows/ci.yml
Outdated
node-version: '16.x' | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
- name: Generate certificates https config |
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.
- name: Generate certificates https config | |
- name: Generate certificates for HTTPS configurations |
test/deploy/validate-configs.sh
Outdated
if [[ $CONFIG_NAME =~ "https" ]]; then | ||
sed -i -E "s/(\W+\"options_key\".*\").+(\".*)/\1server.key\2/" $CONFIG_PATH | ||
sed -i -E "s/(\W+\"options_cert\".*\").+(\".*)/\1server.cert\2/" $CONFIG_PATH | ||
CSS_OPTS="$CSS_OPTS -b https://localhost:8888 --httpsKey server.key --httpsCert server.cert" | ||
CURL_STATEMENT='-k https://localhost:8888' | ||
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.
I would have 2 separate if-statements for the 2 different HTTPS configs so only one of them gets the CLI params, and only one of them gets the changed config. You can also changes the paths in example-https-file.json
should that make testing easier.
test/deploy/validate-configs.sh
Outdated
echo "----------------------------------------" | ||
echo -e $SUCCESSES | ||
echo -e $FAILURES | ||
exit $VALIDATION_FAILURE |
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.
Missing EOL.
test/deploy/validate-configs.sh
Outdated
FAILURE=1 | ||
if [ -z $PID ]; then | ||
echo "$TEST_NAME($CONFIG_NAME) - FAILURE: Server did not start" | ||
cat logs/$CONFIG_NAME | ||
else | ||
echo "$TEST_NAME($CONFIG_NAME) - Attempting HTTP access to the server" | ||
for i in {1..20}; do | ||
sleep 1 | ||
if curl -s -f $CURL_STATEMENT > logs/$CONFIG_NAME-curl; then | ||
echo "$TEST_NAME($CONFIG_NAME) - SUCCESS: server reached (after ~${i}s)" | ||
FAILURE=0 | ||
break | ||
fi | ||
done |
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.
Since writing this I found https://stackoverflow.com/a/71522504/476820
test/deploy/validate-configs.sh
Outdated
echo -e $SUCCESSES | ||
echo -e $FAILURES |
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.
Brutal honesty there.
The script can now be handed one or multiple arguments, either full path, name, name.json or config/name (see example below). $ npm run test:deploy default file.json config/example-https-file config/https-file-cli.json
> @solid/community-server@4.0.0 test:deploy
> test/deploy/validate-configs.sh "default" "file.json" "config/example-https-file" "config/https-file-cli.json"
Deployment testing 4 configs
- config/default.json
- config/file.json
- config/example-https-file.json
- config/https-file-cli.json No arguments will start test for all configs. $ npm run test:deploy
> @solid/community-server@4.0.0 test:deploy
> test/deploy/validate-configs.sh
Deployment testing all configs!
- config/default.json
- config/dynamic.json
- config/example-https-file.json
- config/file-no-setup.json
- config/file.json
- config/https-file-cli.json
- config/memory-subdomains.json
- config/path-routing.json
- config/quota-file.json
- config/restrict-idp.json
- config/sparql-endpoint-no-setup.json
- config/sparql-endpoint.json
- config/sparql-file-storage.json Added ! When you run locally, sparql configs will fail unless you have an endpoint on Certificate generation was moved inside the script (instead of from CI run) to allow local deploy:test of https (now it will get generated twice in case all configs are run, don't think this is an issue but might be better to generate at start script (not in the https conditional) The example-https-file gets copied and placed back so original values are restored. Alternatively, we just change the paths in the file like @joachimvh suggested, but maybe best to keep it in a dir still (to indicate clearly it needs a path). Something like Perhaps I should look into writing some small Developer docs on what to do/check when new default configs get added? |
Im seeing the unit tests on ubuntu fail because they are running |
Absolutely, yes! |
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.
Super cool stuff!
|
||
TEST_NAME="Deployment testing" | ||
declare -a CONFIG_ARRAY | ||
if [[ $# -gt 0 ]]; then |
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.
Some comments perhaps regarding expected arguments?
test/deploy/validate-configs.sh
Outdated
# Script to validate the packaged module and configs | ||
|
||
# Ensure our workdir is that of the project root | ||
cd "${0%/*}/../.." || exit |
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.
Exit with warning / error code?
Requested changes are implemented
|
So nice to see this pass. Great work! @joachimvh Let's make |
@joachimvh Do we have graceful shutdown instead of kill? Like a HUP? Or is this the safe way? |
We don't. The only way to gracefully shutdown is if you start the server through code. |
π Related issues
#354
βοΈ Description
A bash script has been added
/test/deploy/validate-configs.sh
This script will test run CSS with all the different default configs by looping over
config/*.json
For https (
example-https-file.json
andhttps-cli-file.json
) certs are set (through cli params or config file overwrites) and base URL is changed.This script is run in the
test-configs
job. The job has atenforce/virtuoso
service for sparql config validation and also generates a self-signed cert/key for https. All configs get tested, in case of failure the logs from CSS get printed and the script moves on to the next config. At the end an overview printout is provided:If one of the tests has failed, the overall job will fail.
Improvements
Conditional command changes
Additional exceptions like in the case of https can be set up but this might become cumbersome in the future as configs get added or changed. Perhaps we might move to a solution where default configs are accompanied with an entry in a separate validation config file that provides a string to append to the
community-solid-server
command. With the addition #1264 and dynamic CLI parameters, we can also enforce all future configs to have parameters that allow it to be run without editing config files (like in the case ofexample-https-file.json
).Validation / deployment testing / config testing?
Right now, the job name is
test-configs
and the script is calledvalidate-configs
, I'm not sure how we best name this step and where we position it in the pipeline. It's more a form of deployment testing with different configs than a true test...β PR check list
Before this pull request can be merged, a core maintainer will check whether