diff --git a/README.md b/README.md index 56e5ecef..e10151cc 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ Below environment variables are required to be passed to the podman container. S | `SECRET_KEY` | Secret Key for `SERVER_ENDPOINT` credentials | `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`, `full`. Defaults to `core` | `full` | +| `MINT_MC_VARIANT` | (Optional) Select `mc` test variant by values `mc`, `ec`. Defaults to `mc`. (Using `ec` requires providing the `ec` repo in the container.) | `ec` | | | `DOMAIN` | (Optional) Value of MINIO_DOMAIN environment variable used in Minio server | `myminio.com` | | `ENABLE_VIRTUAL_STYLE` | (Optional) Set `1` to indicate virtual style access . Defaults to `0` (Path style) | `1` | | `RUN_ON_FAIL` | (Optional) Set `1` to indicate execute all tests independent of failures (currently implemented for minio-go and minio-java) . Defaults to `0` | `1` | diff --git a/build/mc/install.sh b/build/mc/install.sh index dbc45498..a5194a5d 100755 --- a/build/mc/install.sh +++ b/build/mc/install.sh @@ -15,6 +15,11 @@ # limitations under the License. # +if [ "${MINT_MC_VARIANT:-mc}" = "ec" ]; then + echo "MINT_MC_VARIANT=ec: skipping upstream mc install (expecting ec-provided repo/binary/tests)" + exit 0 +fi + MC_VERSION=$(curl --retry 10 -Ls -o /dev/null -w "%{url_effective}" https://github.com/minio/mc/releases/latest | sed "s/https:\/\/github.com\/minio\/mc\/releases\/tag\///") if [ -z "$MC_VERSION" ]; then echo "unable to get mc version from github" diff --git a/run/core/mc/README.md b/run/core/mc/README.md index 9a550e09..ede76655 100644 --- a/run/core/mc/README.md +++ b/run/core/mc/README.md @@ -2,7 +2,7 @@ This directory serves as the location for Mint tests using `mc`. Top level `mint.sh` calls `run.sh` to execute tests. ## Adding new tests -New tests is added into `test.sh` as new functions. +Upstream `mc` tests live in `functional-tests.sh` (fetched from `minio/mc` during the Mint image build). ## Running tests manually - Set environment variables `MINT_DATA_DIR`, `MINT_MODE`, `SERVER_ENDPOINT`, `ACCESS_KEY`, `SECRET_KEY`, `SERVER_REGION` and `ENABLE_HTTPS` @@ -17,3 +17,15 @@ export ENABLE_HTTPS=1 export SERVER_REGION=us-east-1 ./run.sh /tmp/output.log /tmp/error.log ``` + +## Running `ec` (enterprise) mc variant +If you want to run `mc` tests using the `ec` fork, set `MINT_MC_VARIANT=ec` and provide the `ec` repo inside the container. + +By default `run.sh` looks for: +- `./ec/` (a checkout of the `ec` repository) + +It then runs an `ec`-provided runner script at `./ec/mint/run.sh` (relative to this directory). + +Override locations/behavior with: +- `MINT_MC_EC_REPO_DIR` (path to the checked out `ec` repo; default `./ec`) +- `MINT_MC_EC_RUNNER` (path to an executable runner script; default `./ec/mint/run.sh`) diff --git a/run/core/mc/run.sh b/run/core/mc/run.sh index 702db5b7..693887df 100755 --- a/run/core/mc/run.sh +++ b/run/core/mc/run.sh @@ -24,4 +24,28 @@ fi output_log_file="$1" error_log_file="$2" -./functional-tests.sh 1>>"$output_log_file" 2>"$error_log_file" +mc_variant="${MINT_MC_VARIANT:-mc}" + +case "$mc_variant" in +ec) + ec_repo_dir="${MINT_MC_EC_REPO_DIR:-./ec}" + ec_runner="${MINT_MC_EC_RUNNER:-${ec_repo_dir}/mint/run.sh}" + + if [ ! -f "$ec_runner" ]; then + echo "MINT_MC_VARIANT=ec but missing runner: $ec_runner" >&2 + echo "mount the ec repo at ./ec (so ${ec_repo_dir}/mint/run.sh exists) or set MINT_MC_EC_RUNNER" >&2 + exit 1 + fi + + # Use exec for the ec tests + exec bash "$ec_runner" "$output_log_file" "$error_log_file" + ;; +mc) + # Run upstream mc tests + ./functional-tests.sh 1>>"$output_log_file" 2>"$error_log_file" + ;; +*) + echo "unknown MINT_MC_VARIANT: $mc_variant (supported: mc, ec)" >&2 + exit 1 + ;; +esac