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

Conversation

4141done
Copy link
Collaborator

@4141done 4141done commented Aug 8, 2023

What

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

Dependency Checks

There were some checks like this:

curl_cmd="$(command -v curl)"
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

However, command -v exits with an error if the command does not exist. This results in the nice error message not being shown.

The solution is to avoid the assignment of the variable erroring and instead relying on the executability check to make sure we have the right thing

md5 compatibility

The test script depends on md5sum which is not available on MacOS. Thus, tests would fail at the start when run on MacOS.
MacOS has a tool called md5, which when called with the -r flag which reverses the format of the output.

@4141done 4141done requested a review from dekobon August 8, 2023 00:45
Copy link
Collaborator

@dekobon dekobon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

@4141done 4141done merged commit 7e35275 into master Aug 8, 2023
elJosho pushed a commit to elJosho/nginx-s3-gateway that referenced this pull request Oct 25, 2023
… on MacOS by supporting `md5` (nginxinc#162)

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

## Dependency Checks
There were some checks like this:

```bash
curl_cmd="$(command -v curl)"
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
```

However, `command -v` exits with an error if the command does not exist. This results in the nice error message not being shown.

The solution is to avoid the assignment of the variable erroring and instead relying on the executability check to make sure we have the right thing

## `md5` compatibility
The test script depends on `md5sum` which is not available on MacOS. Thus, tests would fail at the start when run on MacOS.
MacOS has a tool called `md5`, which when called with the `-r` flag which reverses the format of the output.
@4141done 4141done deleted the test-suite-macos branch April 25, 2024 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants