Skip to content

Commit

Permalink
Add new mode to test virtual host style with awscli
Browse files Browse the repository at this point in the history
Mint awscli tests now run against both path style and virtual style
if virtual style flag is set. By default only path style tests are
run

Fixes minio#213
  • Loading branch information
nitisht committed Nov 11, 2017
1 parent 88b0040 commit 68ed2b2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Below environment variables are required to be passed to the docker container. S
| `SECRET_KEY` | Secret Key of access `SERVER_ENDPOINT` | `zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG` |
| `ENABLE_HTTPS` | (Optional) Set `1` to indicate to use HTTPS to access `SERVER_ENDPOINT`. Defaults to `0` (HTTP) | `1` |
| `MINT_MODE` | (Optional) Set mode indicating what catogery of tests to be run by values `core` or `full`. Defaults to `core` | `full` |
| `ACCESS_STYLE` | (Optional) Set path style or virtual style access for testing Minio server. Defaults to `path` | `virtual` |

### Mint log format

Expand Down
3 changes: 3 additions & 0 deletions mint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ MINT_DATA_DIR=${MINT_DATA_DIR:-/mint/data}
MINT_MODE=${MINT_MODE:-core}
SERVER_REGION=${SERVER_REGION:-us-east-1}
ENABLE_HTTPS=${ENABLE_HTTPS:-0}
ACCESS_STYLE=${ACCESS_STYLE:-path}

if [ -z "$SERVER_ENDPOINT" ]; then
SERVER_ENDPOINT="play.minio.io:9000"
Expand Down Expand Up @@ -97,6 +98,7 @@ function main()
export SECRET_KEY
export ENABLE_HTTPS
export SERVER_REGION
export ACCESS_STYLE

echo "Running with"
echo "SERVER_ENDPOINT: $SERVER_ENDPOINT"
Expand All @@ -106,6 +108,7 @@ function main()
echo "SERVER_REGION: $SERVER_REGION"
echo "MINT_DATA_DIR: $MINT_DATA_DIR"
echo "MINT_MODE: $MINT_MODE"
echo "ACCESS_STYLE: $ACCESS_STYLE"
echo

echo "To get logs, run 'sudo docker cp ${CONTAINER_ID}:/mint/log /tmp/mint-logs'"
Expand Down
11 changes: 10 additions & 1 deletion run/core/awscli/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,18 @@ aws configure set aws_access_key_id "$ACCESS_KEY"
aws configure set aws_secret_access_key "$SECRET_KEY"
aws configure set default.region "$SERVER_REGION"

# run tests
# Setup endpoint scheme
endpoint="http://$SERVER_ENDPOINT"
if [ "$ENABLE_HTTPS" -eq 1 ]; then
endpoint="https://$SERVER_ENDPOINT"
fi

# check the access style and run tests if virtual style is set
if [ "$ACCESS_STYLE" == "virtual" ]; then
aws configure set default.s3.addressing_style virtual
./test.sh "$endpoint" 1>>"$output_log_file" 2>"$error_log_file"
fi

# run path style tests
aws configure set default.s3.addressing_style path
./test.sh "$endpoint" 1>>"$output_log_file" 2>"$error_log_file"
5 changes: 2 additions & 3 deletions run/core/awscli/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,16 @@ function log_alert() {

function make_bucket() {
# Make bucket
bucket_name="awscli-mint-test-bucket-$RANDOM"
bucket_name="awscli-mint-test-bucket"
function="${AWS} s3api create-bucket --bucket ${bucket_name}"

# execute the test
out=$($function 2>&1)
rv=$?

# if command is successful print bucket_name or print error
if [ $rv -eq 0 ]; then
echo "${bucket_name}"
else
else
echo "${out}"
fi

Expand Down

0 comments on commit 68ed2b2

Please sign in to comment.