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

awscli: Add server side encryption tests #225

Merged
merged 1 commit into from
Nov 18, 2017
Merged

Conversation

poornas
Copy link
Contributor

@poornas poornas commented Nov 17, 2017

Fixes #214

# tests server side encryption headers for get and put calls
function test_serverside_encryption() {
#skip server side encryption tests if HTTPS disabled.
if [ "$ENABLE_HTTPS" -ne 1 ]; then
Copy link
Member

Choose a reason for hiding this comment

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

Does this string comparison work? like this will evaluate to

if [ '0' -ne 1 ]; then 

it is perhaps better to check like this

if [ "$ENABLE_HTTPS" != "1" ]; then
     return 0
fi

Copy link
Member

@balamurugana balamurugana Nov 17, 2017

Choose a reason for hiding this comment

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

But [ "1" -eq 1 ] does numeric comparison

Copy link
Member

Choose a reason for hiding this comment

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

It does but should we rely on the fact? because it is better to not quote it in such a case. If we quote it better to use string comparisons.

Copy link
Member

Choose a reason for hiding this comment

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

Welcome to Bash. That is not true. You should double quote to avoid string spilling.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah but i prefer the style of if [ $ENABLE_HTTPS -ne 1 ]; then - it tells atleast to me that we are doing a numeric comparison. Using strings in first arg and then numeric is confusing while incidentally it works.

Word splitting problem only happens when you are doing things like adding variables with some static strings such as not in case of "if" doing a numerical comparison is not a problem (this can be tested locally)

$HOME/$dir/dist/bin/$file        # Unquoted (bad)
"$HOME"/"$dir"/dist/bin/"$file"  # Minimal quoting (good)
"$HOME/$dir/dist/bin/$file"      # Canonical quoting (good)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It actually works as per testing - perhaps because -ne is an integer operator. will fix it to avoid surprises though

Copy link
Member

Choose a reason for hiding this comment

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

Question is how you treat the variable i.e. string type or integer type (Bash treats everything as string). The choice is yours.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok , updated PR to do string comparison


# main handler for all the tests.
main() {
test_serverside_encryption_error
return
Copy link
Member

Choose a reason for hiding this comment

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

A return here looks out of place..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that wasn't intended. updated PR.

Copy link
Member

@harshavardhana harshavardhana left a comment

Choose a reason for hiding this comment

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

LGTM

@nitisht nitisht merged commit 853883f into minio:master Nov 18, 2017
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.

4 participants