Skip to content
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

Fix error messages for missing dependencies, allow test suite to run on MacOS by supporting md5 #162

Merged
merged 3 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ additional modules.

## Testing

Automated tests require `docker`, `docker-compose`, `curl`, and `mc` (the minio [cli tool](https://github.com/penpyt/asdf-mc)) to be
Automated tests require `docker`, `docker-compose`, `curl`, `md5sum` (or `md5` on MacOS), and `mc` (the minio [cli tool](https://github.com/penpyt/asdf-mc)) to be
installed. To run all unit tests and integration tests, run the following command.
If you invoke the test script with a plus parameter, you will need to add your
NGINX repository keys to the `plus/etc/ssl/nginx` directory
Expand Down
4 changes: 2 additions & 2 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ e "${startup_message}"

set -o nounset # abort on unbound variable

docker_cmd="$(command -v docker)"
docker_cmd="$(command -v docker || true)"
if ! [ -x "${docker_cmd}" ]; then
e "required dependency not found: docker not found in the path or not executable"
exit ${no_dep_exit_code}
Expand All @@ -147,7 +147,7 @@ else
fi
e "Using Docker Compose command: ${docker_compose_cmd}"

curl_cmd="$(command -v curl)"
curl_cmd="$(command -v curl || true)"
if ! [ -x "${curl_cmd}" ]; then
e "required dependency not found: curl not found in the path or not executable"
exit ${no_dep_exit_code}
Expand Down
17 changes: 14 additions & 3 deletions test/integration/test_api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,29 @@ if [ -z "${test_dir}" ]; then
e "missing second parameter: path to test data directory"
fi

curl_cmd="$(command -v curl)"
curl_cmd="$(command -v curl || true)"
if ! [ -x "${curl_cmd}" ]; then
e "required dependency not found: curl not found in the path or not executable"
exit ${no_dep_exit_code}
fi

checksum_cmd="$(command -v md5sum)"
if ! [ -x "${curl_cmd}" ]; then
# Allow for MacOS which does not support "md5sum"
# but has "md5 -r" which can be substituted
checksum_cmd="$(command -v md5sum || command -v md5 || true)"

if ! [ -x "${checksum_cmd}" ]; then
e "required dependency not found: md5sum not found in the path or not executable"
exit ${no_dep_exit_code}
fi

# If we are using the `md5` executable
# then use the -r flag which makes it behave the same as `md5sum`
# this is done after the `-x` check for ability to execute
# since it will not pass with the flag
if [[ $checksum_cmd =~ \/md5$ ]]; then
checksum_cmd="${checksum_cmd} -r"
fi

assertHttpRequestEquals() {
method="$1"
path="$2"
Expand Down