diff --git a/Dockerfile.dev b/Dockerfile.dev index b345fd7e..98474a4f 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -67,10 +67,13 @@ RUN /mint/build/minio-dotnet/install.sh COPY build/security /mint/build/security RUN build/security/install.sh +COPY build/worm /mint/build/worm +RUN build/worm/install.sh + COPY remove-packages.list /mint COPY postinstall.sh /mint RUN /mint/postinstall.sh COPY mint.sh /mint/mint.sh COPY entrypoint.sh /mint/entrypoint.sh -ENTRYPOINT ["/mint/entrypoint.sh"] +ENTRYPOINT ["/mint/entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md index dcd71ee2..fbd16ab4 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Mint is a testing framework for Minio object server, available as a docker image - minio-py - minio-dotnet - s3cmd +- worm ## Running Mint @@ -25,6 +26,12 @@ To run Mint with Minio Play server as test target, $ docker run -e SERVER_ENDPOINT=play.minio.io:9000 -e ACCESS_KEY=Q3AM3UQ867SPQQA43P2F \ -e SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG -e ENABLE_HTTPS=1 minio/mint ``` +In case of Worm mode + +```sh +$ docker run -e SERVER_ENDPOINT=play.minio.io:9000 -e ACCESS_KEY=Q3AM3UQ867SPQQA43P2F \ + -e SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG -e ENABLE_HTTPS=1 -e MINT_MODE=worm minio/mint +``` After the tests are run, output is stored in `/mint/log` directory inside the container. To get these logs, use `docker cp` command. For example ```sh @@ -41,7 +48,7 @@ Below environment variables are required to be passed to the docker container. S | `ACCESS_KEY` | Access key of access `SERVER_ENDPOINT` | `Q3AM3UQ867SPQQA43P2F` | | `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 category of tests to be run by values `core` or `full`. Defaults to `core` | `full` | +| `MINT_MODE` | (Optional) Set mode indicating what category of tests to be run by values `core`, `full` or `worm`. Defaults to `core` | `full` | ### Mint log format @@ -70,7 +77,14 @@ $ docker run -e SERVER_ENDPOINT=play.minio.io:9000 -e ACCESS_KEY=Q3AM3UQ867SPQQA -e SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG \ -e ENABLE_HTTPS=1 -e MINT_MODE=full minio/mint:latest ``` +In case of Worm Mode +```sh +$ docker build -t minio/mint . -f Dockerfile.dev +$ docker run -e SERVER_ENDPOINT=play.minio.io:9000 -e ACCESS_KEY=Q3AM3UQ867SPQQA43P2F \ + -e SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG \ + -e ENABLE_HTTPS=1 -e MINT_MODE=worm minio/mint:latest +``` ### Adding tests with new tool/SDK Below are the steps need to be followed diff --git a/build/worm/install.sh b/build/worm/install.sh new file mode 100755 index 00000000..9d571c50 --- /dev/null +++ b/build/worm/install.sh @@ -0,0 +1,24 @@ +#!/bin/bash -e +# +# Mint (C) 2017 Minio, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +test_run_dir="$MINT_RUN_CORE_DIR/worm" +go get -u github.com/aws/aws-sdk-go/aws/... +go get -u github.com/aws/aws-sdk-go/aws/credentials/... +go get -u github.com/aws/aws-sdk-go/aws/session/... +go get -u github.com/aws/aws-sdk-go/service/s3/... +go get -u github.com/sirupsen/logrus/... +go build -o "$test_run_dir/worm" "$test_run_dir/quick-worm-tests.go" diff --git a/mint.sh b/mint.sh index f0489344..8a0c9423 100755 --- a/mint.sh +++ b/mint.sh @@ -21,6 +21,7 @@ MINT_MODE=${MINT_MODE:-core} SERVER_REGION=${SERVER_REGION:-us-east-1} ENABLE_HTTPS=${ENABLE_HTTPS:-0} + if [ -z "$SERVER_ENDPOINT" ]; then SERVER_ENDPOINT="play.minio.io:9000" ACCESS_KEY="Q3AM3UQ867SPQQA43P2F" @@ -60,9 +61,10 @@ function run_test() start=$(date +%s) mkdir -p "$BASE_LOG_DIR/$sdk_name" - + echo "BASE_LOG_DIR :$BASE_LOG_DIR" (cd "$sdk_dir" && ./run.sh "$BASE_LOG_DIR/$LOG_FILE" "$BASE_LOG_DIR/$sdk_name/$ERROR_FILE") rv=$? + echo " ev $rv" end=$(date +%s) duration=$(humanize_time $(( end - start ))) @@ -97,6 +99,7 @@ function main() export SECRET_KEY export ENABLE_HTTPS export SERVER_REGION + echo "Running with" echo "SERVER_ENDPOINT: $SERVER_ENDPOINT" @@ -119,13 +122,36 @@ function main() ## On empty command line argument, populate all SDK names from $TESTS_DIR if [ "${#run_list[@]}" -eq 0 ]; then run_list=( "$TESTS_DIR"/* ) - fi + fi + ## Run Worm test Only when worm mode is on + sdk_dir="$TESTS_DIR/worm" + worm_test_status=true + if [ "$MINT_MODE" = "worm" ]; + then + sdk_name=$(basename "$sdk_dir") + if [ ! -d "$sdk_dir" ]; then + echo "Test $sdk_name not found. Exiting Mint." + exit 1 + fi + echo -n " Running $sdk_name tests ... " + if ! run_test "$sdk_dir"; then + worm_test_status=false + fi + else + # Remove worm test case + for i in "${!run_list[@]}"; do + if [[ ${run_list[i]} = "${sdk_dir}" ]]; then + unset 'run_list[i]' + fi + done + count="${#run_list[@]}" i=0 + for sdk_dir in "${run_list[@]}"; do sdk_name=$(basename "$sdk_dir") - (( i++ )) + (( i++ )) if [ ! -d "$sdk_dir" ]; then echo "Test $sdk_name not found. Exiting Mint." exit 1 @@ -136,14 +162,25 @@ function main() break fi done + fi ## Report when all tests in run_list are run - if [ $i -eq "$count" ]; then - echo -e "\nAll tests ran successfully" - else - echo -e "\nExecuted $i out of $count tests successfully." - exit 1 - fi + + if [ "$MINT_MODE" = "worm" ];then + if [ "$worm_test_status" = true ]; then + echo -e "\\nWORM tests ran successfully" + else + echo -e "\\nWORM tests ran failed" + exit 1 + fi + else + if [ $i -eq "$count" ]; then + echo -e "\\nAll tests ran successfully" + else + echo -e "\\nExecuted $i out of $count tests successfully." + exit 1 + fi + fi } main "$@" diff --git a/run/core/worm/run.sh b/run/core/worm/run.sh new file mode 100755 index 00000000..9404b864 --- /dev/null +++ b/run/core/worm/run.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# +# Mint (C) 2017 Minio, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# handle command line arguments +if [ $# -ne 2 ]; then + echo "usage: run.sh " + exit -1 +fi + +output_log_file="$1" +error_log_file="$2" + +# run tests +/mint/run/core/worm/worm 1>>"$output_log_file" 2>"$error_log_file"