#!/usr/bin/env bash # shellcheck disable=SC2120 exit_1() { cleanup echo "minio1 ============" cat /tmp/minio1_1.log echo "minio2 ============" cat /tmp/minio2_1.log exit 1 } cleanup() { echo -n "Cleaning up instances of MinIO ..." pkill -9 minio || sudo pkill -9 minio rm -rf /tmp/minio{1,2} echo "done" } # Function to convert number to corresponding alphabet num_to_alpha() { local num=$1 # ASCII value of 'a' is 97, so we add (num - 1) to 97 to get the corresponding alphabet local ascii_value=$((96 + num)) # Convert the ASCII value to the character using printf printf "\\$(printf '%03o' "$ascii_value")" } cleanup export MINIO_CI_CD=1 export MINIO_BROWSER=off export MINIO_ROOT_USER="minio" export MINIO_ROOT_PASSWORD="minio123" # Download AWS CLI echo -n "Download and install AWS CLI" rm -rf /usr/local/aws-cli || sudo rm -rf /usr/local/aws-cli curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip -qq awscliv2.zip ./aws/install || sudo ./aws/install echo "done" # Add credentials to ~/.aws/credentials if ! [ -d ~/.aws ]; then mkdir -p ~/.aws fi cat >~/.aws/credentials </tmp/minio1_1.log 2>&1 & CI=on MINIO_ROOT_USER=minio MINIO_ROOT_PASSWORD=minio123 minio server --certs-dir /tmp/certs --address ":9002" --console-address ":11000" /tmp/minio2/{1...4}/disk{1...4} /tmp/minio2/{5...8}/disk{1...4} >/tmp/minio2_1.log 2>&1 & echo "done" if [ ! -f ./mc ]; then echo -n "Downloading MinIO client ..." wget -O mc https://dl.min.io/client/mc/release/linux-amd64/mc && chmod +x mc echo "done" fi export MC_HOST_minio1=https://minio:minio123@localhost:9001 export MC_HOST_minio2=https://minio:minio123@localhost:9002 ./mc ready minio1 --insecure ./mc ready minio2 --insecure # Prepare data for tests echo -n "Preparing test data ..." mkdir -p /tmp/data echo "Hello World" >/tmp/data/obj touch /tmp/data/mpartobj shred -s 500M /tmp/data/mpartobj echo "done" # Add replication site ./mc admin replicate add minio1 minio2 --insecure # sleep for replication to complete sleep 30 # Create bucket in source cluster echo "Create bucket in source MinIO instance" ./mc mb minio1/test-bucket --insecure # Load objects to source site echo "Loading objects to source MinIO instance" OBJ_CHKSUM=$(openssl dgst -sha256 -binary fileparts.json jq