cleanup scripts and apply shfmt (#17284)

This commit is contained in:
Harshavardhana 2023-05-25 22:07:25 -07:00 committed by GitHub
parent 615169c4ec
commit 4a425cbac1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 1456 additions and 1465 deletions

View File

@ -19,26 +19,13 @@ docker-compose -f minio-${MODE}.yaml up -d
sleep 5m sleep 5m
docker run --rm --net=host \ docker run --rm --net=host \
--name="mint-${MODE}-${JOB_NAME}" \ --name="mint-${MODE}-${JOB_NAME}" \
-e SERVER_ENDPOINT="127.0.0.1:9000" \ -e SERVER_ENDPOINT="127.0.0.1:9000" \
-e ACCESS_KEY="${ACCESS_KEY}" \ -e ACCESS_KEY="${ACCESS_KEY}" \
-e SECRET_KEY="${SECRET_KEY}" \ -e SECRET_KEY="${SECRET_KEY}" \
-e ENABLE_HTTPS=0 \ -e ENABLE_HTTPS=0 \
-e MINT_MODE="${MINT_MODE}" \ -e MINT_MODE="${MINT_MODE}" \
docker.io/minio/mint:edge \ docker.io/minio/mint:edge
aws-sdk-go \
aws-sdk-java \
aws-sdk-php \
aws-sdk-ruby \
awscli \
healthcheck \
mc \
minio-go \
minio-java \
minio-py \
s3cmd \
s3select \
versioning
docker-compose -f minio-${MODE}.yaml down || true docker-compose -f minio-${MODE}.yaml down || true
sleep 10s sleep 10s
@ -49,4 +36,3 @@ docker volume rm $(docker volume ls -f dangling=true) || true
## change working directory ## change working directory
cd ../../../ cd ../../../

22
.github/workflows/shfmt.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: Shell formatting checks
on:
pull_request:
branches:
- master
permissions:
contents: read
jobs:
build:
name: runner / shfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: luizm/action-sh-checker@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SHFMT_OPTS: "-s"
with:
sh_checker_shellcheck_disable: true # disable for now

View File

@ -3,19 +3,19 @@
_init() { _init() {
shopt -s extglob shopt -s extglob
## Minimum required versions for build dependencies ## Minimum required versions for build dependencies
GIT_VERSION="1.0" GIT_VERSION="1.0"
GO_VERSION="1.16" GO_VERSION="1.16"
OSX_VERSION="10.8" OSX_VERSION="10.8"
KNAME=$(uname -s) KNAME=$(uname -s)
ARCH=$(uname -m) ARCH=$(uname -m)
case "${KNAME}" in case "${KNAME}" in
SunOS ) SunOS)
ARCH=$(isainfo -k) ARCH=$(isainfo -k)
;; ;;
esac esac
} }
## FIXME: ## FIXME:
@ -28,24 +28,23 @@ _init() {
## } ## }
## ##
readlink() { readlink() {
TARGET_FILE=$1 TARGET_FILE=$1
cd `dirname $TARGET_FILE` cd $(dirname $TARGET_FILE)
TARGET_FILE=`basename $TARGET_FILE` TARGET_FILE=$(basename $TARGET_FILE)
# Iterate down a (possible) chain of symlinks # Iterate down a (possible) chain of symlinks
while [ -L "$TARGET_FILE" ] while [ -L "$TARGET_FILE" ]; do
do TARGET_FILE=$(env readlink $TARGET_FILE)
TARGET_FILE=$(env readlink $TARGET_FILE) cd $(dirname $TARGET_FILE)
cd `dirname $TARGET_FILE` TARGET_FILE=$(basename $TARGET_FILE)
TARGET_FILE=`basename $TARGET_FILE` done
done
# Compute the canonicalized name by finding the physical path # Compute the canonicalized name by finding the physical path
# for the directory we're in and appending the target file. # for the directory we're in and appending the target file.
PHYS_DIR=`pwd -P` PHYS_DIR=$(pwd -P)
RESULT=$PHYS_DIR/$TARGET_FILE RESULT=$PHYS_DIR/$TARGET_FILE
echo $RESULT echo $RESULT
} }
## FIXME: ## FIXME:
@ -59,84 +58,86 @@ readlink() {
## } ## }
## ##
check_minimum_version() { check_minimum_version() {
IFS='.' read -r -a varray1 <<< "$1" IFS='.' read -r -a varray1 <<<"$1"
IFS='.' read -r -a varray2 <<< "$2" IFS='.' read -r -a varray2 <<<"$2"
for i in "${!varray1[@]}"; do for i in "${!varray1[@]}"; do
if [[ ${varray1[i]} -lt ${varray2[i]} ]]; then if [[ ${varray1[i]} -lt ${varray2[i]} ]]; then
return 0 return 0
elif [[ ${varray1[i]} -gt ${varray2[i]} ]]; then elif [[ ${varray1[i]} -gt ${varray2[i]} ]]; then
return 1 return 1
fi fi
done done
return 0 return 0
} }
assert_is_supported_arch() { assert_is_supported_arch() {
case "${ARCH}" in case "${ARCH}" in
x86_64 | amd64 | aarch64 | ppc64le | arm* | s390x | loong64 | loongarch64 ) x86_64 | amd64 | aarch64 | ppc64le | arm* | s390x | loong64 | loongarch64)
return return
;; ;;
*) *)
echo "Arch '${ARCH}' is not supported. Supported Arch: [x86_64, amd64, aarch64, ppc64le, arm*, s390x, loong64, loongarch64]" echo "Arch '${ARCH}' is not supported. Supported Arch: [x86_64, amd64, aarch64, ppc64le, arm*, s390x, loong64, loongarch64]"
exit 1 exit 1
esac ;;
esac
} }
assert_is_supported_os() { assert_is_supported_os() {
case "${KNAME}" in case "${KNAME}" in
Linux | FreeBSD | OpenBSD | NetBSD | DragonFly | SunOS ) Linux | FreeBSD | OpenBSD | NetBSD | DragonFly | SunOS)
return return
;; ;;
Darwin ) Darwin)
osx_host_version=$(env sw_vers -productVersion) osx_host_version=$(env sw_vers -productVersion)
if ! check_minimum_version "${OSX_VERSION}" "${osx_host_version}"; then if ! check_minimum_version "${OSX_VERSION}" "${osx_host_version}"; then
echo "OSX version '${osx_host_version}' is not supported. Minimum supported version: ${OSX_VERSION}" echo "OSX version '${osx_host_version}' is not supported. Minimum supported version: ${OSX_VERSION}"
exit 1 exit 1
fi fi
return return
;; ;;
*) *)
echo "OS '${KNAME}' is not supported. Supported OS: [Linux, FreeBSD, OpenBSD, NetBSD, Darwin, DragonFly]" echo "OS '${KNAME}' is not supported. Supported OS: [Linux, FreeBSD, OpenBSD, NetBSD, Darwin, DragonFly]"
exit 1 exit 1
esac ;;
esac
} }
assert_check_golang_env() { assert_check_golang_env() {
if ! which go >/dev/null 2>&1; then if ! which go >/dev/null 2>&1; then
echo "Cannot find go binary in your PATH configuration, please refer to Go installation document at https://golang.org/doc/install" echo "Cannot find go binary in your PATH configuration, please refer to Go installation document at https://golang.org/doc/install"
exit 1 exit 1
fi fi
installed_go_version=$(go version | sed 's/^.* go\([0-9.]*\).*$/\1/') installed_go_version=$(go version | sed 's/^.* go\([0-9.]*\).*$/\1/')
if ! check_minimum_version "${GO_VERSION}" "${installed_go_version}"; then if ! check_minimum_version "${GO_VERSION}" "${installed_go_version}"; then
echo "Go runtime version '${installed_go_version}' is unsupported. Minimum supported version: ${GO_VERSION} to compile." echo "Go runtime version '${installed_go_version}' is unsupported. Minimum supported version: ${GO_VERSION} to compile."
exit 1 exit 1
fi fi
} }
assert_check_deps() { assert_check_deps() {
# support unusual Git versions such as: 2.7.4 (Apple Git-66) # support unusual Git versions such as: 2.7.4 (Apple Git-66)
installed_git_version=$(git version | perl -ne '$_ =~ m/git version (.*?)( |$)/; print "$1\n";') installed_git_version=$(git version | perl -ne '$_ =~ m/git version (.*?)( |$)/; print "$1\n";')
if ! check_minimum_version "${GIT_VERSION}" "${installed_git_version}"; then if ! check_minimum_version "${GIT_VERSION}" "${installed_git_version}"; then
echo "Git version '${installed_git_version}' is not supported. Minimum supported version: ${GIT_VERSION}" echo "Git version '${installed_git_version}' is not supported. Minimum supported version: ${GIT_VERSION}"
exit 1 exit 1
fi fi
} }
main() { main() {
## Check for supported arch ## Check for supported arch
assert_is_supported_arch assert_is_supported_arch
## Check for supported os ## Check for supported os
assert_is_supported_os assert_is_supported_os
## Check for Go environment ## Check for Go environment
assert_check_golang_env assert_check_golang_env
## Check for dependencies ## Check for dependencies
assert_check_deps assert_check_deps
} }
_init && main "$@" _init && main "$@"

View File

@ -5,33 +5,33 @@ set -e
[ -n "$BASH_XTRACEFD" ] && set -x [ -n "$BASH_XTRACEFD" ] && set -x
function _init() { function _init() {
## All binaries are static make sure to disable CGO. ## All binaries are static make sure to disable CGO.
export CGO_ENABLED=0 export CGO_ENABLED=0
## List of architectures and OS to test coss compilation. ## List of architectures and OS to test coss compilation.
SUPPORTED_OSARCH="linux/ppc64le linux/mips64 linux/amd64 linux/arm64 linux/s390x darwin/arm64 darwin/amd64 freebsd/amd64 windows/amd64 linux/arm linux/386 netbsd/amd64 linux/mips openbsd/amd64" SUPPORTED_OSARCH="linux/ppc64le linux/mips64 linux/amd64 linux/arm64 linux/s390x darwin/arm64 darwin/amd64 freebsd/amd64 windows/amd64 linux/arm linux/386 netbsd/amd64 linux/mips openbsd/amd64"
} }
function _build() { function _build() {
local osarch=$1 local osarch=$1
IFS=/ read -r -a arr <<<"$osarch" IFS=/ read -r -a arr <<<"$osarch"
os="${arr[0]}" os="${arr[0]}"
arch="${arr[1]}" arch="${arr[1]}"
package=$(go list -f '{{.ImportPath}}') package=$(go list -f '{{.ImportPath}}')
printf -- "--> %15s:%s\n" "${osarch}" "${package}" printf -- "--> %15s:%s\n" "${osarch}" "${package}"
# go build -trimpath to build the binary. # go build -trimpath to build the binary.
export GOOS=$os export GOOS=$os
export GOARCH=$arch export GOARCH=$arch
export GO111MODULE=on export GO111MODULE=on
go build -trimpath -tags kqueue -o /dev/null go build -trimpath -tags kqueue -o /dev/null
} }
function main() { function main() {
echo "Testing builds for OS/Arch: ${SUPPORTED_OSARCH}" echo "Testing builds for OS/Arch: ${SUPPORTED_OSARCH}"
for each_osarch in ${SUPPORTED_OSARCH}; do for each_osarch in ${SUPPORTED_OSARCH}; do
_build "${each_osarch}" _build "${each_osarch}"
done done
} }
_init && main "$@" _init && main "$@"

View File

@ -12,21 +12,21 @@ nr_servers=4
addr="localhost" addr="localhost"
args="" args=""
for ((i=0;i<$[${nr_servers}];i++)); do for ((i = 0; i < $((nr_servers)); i++)); do
args="$args $scheme://$addr:$[9100+$i]/${HOME}/tmp/dist/path1/$i" args="$args $scheme://$addr:$((9100 + i))/${HOME}/tmp/dist/path1/$i"
done done
echo $args echo $args
for ((i=0;i<$[${nr_servers}];i++)); do for ((i = 0; i < $((nr_servers)); i++)); do
(minio server --address ":$[9100+$i]" $args 2>&1 > /tmp/log$i.txt) & (minio server --address ":$((9100 + i))" $args 2>&1 >/tmp/log$i.txt) &
done done
sleep 10s sleep 10s
if [ ! -f ./mc ]; then if [ ! -f ./mc ]; then
wget --quiet -O ./mc https://dl.minio.io/client/mc/release/linux-amd64/./mc && \ wget --quiet -O ./mc https://dl.minio.io/client/mc/release/linux-amd64/./mc &&
chmod +x mc chmod +x mc
fi fi
set +e set +e
@ -41,8 +41,8 @@ sleep 3s # let things settle a little
./mc ls minioadm/ ./mc ls minioadm/
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "listing succeeded, 'minioadmin' was not disabled" echo "listing succeeded, 'minioadmin' was not disabled"
exit 1 exit 1
fi fi
set -e set -e
@ -50,16 +50,16 @@ set -e
killall -9 minio killall -9 minio
export MINIO_API_ROOT_ACCESS=on export MINIO_API_ROOT_ACCESS=on
for ((i=0;i<$[${nr_servers}];i++)); do for ((i = 0; i < $((nr_servers)); i++)); do
(minio server --address ":$[9100+$i]" $args 2>&1 > /tmp/log$i.txt) & (minio server --address ":$((9100 + i))" $args 2>&1 >/tmp/log$i.txt) &
done done
set +e set +e
./mc ls minioadm/ ./mc ls minioadm/
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "listing failed, 'minioadmin' should be enabled" echo "listing failed, 'minioadmin' should be enabled"
exit 1 exit 1
fi fi
killall -9 minio killall -9 minio
@ -70,14 +70,14 @@ rm -rf /tmp/multisiteb/
echo "Setup site-replication and then disable root credentials" echo "Setup site-replication and then disable root credentials"
minio server --address 127.0.0.1:9001 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9001 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_1.log 2>&1 & "http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_1.log 2>&1 &
minio server --address 127.0.0.1:9002 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9002 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_2.log 2>&1 & "http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_2.log 2>&1 &
minio server --address 127.0.0.1:9003 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9003 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_1.log 2>&1 & "http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_1.log 2>&1 &
minio server --address 127.0.0.1:9004 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9004 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_2.log 2>&1 & "http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_2.log 2>&1 &
sleep 20s sleep 20s
@ -98,14 +98,14 @@ echo "turning off root access, however site replication must continue"
export MINIO_API_ROOT_ACCESS=off export MINIO_API_ROOT_ACCESS=off
minio server --address 127.0.0.1:9001 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9001 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_1.log 2>&1 & "http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_1.log 2>&1 &
minio server --address 127.0.0.1:9002 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9002 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_2.log 2>&1 & "http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_2.log 2>&1 &
minio server --address 127.0.0.1:9003 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9003 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_1.log 2>&1 & "http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_1.log 2>&1 &
minio server --address 127.0.0.1:9004 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9004 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_2.log 2>&1 & "http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_2.log 2>&1 &
sleep 20s sleep 20s

View File

@ -6,88 +6,87 @@ set -x
WORK_DIR="$PWD/.verify-$RANDOM" WORK_DIR="$PWD/.verify-$RANDOM"
MINIO_CONFIG_DIR="$WORK_DIR/.minio" MINIO_CONFIG_DIR="$WORK_DIR/.minio"
MINIO=( "$PWD/minio" --config-dir "$MINIO_CONFIG_DIR" server ) MINIO=("$PWD/minio" --config-dir "$MINIO_CONFIG_DIR" server)
if [ ! -x "$PWD/minio" ]; then if [ ! -x "$PWD/minio" ]; then
echo "minio executable binary not found in current directory" echo "minio executable binary not found in current directory"
exit 1 exit 1
fi fi
if [ ! -x "$PWD/minio" ]; then if [ ! -x "$PWD/minio" ]; then
echo "minio executable binary not found in current directory" echo "minio executable binary not found in current directory"
exit 1 exit 1
fi fi
function start_minio_4drive() { function start_minio_4drive() {
start_port=$1 start_port=$1
export MINIO_ROOT_USER=minio export MINIO_ROOT_USER=minio
export MINIO_ROOT_PASSWORD=minio123 export MINIO_ROOT_PASSWORD=minio123
export MC_HOST_minio="http://minio:minio123@127.0.0.1:${start_port}/" export MC_HOST_minio="http://minio:minio123@127.0.0.1:${start_port}/"
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
export MINIO_CI_CD=1 export MINIO_CI_CD=1
mkdir ${WORK_DIR} mkdir ${WORK_DIR}
C_PWD=${PWD} C_PWD=${PWD}
if [ ! -x "$PWD/mc" ]; then if [ ! -x "$PWD/mc" ]; then
MC_BUILD_DIR="mc-$RANDOM" MC_BUILD_DIR="mc-$RANDOM"
if ! git clone --quiet https://github.com/minio/mc "$MC_BUILD_DIR"; then if ! git clone --quiet https://github.com/minio/mc "$MC_BUILD_DIR"; then
echo "failed to download https://github.com/minio/mc" echo "failed to download https://github.com/minio/mc"
purge "${MC_BUILD_DIR}" purge "${MC_BUILD_DIR}"
exit 1 exit 1
fi
(cd "${MC_BUILD_DIR}" && go build -o "$C_PWD/mc")
# remove mc source.
purge "${MC_BUILD_DIR}"
fi fi
(cd "${MC_BUILD_DIR}" && go build -o "$C_PWD/mc") "${MINIO[@]}" --address ":$start_port" "${WORK_DIR}/disk{1...4}" >"${WORK_DIR}/server1.log" 2>&1 &
pid=$!
disown $pid
sleep 5
# remove mc source. if ! ps -p ${pid} 1>&2 >/dev/null; then
purge "${MC_BUILD_DIR}" echo "server1 log:"
fi cat "${WORK_DIR}/server1.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
"${MINIO[@]}" --address ":$start_port" "${WORK_DIR}/disk{1...4}" > "${WORK_DIR}/server1.log" 2>&1 & "${PWD}/mc" mb --with-versioning minio/bucket
pid=$!
disown $pid
sleep 5
if ! ps -p ${pid} 1>&2 >/dev/null; then for i in $(seq 1 4); do
echo "server1 log:" "${PWD}/mc" cp /etc/hosts minio/bucket/testobj
cat "${WORK_DIR}/server1.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
"${PWD}/mc" mb --with-versioning minio/bucket sudo chown -R root. "${WORK_DIR}/disk${i}"
for i in $(seq 1 4); do "${PWD}/mc" cp /etc/hosts minio/bucket/testobj
"${PWD}/mc" cp /etc/hosts minio/bucket/testobj
sudo chown -R root. "${WORK_DIR}/disk${i}" sudo chown -R ${USER}. "${WORK_DIR}/disk${i}"
done
"${PWD}/mc" cp /etc/hosts minio/bucket/testobj for vid in $("${PWD}/mc" ls --json --versions minio/bucket/testobj | jq -r .versionId); do
"${PWD}/mc" cat --vid "${vid}" minio/bucket/testobj | md5sum
done
sudo chown -R ${USER}. "${WORK_DIR}/disk${i}" pkill minio
done sleep 3
for vid in $("${PWD}/mc" ls --json --versions minio/bucket/testobj | jq -r .versionId); do
"${PWD}/mc" cat --vid "${vid}" minio/bucket/testobj | md5sum
done
pkill minio
sleep 3
} }
function main() { function main() {
start_port=$(shuf -i 10000-65000 -n 1) start_port=$(shuf -i 10000-65000 -n 1)
start_minio_4drive ${start_port} start_minio_4drive ${start_port}
} }
function purge() function purge() {
{ rm -rf "$1"
rm -rf "$1"
} }
( main "$@" ) (main "$@")
rv=$? rv=$?
purge "$WORK_DIR" purge "$WORK_DIR"
exit "$rv" exit "$rv"

View File

@ -4,89 +4,89 @@ trap 'cleanup $LINENO' ERR
# shellcheck disable=SC2120 # shellcheck disable=SC2120
cleanup() { cleanup() {
MINIO_VERSION=dev docker-compose \ MINIO_VERSION=dev docker-compose \
-f "buildscripts/upgrade-tests/compose.yml" \ -f "buildscripts/upgrade-tests/compose.yml" \
rm -s -f rm -s -f
docker volume prune -f docker volume prune -f
} }
verify_checksum_after_heal() { verify_checksum_after_heal() {
local sum1 local sum1
sum1=$(curl -s "$2" | sha256sum); sum1=$(curl -s "$2" | sha256sum)
mc admin heal --json -r "$1" >/dev/null; # test after healing mc admin heal --json -r "$1" >/dev/null # test after healing
local sum1_heal local sum1_heal
sum1_heal=$(curl -s "$2" | sha256sum); sum1_heal=$(curl -s "$2" | sha256sum)
if [ "${sum1_heal}" != "${sum1}" ]; then if [ "${sum1_heal}" != "${sum1}" ]; then
echo "mismatch expected ${sum1_heal}, got ${sum1}" echo "mismatch expected ${sum1_heal}, got ${sum1}"
exit 1; exit 1
fi fi
} }
verify_checksum_mc() { verify_checksum_mc() {
local expected local expected
expected=$(mc cat "$1" | sha256sum) expected=$(mc cat "$1" | sha256sum)
local got local got
got=$(mc cat "$2" | sha256sum) got=$(mc cat "$2" | sha256sum)
if [ "${expected}" != "${got}" ]; then if [ "${expected}" != "${got}" ]; then
echo "mismatch - expected ${expected}, got ${got}" echo "mismatch - expected ${expected}, got ${got}"
exit 1; exit 1
fi fi
echo "matches - ${expected}, got ${got}" echo "matches - ${expected}, got ${got}"
} }
add_alias() { add_alias() {
for i in $(seq 1 4); do for i in $(seq 1 4); do
echo "... attempting to add alias $i" echo "... attempting to add alias $i"
until (mc alias set minio http://127.0.0.1:9000 minioadmin minioadmin); do until (mc alias set minio http://127.0.0.1:9000 minioadmin minioadmin); do
echo "...waiting... for 5secs" && sleep 5 echo "...waiting... for 5secs" && sleep 5
done done
done done
echo "Sleeping for nginx" echo "Sleeping for nginx"
sleep 20 sleep 20
} }
__init__() { __init__() {
sudo apt install curl -y sudo apt install curl -y
export GOPATH=/tmp/gopath export GOPATH=/tmp/gopath
export PATH=${PATH}:${GOPATH}/bin export PATH=${PATH}:${GOPATH}/bin
go install github.com/minio/mc@latest go install github.com/minio/mc@latest
TAG=minio/minio:dev make docker TAG=minio/minio:dev make docker
MINIO_VERSION=RELEASE.2019-12-19T22-52-26Z docker-compose \ MINIO_VERSION=RELEASE.2019-12-19T22-52-26Z docker-compose \
-f "buildscripts/upgrade-tests/compose.yml" \ -f "buildscripts/upgrade-tests/compose.yml" \
up -d --build up -d --build
add_alias add_alias
mc mb minio/minio-test/ mc mb minio/minio-test/
mc cp ./minio minio/minio-test/to-read/ mc cp ./minio minio/minio-test/to-read/
mc cp /etc/hosts minio/minio-test/to-read/hosts mc cp /etc/hosts minio/minio-test/to-read/hosts
mc anonymous set download minio/minio-test mc anonymous set download minio/minio-test
verify_checksum_mc ./minio minio/minio-test/to-read/minio verify_checksum_mc ./minio minio/minio-test/to-read/minio
curl -s http://127.0.0.1:9000/minio-test/to-read/hosts | sha256sum curl -s http://127.0.0.1:9000/minio-test/to-read/hosts | sha256sum
MINIO_VERSION=dev docker-compose -f "buildscripts/upgrade-tests/compose.yml" stop MINIO_VERSION=dev docker-compose -f "buildscripts/upgrade-tests/compose.yml" stop
} }
main() { main() {
MINIO_VERSION=dev docker-compose -f "buildscripts/upgrade-tests/compose.yml" up -d --build MINIO_VERSION=dev docker-compose -f "buildscripts/upgrade-tests/compose.yml" up -d --build
add_alias add_alias
verify_checksum_after_heal minio/minio-test http://127.0.0.1:9000/minio-test/to-read/hosts verify_checksum_after_heal minio/minio-test http://127.0.0.1:9000/minio-test/to-read/hosts
verify_checksum_mc ./minio minio/minio-test/to-read/minio verify_checksum_mc ./minio minio/minio-test/to-read/minio
verify_checksum_mc /etc/hosts minio/minio-test/to-read/hosts verify_checksum_mc /etc/hosts minio/minio-test/to-read/hosts
cleanup cleanup
} }
( __init__ "$@" && main "$@" ) (__init__ "$@" && main "$@")

View File

@ -6,5 +6,5 @@ export GORACE="history_size=7"
export MINIO_API_REQUESTS_MAX=10000 export MINIO_API_REQUESTS_MAX=10000
for d in $(go list ./...); do for d in $(go list ./...); do
CGO_ENABLED=1 go test -v -race --timeout 100m "$d" CGO_ENABLED=1 go test -v -race --timeout 100m "$d"
done done

View File

@ -6,67 +6,66 @@ set -x
WORK_DIR="$PWD/.verify-$RANDOM" WORK_DIR="$PWD/.verify-$RANDOM"
MINIO_CONFIG_DIR="$WORK_DIR/.minio" MINIO_CONFIG_DIR="$WORK_DIR/.minio"
MINIO=( "$PWD/minio" --config-dir "$MINIO_CONFIG_DIR" server ) MINIO=("$PWD/minio" --config-dir "$MINIO_CONFIG_DIR" server)
if [ ! -x "$PWD/minio" ]; then if [ ! -x "$PWD/minio" ]; then
echo "minio executable binary not found in current directory" echo "minio executable binary not found in current directory"
exit 1 exit 1
fi fi
function start_minio_5drive() { function start_minio_5drive() {
start_port=$1 start_port=$1
export MINIO_ROOT_USER=minio export MINIO_ROOT_USER=minio
export MINIO_ROOT_PASSWORD=minio123 export MINIO_ROOT_PASSWORD=minio123
export MC_HOST_minio="http://minio:minio123@127.0.0.1:${start_port}/" export MC_HOST_minio="http://minio:minio123@127.0.0.1:${start_port}/"
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
export MINIO_CI_CD=1 export MINIO_CI_CD=1
MC_BUILD_DIR="mc-$RANDOM" MC_BUILD_DIR="mc-$RANDOM"
if ! git clone --quiet https://github.com/minio/mc "$MC_BUILD_DIR"; then if ! git clone --quiet https://github.com/minio/mc "$MC_BUILD_DIR"; then
echo "failed to download https://github.com/minio/mc" echo "failed to download https://github.com/minio/mc"
purge "${MC_BUILD_DIR}"
exit 1
fi
(cd "${MC_BUILD_DIR}" && go build -o "$WORK_DIR/mc")
# remove mc source.
purge "${MC_BUILD_DIR}" purge "${MC_BUILD_DIR}"
exit 1
fi
(cd "${MC_BUILD_DIR}" && go build -o "$WORK_DIR/mc") "${WORK_DIR}/mc" cp --quiet -r "buildscripts/cicd-corpus/" "${WORK_DIR}/cicd-corpus/"
# remove mc source. "${MINIO[@]}" --address ":$start_port" "${WORK_DIR}/cicd-corpus/disk{1...5}" >"${WORK_DIR}/server1.log" 2>&1 &
purge "${MC_BUILD_DIR}" pid=$!
disown $pid
sleep 5
"${WORK_DIR}/mc" cp --quiet -r "buildscripts/cicd-corpus/" "${WORK_DIR}/cicd-corpus/" if ! ps -p ${pid} 1>&2 >/dev/null; then
echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
"${MINIO[@]}" --address ":$start_port" "${WORK_DIR}/cicd-corpus/disk{1...5}" > "${WORK_DIR}/server1.log" 2>&1 & "${WORK_DIR}/mc" stat minio/bucket/testobj
pid=$!
disown $pid
sleep 5
if ! ps -p ${pid} 1>&2 >/dev/null; then pkill minio
echo "server1 log:" sleep 3
cat "${WORK_DIR}/server1.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
"${WORK_DIR}/mc" stat minio/bucket/testobj
pkill minio
sleep 3
} }
function main() { function main() {
start_port=$(shuf -i 10000-65000 -n 1) start_port=$(shuf -i 10000-65000 -n 1)
start_minio_5drive ${start_port} start_minio_5drive ${start_port}
} }
function purge() function purge() {
{ rm -rf "$1"
rm -rf "$1"
} }
( main "$@" ) (main "$@")
rv=$? rv=$?
purge "$WORK_DIR" purge "$WORK_DIR"
exit "$rv" exit "$rv"

View File

@ -6,146 +6,151 @@ set -x
WORK_DIR="$PWD/.verify-$RANDOM" WORK_DIR="$PWD/.verify-$RANDOM"
MINIO_CONFIG_DIR="$WORK_DIR/.minio" MINIO_CONFIG_DIR="$WORK_DIR/.minio"
MINIO_OLD=( "$PWD/minio.RELEASE.2020-10-28T08-16-50Z" --config-dir "$MINIO_CONFIG_DIR" server ) MINIO_OLD=("$PWD/minio.RELEASE.2020-10-28T08-16-50Z" --config-dir "$MINIO_CONFIG_DIR" server)
MINIO=( "$PWD/minio" --config-dir "$MINIO_CONFIG_DIR" server ) MINIO=("$PWD/minio" --config-dir "$MINIO_CONFIG_DIR" server)
if [ ! -x "$PWD/minio" ]; then if [ ! -x "$PWD/minio" ]; then
echo "minio executable binary not found in current directory" echo "minio executable binary not found in current directory"
exit 1 exit 1
fi fi
function download_old_release() { function download_old_release() {
if [ ! -f minio.RELEASE.2020-10-28T08-16-50Z ]; then if [ ! -f minio.RELEASE.2020-10-28T08-16-50Z ]; then
curl --silent -O https://dl.minio.io/server/minio/release/linux-amd64/archive/minio.RELEASE.2020-10-28T08-16-50Z curl --silent -O https://dl.minio.io/server/minio/release/linux-amd64/archive/minio.RELEASE.2020-10-28T08-16-50Z
chmod a+x minio.RELEASE.2020-10-28T08-16-50Z chmod a+x minio.RELEASE.2020-10-28T08-16-50Z
fi fi
} }
function verify_rewrite() { function verify_rewrite() {
start_port=$1 start_port=$1
export MINIO_ACCESS_KEY=minio export MINIO_ACCESS_KEY=minio
export MINIO_SECRET_KEY=minio123 export MINIO_SECRET_KEY=minio123
export MC_HOST_minio="http://minio:minio123@127.0.0.1:${start_port}/" export MC_HOST_minio="http://minio:minio123@127.0.0.1:${start_port}/"
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
export MINIO_CI_CD=1 export MINIO_CI_CD=1
MC_BUILD_DIR="mc-$RANDOM" MC_BUILD_DIR="mc-$RANDOM"
if ! git clone --quiet https://github.com/minio/mc "$MC_BUILD_DIR"; then if ! git clone --quiet https://github.com/minio/mc "$MC_BUILD_DIR"; then
echo "failed to download https://github.com/minio/mc" echo "failed to download https://github.com/minio/mc"
purge "${MC_BUILD_DIR}"
exit 1
fi
(cd "${MC_BUILD_DIR}" && go build -o "$WORK_DIR/mc")
# remove mc source.
purge "${MC_BUILD_DIR}" purge "${MC_BUILD_DIR}"
exit 1
fi
(cd "${MC_BUILD_DIR}" && go build -o "$WORK_DIR/mc") "${MINIO_OLD[@]}" --address ":$start_port" "${WORK_DIR}/xl{1...16}" >"${WORK_DIR}/server1.log" 2>&1 &
pid=$!
disown $pid
sleep 10
# remove mc source. if ! ps -p ${pid} 1>&2 >/dev/null; then
purge "${MC_BUILD_DIR}" echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
"${MINIO_OLD[@]}" --address ":$start_port" "${WORK_DIR}/xl{1...16}" > "${WORK_DIR}/server1.log" 2>&1 & "${WORK_DIR}/mc" mb minio/healing-rewrite-bucket --quiet --with-lock
pid=$! "${WORK_DIR}/mc" cp \
disown $pid buildscripts/verify-build.sh \
sleep 10 minio/healing-rewrite-bucket/ \
--disable-multipart --quiet
if ! ps -p ${pid} 1>&2 >/dev/null; then "${WORK_DIR}/mc" cp \
echo "server1 log:" buildscripts/verify-build.sh \
cat "${WORK_DIR}/server1.log" minio/healing-rewrite-bucket/ \
echo "FAILED" --disable-multipart --quiet
purge "$WORK_DIR"
exit 1
fi
"${WORK_DIR}/mc" mb minio/healing-rewrite-bucket --quiet --with-lock "${WORK_DIR}/mc" cp \
"${WORK_DIR}/mc" cp \ buildscripts/verify-build.sh \
buildscripts/verify-build.sh \ minio/healing-rewrite-bucket/ \
minio/healing-rewrite-bucket/ \ --disable-multipart --quiet
--disable-multipart --quiet
"${WORK_DIR}/mc" cp \ kill ${pid}
buildscripts/verify-build.sh \ sleep 3
minio/healing-rewrite-bucket/ \
--disable-multipart --quiet
"${WORK_DIR}/mc" cp \ "${MINIO[@]}" --address ":$start_port" "${WORK_DIR}/xl{1...16}" >"${WORK_DIR}/server1.log" 2>&1 &
buildscripts/verify-build.sh \ pid=$!
minio/healing-rewrite-bucket/ \ disown $pid
--disable-multipart --quiet sleep 10
kill ${pid} if ! ps -p ${pid} 1>&2 >/dev/null; then
sleep 3 echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
"${MINIO[@]}" --address ":$start_port" "${WORK_DIR}/xl{1...16}" > "${WORK_DIR}/server1.log" 2>&1 & go build ./docs/debugging/s3-check-md5/
pid=$! if ! ./s3-check-md5 \
disown $pid -debug \
sleep 10 -versions \
-access-key minio \
-secret-key minio123 \
-endpoint http://127.0.0.1:${start_port}/ 2>&1 | grep INTACT; then
echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
mkdir -p inspects
(
cd inspects
"${WORK_DIR}/mc" admin inspect minio/healing-rewrite-bucket/verify-build.sh/**
)
if ! ps -p ${pid} 1>&2 >/dev/null; then "${WORK_DIR}/mc" mb play/inspects
echo "server1 log:" "${WORK_DIR}/mc" mirror inspects play/inspects
cat "${WORK_DIR}/server1.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
go build ./docs/debugging/s3-check-md5/ purge "$WORK_DIR"
if ! ./s3-check-md5 \ exit 1
-debug \ fi
-versions \
-access-key minio \
-secret-key minio123 \
-endpoint http://127.0.0.1:${start_port}/ 2>&1 | grep INTACT; then
echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
mkdir -p inspects
(cd inspects; "${WORK_DIR}/mc" admin inspect minio/healing-rewrite-bucket/verify-build.sh/**)
"${WORK_DIR}/mc" mb play/inspects go run ./buildscripts/heal-manual.go "127.0.0.1:${start_port}" "minio" "minio123"
"${WORK_DIR}/mc" mirror inspects play/inspects sleep 1
purge "$WORK_DIR" if ! ./s3-check-md5 \
exit 1 -debug \
fi -versions \
-access-key minio \
-secret-key minio123 \
-endpoint http://127.0.0.1:${start_port}/ 2>&1 | grep INTACT; then
echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
mkdir -p inspects
(
cd inspects
"${WORK_DIR}/mc" admin inspect minio/healing-rewrite-bucket/verify-build.sh/**
)
go run ./buildscripts/heal-manual.go "127.0.0.1:${start_port}" "minio" "minio123" "${WORK_DIR}/mc" mb play/inspects
sleep 1 "${WORK_DIR}/mc" mirror inspects play/inspects
if ! ./s3-check-md5 \ purge "$WORK_DIR"
-debug \ exit 1
-versions \ fi
-access-key minio \
-secret-key minio123 \
-endpoint http://127.0.0.1:${start_port}/ 2>&1 | grep INTACT; then
echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
mkdir -p inspects
(cd inspects; "${WORK_DIR}/mc" admin inspect minio/healing-rewrite-bucket/verify-build.sh/**)
"${WORK_DIR}/mc" mb play/inspects kill ${pid}
"${WORK_DIR}/mc" mirror inspects play/inspects
purge "$WORK_DIR"
exit 1
fi
kill ${pid}
} }
function main() { function main() {
download_old_release download_old_release
start_port=$(shuf -i 10000-65000 -n 1) start_port=$(shuf -i 10000-65000 -n 1)
verify_rewrite ${start_port} verify_rewrite ${start_port}
} }
function purge() function purge() {
{ rm -rf "$1"
rm -rf "$1"
} }
( main "$@" ) (main "$@")
rv=$? rv=$?
purge "$WORK_DIR" purge "$WORK_DIR"
exit "$rv" exit "$rv"

View File

@ -6,167 +6,172 @@ set -o pipefail
set -x set -x
if [ ! -x "$PWD/minio" ]; then if [ ! -x "$PWD/minio" ]; then
echo "minio executable binary not found in current directory" echo "minio executable binary not found in current directory"
exit 1 exit 1
fi fi
WORK_DIR="$PWD/.verify-$RANDOM" WORK_DIR="$PWD/.verify-$RANDOM"
MINIO_CONFIG_DIR="$WORK_DIR/.minio" MINIO_CONFIG_DIR="$WORK_DIR/.minio"
MINIO_OLD=( "$PWD/minio.RELEASE.2021-11-24T23-19-33Z" --config-dir "$MINIO_CONFIG_DIR" server ) MINIO_OLD=("$PWD/minio.RELEASE.2021-11-24T23-19-33Z" --config-dir "$MINIO_CONFIG_DIR" server)
MINIO=( "$PWD/minio" --config-dir "$MINIO_CONFIG_DIR" server ) MINIO=("$PWD/minio" --config-dir "$MINIO_CONFIG_DIR" server)
function download_old_release() { function download_old_release() {
if [ ! -f minio.RELEASE.2021-11-24T23-19-33Z ]; then if [ ! -f minio.RELEASE.2021-11-24T23-19-33Z ]; then
curl --silent -O https://dl.minio.io/server/minio/release/linux-amd64/archive/minio.RELEASE.2021-11-24T23-19-33Z curl --silent -O https://dl.minio.io/server/minio/release/linux-amd64/archive/minio.RELEASE.2021-11-24T23-19-33Z
chmod a+x minio.RELEASE.2021-11-24T23-19-33Z chmod a+x minio.RELEASE.2021-11-24T23-19-33Z
fi fi
} }
function start_minio_16drive() { function start_minio_16drive() {
start_port=$1 start_port=$1
export MINIO_ROOT_USER=minio export MINIO_ROOT_USER=minio
export MINIO_ROOT_PASSWORD=minio123 export MINIO_ROOT_PASSWORD=minio123
export MC_HOST_minio="http://minio:minio123@127.0.0.1:${start_port}/" export MC_HOST_minio="http://minio:minio123@127.0.0.1:${start_port}/"
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
export _MINIO_SHARD_DISKTIME_DELTA="5s" # do not change this as its needed for tests export _MINIO_SHARD_DISKTIME_DELTA="5s" # do not change this as its needed for tests
export MINIO_CI_CD=1 export MINIO_CI_CD=1
MC_BUILD_DIR="mc-$RANDOM" MC_BUILD_DIR="mc-$RANDOM"
if ! git clone --quiet https://github.com/minio/mc "$MC_BUILD_DIR"; then if ! git clone --quiet https://github.com/minio/mc "$MC_BUILD_DIR"; then
echo "failed to download https://github.com/minio/mc" echo "failed to download https://github.com/minio/mc"
purge "${MC_BUILD_DIR}"
exit 1
fi
(cd "${MC_BUILD_DIR}" && go build -o "$WORK_DIR/mc")
# remove mc source.
purge "${MC_BUILD_DIR}" purge "${MC_BUILD_DIR}"
exit 1
fi
(cd "${MC_BUILD_DIR}" && go build -o "$WORK_DIR/mc") "${MINIO_OLD[@]}" --address ":$start_port" "${WORK_DIR}/xl{1...16}" >"${WORK_DIR}/server1.log" 2>&1 &
pid=$!
disown $pid
sleep 30
# remove mc source. if ! ps -p ${pid} 1>&2 >/dev/null; then
purge "${MC_BUILD_DIR}" echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
"${MINIO_OLD[@]}" --address ":$start_port" "${WORK_DIR}/xl{1...16}" > "${WORK_DIR}/server1.log" 2>&1 & shred --iterations=1 --size=5241856 - 1>"${WORK_DIR}/unaligned" 2>/dev/null
pid=$! "${WORK_DIR}/mc" mb minio/healing-shard-bucket --quiet
disown $pid "${WORK_DIR}/mc" cp \
sleep 30 "${WORK_DIR}/unaligned" \
minio/healing-shard-bucket/unaligned \
--disable-multipart --quiet
if ! ps -p ${pid} 1>&2 >/dev/null; then ## "unaligned" object name gets consistently distributed
echo "server1 log:" ## to disks in following distribution order
cat "${WORK_DIR}/server1.log" ##
echo "FAILED" ## NOTE: if you change the name make sure to change the
purge "$WORK_DIR" ## distribution order present here
exit 1 ##
fi ## [15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
shred --iterations=1 --size=5241856 - 1>"${WORK_DIR}/unaligned" 2>/dev/null ## make sure to remove the "last" data shard
"${WORK_DIR}/mc" mb minio/healing-shard-bucket --quiet rm -rf "${WORK_DIR}/xl14/healing-shard-bucket/unaligned"
"${WORK_DIR}/mc" cp \ sleep 10
"${WORK_DIR}/unaligned" \ ## Heal the shard
minio/healing-shard-bucket/unaligned \ "${WORK_DIR}/mc" admin heal --quiet --recursive minio/healing-shard-bucket
--disable-multipart --quiet ## then remove any other data shard let's pick first disk
## - 1st data shard.
rm -rf "${WORK_DIR}/xl3/healing-shard-bucket/unaligned"
sleep 10
## "unaligned" object name gets consistently distributed go build ./docs/debugging/s3-check-md5/
## to disks in following distribution order if ! ./s3-check-md5 \
## -debug \
## NOTE: if you change the name make sure to change the -access-key minio \
## distribution order present here -secret-key minio123 \
## -endpoint http://127.0.0.1:${start_port}/ 2>&1 | grep CORRUPTED; then
## [15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
## make sure to remove the "last" data shard pkill minio
rm -rf "${WORK_DIR}/xl14/healing-shard-bucket/unaligned" sleep 3
sleep 10
## Heal the shard
"${WORK_DIR}/mc" admin heal --quiet --recursive minio/healing-shard-bucket
## then remove any other data shard let's pick first disk
## - 1st data shard.
rm -rf "${WORK_DIR}/xl3/healing-shard-bucket/unaligned"
sleep 10
go build ./docs/debugging/s3-check-md5/ "${MINIO[@]}" --address ":$start_port" "${WORK_DIR}/xl{1...16}" >"${WORK_DIR}/server1.log" 2>&1 &
if ! ./s3-check-md5 \ pid=$!
-debug \ disown $pid
-access-key minio \ sleep 30
-secret-key minio123 \
-endpoint http://127.0.0.1:${start_port}/ 2>&1 | grep CORRUPTED; then
echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
pkill minio if ! ps -p ${pid} 1>&2 >/dev/null; then
sleep 3 echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
"${MINIO[@]}" --address ":$start_port" "${WORK_DIR}/xl{1...16}" > "${WORK_DIR}/server1.log" 2>&1 & if ! ./s3-check-md5 \
pid=$! -debug \
disown $pid -access-key minio \
sleep 30 -secret-key minio123 \
-endpoint http://127.0.0.1:${start_port}/ 2>&1 | grep INTACT; then
echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
mkdir -p inspects
(
cd inspects
"${WORK_DIR}/mc" support inspect minio/healing-shard-bucket/unaligned/**
)
if ! ps -p ${pid} 1>&2 >/dev/null; then "${WORK_DIR}/mc" mb play/inspects
echo "server1 log:" "${WORK_DIR}/mc" mirror inspects play/inspects
cat "${WORK_DIR}/server1.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
if ! ./s3-check-md5 \ purge "$WORK_DIR"
-debug \ exit 1
-access-key minio \ fi
-secret-key minio123 \
-endpoint http://127.0.0.1:${start_port}/ 2>&1 | grep INTACT; then
echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
mkdir -p inspects
(cd inspects; "${WORK_DIR}/mc" support inspect minio/healing-shard-bucket/unaligned/**)
"${WORK_DIR}/mc" mb play/inspects "${WORK_DIR}/mc" admin heal --quiet --recursive minio/healing-shard-bucket
"${WORK_DIR}/mc" mirror inspects play/inspects
purge "$WORK_DIR" if ! ./s3-check-md5 \
exit 1 -debug \
fi -access-key minio \
-secret-key minio123 \
-endpoint http://127.0.0.1:${start_port}/ 2>&1 | grep INTACT; then
echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
mkdir -p inspects
(
cd inspects
"${WORK_DIR}/mc" support inspect minio/healing-shard-bucket/unaligned/**
)
"${WORK_DIR}/mc" admin heal --quiet --recursive minio/healing-shard-bucket "${WORK_DIR}/mc" mb play/inspects
"${WORK_DIR}/mc" mirror inspects play/inspects
if ! ./s3-check-md5 \ purge "$WORK_DIR"
-debug \ exit 1
-access-key minio \ fi
-secret-key minio123 \
-endpoint http://127.0.0.1:${start_port}/ 2>&1 | grep INTACT; then
echo "server1 log:"
cat "${WORK_DIR}/server1.log"
echo "FAILED"
mkdir -p inspects
(cd inspects; "${WORK_DIR}/mc" support inspect minio/healing-shard-bucket/unaligned/**)
"${WORK_DIR}/mc" mb play/inspects pkill minio
"${WORK_DIR}/mc" mirror inspects play/inspects sleep 3
purge "$WORK_DIR"
exit 1
fi
pkill minio
sleep 3
} }
function main() { function main() {
download_old_release download_old_release
start_port=$(shuf -i 10000-65000 -n 1) start_port=$(shuf -i 10000-65000 -n 1)
start_minio_16drive ${start_port} start_minio_16drive ${start_port}
} }
function purge() function purge() {
{ rm -rf "$1"
rm -rf "$1"
} }
( main "$@" ) (main "$@")
rv=$? rv=$?
purge "$WORK_DIR" purge "$WORK_DIR"
exit "$rv" exit "$rv"

View File

@ -6,8 +6,8 @@ set -E
set -o pipefail set -o pipefail
if [ ! -x "$PWD/minio" ]; then if [ ! -x "$PWD/minio" ]; then
echo "minio executable binary not found in current directory" echo "minio executable binary not found in current directory"
exit 1 exit 1
fi fi
WORK_DIR="$PWD/.verify-$RANDOM" WORK_DIR="$PWD/.verify-$RANDOM"
@ -25,285 +25,270 @@ export ENABLE_ADMIN=1
export MINIO_CI_CD=1 export MINIO_CI_CD=1
MINIO_CONFIG_DIR="$WORK_DIR/.minio" MINIO_CONFIG_DIR="$WORK_DIR/.minio"
MINIO=( "$PWD/minio" --config-dir "$MINIO_CONFIG_DIR" ) MINIO=("$PWD/minio" --config-dir "$MINIO_CONFIG_DIR")
FILE_1_MB="$MINT_DATA_DIR/datafile-1-MB" FILE_1_MB="$MINT_DATA_DIR/datafile-1-MB"
FILE_65_MB="$MINT_DATA_DIR/datafile-65-MB" FILE_65_MB="$MINT_DATA_DIR/datafile-65-MB"
FUNCTIONAL_TESTS="$WORK_DIR/functional-tests.sh" FUNCTIONAL_TESTS="$WORK_DIR/functional-tests.sh"
function start_minio_fs() function start_minio_fs() {
{ export MINIO_ROOT_USER=$ACCESS_KEY
export MINIO_ROOT_USER=$ACCESS_KEY export MINIO_ROOT_PASSWORD=$SECRET_KEY
export MINIO_ROOT_PASSWORD=$SECRET_KEY "${MINIO[@]}" server "${WORK_DIR}/fs-disk" >"$WORK_DIR/fs-minio.log" 2>&1 &
"${MINIO[@]}" server "${WORK_DIR}/fs-disk" >"$WORK_DIR/fs-minio.log" 2>&1 & sleep 10
sleep 10
} }
function start_minio_erasure() function start_minio_erasure() {
{ "${MINIO[@]}" server "${WORK_DIR}/erasure-disk1" "${WORK_DIR}/erasure-disk2" "${WORK_DIR}/erasure-disk3" "${WORK_DIR}/erasure-disk4" >"$WORK_DIR/erasure-minio.log" 2>&1 &
"${MINIO[@]}" server "${WORK_DIR}/erasure-disk1" "${WORK_DIR}/erasure-disk2" "${WORK_DIR}/erasure-disk3" "${WORK_DIR}/erasure-disk4" >"$WORK_DIR/erasure-minio.log" 2>&1 & sleep 15
sleep 15
} }
function start_minio_erasure_sets() function start_minio_erasure_sets() {
{ export MINIO_ENDPOINTS="${WORK_DIR}/erasure-disk-sets{1...32}"
export MINIO_ENDPOINTS="${WORK_DIR}/erasure-disk-sets{1...32}" "${MINIO[@]}" server >"$WORK_DIR/erasure-minio-sets.log" 2>&1 &
"${MINIO[@]}" server > "$WORK_DIR/erasure-minio-sets.log" 2>&1 & sleep 15
sleep 15
} }
function start_minio_pool_erasure_sets() function start_minio_pool_erasure_sets() {
{ export MINIO_ROOT_USER=$ACCESS_KEY
export MINIO_ROOT_USER=$ACCESS_KEY export MINIO_ROOT_PASSWORD=$SECRET_KEY
export MINIO_ROOT_PASSWORD=$SECRET_KEY export MINIO_ENDPOINTS="http://127.0.0.1:9000${WORK_DIR}/pool-disk-sets{1...4} http://127.0.0.1:9001${WORK_DIR}/pool-disk-sets{5...8}"
export MINIO_ENDPOINTS="http://127.0.0.1:9000${WORK_DIR}/pool-disk-sets{1...4} http://127.0.0.1:9001${WORK_DIR}/pool-disk-sets{5...8}" "${MINIO[@]}" server --address ":9000" >"$WORK_DIR/pool-minio-9000.log" 2>&1 &
"${MINIO[@]}" server --address ":9000" > "$WORK_DIR/pool-minio-9000.log" 2>&1 & "${MINIO[@]}" server --address ":9001" >"$WORK_DIR/pool-minio-9001.log" 2>&1 &
"${MINIO[@]}" server --address ":9001" > "$WORK_DIR/pool-minio-9001.log" 2>&1 &
sleep 40 sleep 40
} }
function start_minio_pool_erasure_sets_ipv6() function start_minio_pool_erasure_sets_ipv6() {
{ export MINIO_ROOT_USER=$ACCESS_KEY
export MINIO_ROOT_USER=$ACCESS_KEY export MINIO_ROOT_PASSWORD=$SECRET_KEY
export MINIO_ROOT_PASSWORD=$SECRET_KEY export MINIO_ENDPOINTS="http://[::1]:9000${WORK_DIR}/pool-disk-sets-ipv6{1...4} http://[::1]:9001${WORK_DIR}/pool-disk-sets-ipv6{5...8}"
export MINIO_ENDPOINTS="http://[::1]:9000${WORK_DIR}/pool-disk-sets-ipv6{1...4} http://[::1]:9001${WORK_DIR}/pool-disk-sets-ipv6{5...8}" "${MINIO[@]}" server --address="[::1]:9000" >"$WORK_DIR/pool-minio-ipv6-9000.log" 2>&1 &
"${MINIO[@]}" server --address="[::1]:9000" > "$WORK_DIR/pool-minio-ipv6-9000.log" 2>&1 & "${MINIO[@]}" server --address="[::1]:9001" >"$WORK_DIR/pool-minio-ipv6-9001.log" 2>&1 &
"${MINIO[@]}" server --address="[::1]:9001" > "$WORK_DIR/pool-minio-ipv6-9001.log" 2>&1 &
sleep 40 sleep 40
} }
function start_minio_dist_erasure() function start_minio_dist_erasure() {
{ export MINIO_ROOT_USER=$ACCESS_KEY
export MINIO_ROOT_USER=$ACCESS_KEY export MINIO_ROOT_PASSWORD=$SECRET_KEY
export MINIO_ROOT_PASSWORD=$SECRET_KEY export MINIO_ENDPOINTS="http://127.0.0.1:9000${WORK_DIR}/dist-disk1 http://127.0.0.1:9001${WORK_DIR}/dist-disk2 http://127.0.0.1:9002${WORK_DIR}/dist-disk3 http://127.0.0.1:9003${WORK_DIR}/dist-disk4"
export MINIO_ENDPOINTS="http://127.0.0.1:9000${WORK_DIR}/dist-disk1 http://127.0.0.1:9001${WORK_DIR}/dist-disk2 http://127.0.0.1:9002${WORK_DIR}/dist-disk3 http://127.0.0.1:9003${WORK_DIR}/dist-disk4" for i in $(seq 0 3); do
for i in $(seq 0 3); do "${MINIO[@]}" server --address ":900${i}" >"$WORK_DIR/dist-minio-900${i}.log" 2>&1 &
"${MINIO[@]}" server --address ":900${i}" > "$WORK_DIR/dist-minio-900${i}.log" 2>&1 & done
done
sleep 40 sleep 40
} }
function run_test_fs() function run_test_fs() {
{ start_minio_fs
start_minio_fs
(cd "$WORK_DIR" && "$FUNCTIONAL_TESTS") (cd "$WORK_DIR" && "$FUNCTIONAL_TESTS")
rv=$? rv=$?
pkill minio pkill minio
sleep 3 sleep 3
if [ "$rv" -ne 0 ]; then if [ "$rv" -ne 0 ]; then
cat "$WORK_DIR/fs-minio.log" cat "$WORK_DIR/fs-minio.log"
fi fi
rm -f "$WORK_DIR/fs-minio.log" rm -f "$WORK_DIR/fs-minio.log"
return "$rv" return "$rv"
} }
function run_test_erasure_sets() function run_test_erasure_sets() {
{ start_minio_erasure_sets
start_minio_erasure_sets
(cd "$WORK_DIR" && "$FUNCTIONAL_TESTS") (cd "$WORK_DIR" && "$FUNCTIONAL_TESTS")
rv=$? rv=$?
pkill minio pkill minio
sleep 3 sleep 3
if [ "$rv" -ne 0 ]; then if [ "$rv" -ne 0 ]; then
cat "$WORK_DIR/erasure-minio-sets.log" cat "$WORK_DIR/erasure-minio-sets.log"
fi fi
rm -f "$WORK_DIR/erasure-minio-sets.log" rm -f "$WORK_DIR/erasure-minio-sets.log"
return "$rv" return "$rv"
} }
function run_test_pool_erasure_sets() function run_test_pool_erasure_sets() {
{ start_minio_pool_erasure_sets
start_minio_pool_erasure_sets
(cd "$WORK_DIR" && "$FUNCTIONAL_TESTS") (cd "$WORK_DIR" && "$FUNCTIONAL_TESTS")
rv=$? rv=$?
pkill minio pkill minio
sleep 3 sleep 3
if [ "$rv" -ne 0 ]; then if [ "$rv" -ne 0 ]; then
for i in $(seq 0 1); do for i in $(seq 0 1); do
echo "server$i log:" echo "server$i log:"
cat "$WORK_DIR/pool-minio-900$i.log" cat "$WORK_DIR/pool-minio-900$i.log"
done done
fi fi
for i in $(seq 0 1); do for i in $(seq 0 1); do
rm -f "$WORK_DIR/pool-minio-900$i.log" rm -f "$WORK_DIR/pool-minio-900$i.log"
done done
return "$rv" return "$rv"
} }
function run_test_pool_erasure_sets_ipv6() function run_test_pool_erasure_sets_ipv6() {
{ start_minio_pool_erasure_sets_ipv6
start_minio_pool_erasure_sets_ipv6
export SERVER_ENDPOINT="[::1]:9000" export SERVER_ENDPOINT="[::1]:9000"
(cd "$WORK_DIR" && "$FUNCTIONAL_TESTS") (cd "$WORK_DIR" && "$FUNCTIONAL_TESTS")
rv=$? rv=$?
pkill minio pkill minio
sleep 3 sleep 3
if [ "$rv" -ne 0 ]; then if [ "$rv" -ne 0 ]; then
for i in $(seq 0 1); do for i in $(seq 0 1); do
echo "server$i log:" echo "server$i log:"
cat "$WORK_DIR/pool-minio-ipv6-900$i.log" cat "$WORK_DIR/pool-minio-ipv6-900$i.log"
done done
fi fi
for i in $(seq 0 1); do for i in $(seq 0 1); do
rm -f "$WORK_DIR/pool-minio-ipv6-900$i.log" rm -f "$WORK_DIR/pool-minio-ipv6-900$i.log"
done done
return "$rv" return "$rv"
} }
function run_test_erasure() function run_test_erasure() {
{ start_minio_erasure
start_minio_erasure
(cd "$WORK_DIR" && "$FUNCTIONAL_TESTS") (cd "$WORK_DIR" && "$FUNCTIONAL_TESTS")
rv=$? rv=$?
pkill minio pkill minio
sleep 3 sleep 3
if [ "$rv" -ne 0 ]; then if [ "$rv" -ne 0 ]; then
cat "$WORK_DIR/erasure-minio.log" cat "$WORK_DIR/erasure-minio.log"
fi fi
rm -f "$WORK_DIR/erasure-minio.log" rm -f "$WORK_DIR/erasure-minio.log"
return "$rv" return "$rv"
} }
function run_test_dist_erasure() function run_test_dist_erasure() {
{ start_minio_dist_erasure
start_minio_dist_erasure
(cd "$WORK_DIR" && "$FUNCTIONAL_TESTS") (cd "$WORK_DIR" && "$FUNCTIONAL_TESTS")
rv=$? rv=$?
pkill minio pkill minio
sleep 3 sleep 3
if [ "$rv" -ne 0 ]; then if [ "$rv" -ne 0 ]; then
echo "server1 log:" echo "server1 log:"
cat "$WORK_DIR/dist-minio-9000.log" cat "$WORK_DIR/dist-minio-9000.log"
echo "server2 log:" echo "server2 log:"
cat "$WORK_DIR/dist-minio-9001.log" cat "$WORK_DIR/dist-minio-9001.log"
echo "server3 log:" echo "server3 log:"
cat "$WORK_DIR/dist-minio-9002.log" cat "$WORK_DIR/dist-minio-9002.log"
echo "server4 log:" echo "server4 log:"
cat "$WORK_DIR/dist-minio-9003.log" cat "$WORK_DIR/dist-minio-9003.log"
fi fi
rm -f "$WORK_DIR/dist-minio-9000.log" "$WORK_DIR/dist-minio-9001.log" "$WORK_DIR/dist-minio-9002.log" "$WORK_DIR/dist-minio-9003.log" rm -f "$WORK_DIR/dist-minio-9000.log" "$WORK_DIR/dist-minio-9001.log" "$WORK_DIR/dist-minio-9002.log" "$WORK_DIR/dist-minio-9003.log"
return "$rv" return "$rv"
} }
function purge() function purge() {
{ rm -rf "$1"
rm -rf "$1"
} }
function __init__() function __init__() {
{ echo "Initializing environment"
echo "Initializing environment" mkdir -p "$WORK_DIR"
mkdir -p "$WORK_DIR" mkdir -p "$MINIO_CONFIG_DIR"
mkdir -p "$MINIO_CONFIG_DIR" mkdir -p "$MINT_DATA_DIR"
mkdir -p "$MINT_DATA_DIR"
MC_BUILD_DIR="mc-$RANDOM" MC_BUILD_DIR="mc-$RANDOM"
if ! git clone --quiet https://github.com/minio/mc "$MC_BUILD_DIR"; then if ! git clone --quiet https://github.com/minio/mc "$MC_BUILD_DIR"; then
echo "failed to download https://github.com/minio/mc" echo "failed to download https://github.com/minio/mc"
purge "${MC_BUILD_DIR}" purge "${MC_BUILD_DIR}"
exit 1 exit 1
fi fi
(cd "${MC_BUILD_DIR}" && go build -o "$WORK_DIR/mc") (cd "${MC_BUILD_DIR}" && go build -o "$WORK_DIR/mc")
# remove mc source. # remove mc source.
purge "${MC_BUILD_DIR}" purge "${MC_BUILD_DIR}"
shred -n 1 -s 1M - 1>"$FILE_1_MB" 2>/dev/null shred -n 1 -s 1M - 1>"$FILE_1_MB" 2>/dev/null
shred -n 1 -s 65M - 1>"$FILE_65_MB" 2>/dev/null shred -n 1 -s 65M - 1>"$FILE_65_MB" 2>/dev/null
## version is purposefully set to '3' for minio to migrate configuration file ## version is purposefully set to '3' for minio to migrate configuration file
echo '{"version": "3", "credential": {"accessKey": "minio", "secretKey": "minio123"}, "region": "us-east-1"}' > "$MINIO_CONFIG_DIR/config.json" echo '{"version": "3", "credential": {"accessKey": "minio", "secretKey": "minio123"}, "region": "us-east-1"}' >"$MINIO_CONFIG_DIR/config.json"
if ! wget -q -O "$FUNCTIONAL_TESTS" https://raw.githubusercontent.com/minio/mc/master/functional-tests.sh; then if ! wget -q -O "$FUNCTIONAL_TESTS" https://raw.githubusercontent.com/minio/mc/master/functional-tests.sh; then
echo "failed to download https://raw.githubusercontent.com/minio/mc/master/functional-tests.sh" echo "failed to download https://raw.githubusercontent.com/minio/mc/master/functional-tests.sh"
exit 1 exit 1
fi fi
sed -i 's|-sS|-sSg|g' "$FUNCTIONAL_TESTS" sed -i 's|-sS|-sSg|g' "$FUNCTIONAL_TESTS"
chmod a+x "$FUNCTIONAL_TESTS" chmod a+x "$FUNCTIONAL_TESTS"
} }
function main() function main() {
{ echo "Testing in FS setup"
echo "Testing in FS setup" if ! run_test_fs; then
if ! run_test_fs; then echo "FAILED"
echo "FAILED" purge "$WORK_DIR"
purge "$WORK_DIR" exit 1
exit 1 fi
fi
echo "Testing in Erasure setup" echo "Testing in Erasure setup"
if ! run_test_erasure; then if ! run_test_erasure; then
echo "FAILED" echo "FAILED"
purge "$WORK_DIR" purge "$WORK_DIR"
exit 1 exit 1
fi fi
echo "Testing in Distributed Erasure setup" echo "Testing in Distributed Erasure setup"
if ! run_test_dist_erasure; then if ! run_test_dist_erasure; then
echo "FAILED" echo "FAILED"
purge "$WORK_DIR" purge "$WORK_DIR"
exit 1 exit 1
fi fi
echo "Testing in Erasure setup as sets" echo "Testing in Erasure setup as sets"
if ! run_test_erasure_sets; then if ! run_test_erasure_sets; then
echo "FAILED" echo "FAILED"
purge "$WORK_DIR" purge "$WORK_DIR"
exit 1 exit 1
fi fi
echo "Testing in Distributed Eraure expanded setup" echo "Testing in Distributed Eraure expanded setup"
if ! run_test_pool_erasure_sets; then if ! run_test_pool_erasure_sets; then
echo "FAILED" echo "FAILED"
purge "$WORK_DIR" purge "$WORK_DIR"
exit 1 exit 1
fi fi
echo "Testing in Distributed Erasure expanded setup with ipv6" echo "Testing in Distributed Erasure expanded setup with ipv6"
if ! run_test_pool_erasure_sets_ipv6; then if ! run_test_pool_erasure_sets_ipv6; then
echo "FAILED" echo "FAILED"
purge "$WORK_DIR" purge "$WORK_DIR"
exit 1 exit 1
fi fi
purge "$WORK_DIR" purge "$WORK_DIR"
} }
( __init__ "$@" && main "$@" ) (__init__ "$@" && main "$@")
rv=$? rv=$?
purge "$WORK_DIR" purge "$WORK_DIR"
exit "$rv" exit "$rv"

View File

@ -4,96 +4,93 @@ set -E
set -o pipefail set -o pipefail
set -x set -x
if [ ! -x "$PWD/minio" ]; then if [ ! -x "$PWD/minio" ]; then
echo "minio executable binary not found in current directory" echo "minio executable binary not found in current directory"
exit 1 exit 1
fi fi
WORK_DIR="$(mktemp -d)" WORK_DIR="$(mktemp -d)"
MINIO_CONFIG_DIR="$WORK_DIR/.minio" MINIO_CONFIG_DIR="$WORK_DIR/.minio"
MINIO=( "$PWD/minio" --config-dir "$MINIO_CONFIG_DIR" server ) MINIO=("$PWD/minio" --config-dir "$MINIO_CONFIG_DIR" server)
function start_minio() { function start_minio() {
start_port=$1 start_port=$1
export MINIO_ROOT_USER=minio export MINIO_ROOT_USER=minio
export MINIO_ROOT_PASSWORD=minio123 export MINIO_ROOT_PASSWORD=minio123
unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects
unset MINIO_CI_CD unset MINIO_CI_CD
unset CI unset CI
args=() args=()
for i in $(seq 1 4); do for i in $(seq 1 4); do
args+=("http://localhost:$[${start_port}+$i]${WORK_DIR}/mnt/disk$i/ ") args+=("http://localhost:$((start_port + i))${WORK_DIR}/mnt/disk$i/ ")
done done
for i in $(seq 1 4); do for i in $(seq 1 4); do
"${MINIO[@]}" --address ":$[$start_port+$i]" ${args[@]} 2>&1 >"${WORK_DIR}/server$i.log" & "${MINIO[@]}" --address ":$((start_port + i))" ${args[@]} 2>&1 >"${WORK_DIR}/server$i.log" &
done done
# Wait until all nodes return 403 # Wait until all nodes return 403
for i in $(seq 1 4); do for i in $(seq 1 4); do
while [ "$(curl -m 1 -s -o /dev/null -w "%{http_code}" http://localhost:$[$start_port+$i])" -ne "403" ]; do while [ "$(curl -m 1 -s -o /dev/null -w "%{http_code}" http://localhost:$((start_port + i)))" -ne "403" ]; do
echo -n "."; echo -n "."
sleep 1; sleep 1
done done
done done
} }
# Prepare fake disks with losetup # Prepare fake disks with losetup
function prepare_block_devices() { function prepare_block_devices() {
set -e set -e
mkdir -p ${WORK_DIR}/disks/ ${WORK_DIR}/mnt/ mkdir -p ${WORK_DIR}/disks/ ${WORK_DIR}/mnt/
sudo modprobe loop sudo modprobe loop
for i in 1 2 3 4; do for i in 1 2 3 4; do
dd if=/dev/zero of=${WORK_DIR}/disks/img.${i} bs=1M count=2000 dd if=/dev/zero of=${WORK_DIR}/disks/img.${i} bs=1M count=2000
device=$(sudo losetup --find --show ${WORK_DIR}/disks/img.${i}) device=$(sudo losetup --find --show ${WORK_DIR}/disks/img.${i})
sudo mkfs.ext4 -F ${device} sudo mkfs.ext4 -F ${device}
mkdir -p ${WORK_DIR}/mnt/disk${i}/ mkdir -p ${WORK_DIR}/mnt/disk${i}/
sudo mount ${device} ${WORK_DIR}/mnt/disk${i}/ sudo mount ${device} ${WORK_DIR}/mnt/disk${i}/
sudo chown "$(id -u):$(id -g)" ${device} ${WORK_DIR}/mnt/disk${i}/ sudo chown "$(id -u):$(id -g)" ${device} ${WORK_DIR}/mnt/disk${i}/
done done
set +e set +e
} }
# Start a distributed MinIO setup, unmount one disk and check if it is formatted # Start a distributed MinIO setup, unmount one disk and check if it is formatted
function main() { function main() {
start_port=$(shuf -i 10000-65000 -n 1) start_port=$(shuf -i 10000-65000 -n 1)
start_minio ${start_port} start_minio ${start_port}
# Unmount the disk, after the unmount the device id # Unmount the disk, after the unmount the device id
# /tmp/xxx/mnt/disk4 will be the same as '/' and it # /tmp/xxx/mnt/disk4 will be the same as '/' and it
# will be detected as root disk # will be detected as root disk
while [ "$u" != "0" ]; do while [ "$u" != "0" ]; do
sudo umount ${WORK_DIR}/mnt/disk4/ sudo umount ${WORK_DIR}/mnt/disk4/
u=$? u=$?
sleep 1 sleep 1
done done
# Wait until MinIO self heal kicks in # Wait until MinIO self heal kicks in
sleep 60 sleep 60
if [ -f ${WORK_DIR}/mnt/disk4/.minio.sys/format.json ]; then if [ -f ${WORK_DIR}/mnt/disk4/.minio.sys/format.json ]; then
echo "A root disk is formatted unexpectedely" echo "A root disk is formatted unexpectedely"
cat "${WORK_DIR}/server4.log" cat "${WORK_DIR}/server4.log"
exit -1 exit -1
fi fi
} }
function cleanup() { function cleanup() {
pkill minio pkill minio
sudo umount ${WORK_DIR}/mnt/disk{1..3}/ sudo umount ${WORK_DIR}/mnt/disk{1..3}/
sudo rm /dev/minio-loopdisk* sudo rm /dev/minio-loopdisk*
rm -rf "$WORK_DIR" rm -rf "$WORK_DIR"
} }
( prepare_block_devices ) (prepare_block_devices)
( main "$@" ) (main "$@")
rv=$? rv=$?
cleanup cleanup
exit "$rv" exit "$rv"

View File

@ -5,139 +5,135 @@ set -E
set -o pipefail set -o pipefail
if [ ! -x "$PWD/minio" ]; then if [ ! -x "$PWD/minio" ]; then
echo "minio executable binary not found in current directory" echo "minio executable binary not found in current directory"
exit 1 exit 1
fi fi
WORK_DIR="$PWD/.verify-$RANDOM" WORK_DIR="$PWD/.verify-$RANDOM"
MINIO_CONFIG_DIR="$WORK_DIR/.minio" MINIO_CONFIG_DIR="$WORK_DIR/.minio"
MINIO=( "$PWD/minio" --config-dir "$MINIO_CONFIG_DIR" server ) MINIO=("$PWD/minio" --config-dir "$MINIO_CONFIG_DIR" server)
function start_minio_3_node() { function start_minio_3_node() {
export MINIO_ROOT_USER=minio export MINIO_ROOT_USER=minio
export MINIO_ROOT_PASSWORD=minio123 export MINIO_ROOT_PASSWORD=minio123
export MINIO_ERASURE_SET_DRIVE_COUNT=6 export MINIO_ERASURE_SET_DRIVE_COUNT=6
export MINIO_CI_CD=1 export MINIO_CI_CD=1
start_port=$2 start_port=$2
args="" args=""
for i in $(seq 1 3); do
args="$args http://127.0.0.1:$[$start_port+$i]${WORK_DIR}/$i/1/ http://127.0.0.1:$[$start_port+$i]${WORK_DIR}/$i/2/ http://127.0.0.1:$[$start_port+$i]${WORK_DIR}/$i/3/ http://127.0.0.1:$[$start_port+$i]${WORK_DIR}/$i/4/ http://127.0.0.1:$[$start_port+$i]${WORK_DIR}/$i/5/ http://127.0.0.1:$[$start_port+$i]${WORK_DIR}/$i/6/"
done
"${MINIO[@]}" --address ":$[$start_port+1]" $args > "${WORK_DIR}/dist-minio-server1.log" 2>&1 &
pid1=$!
disown ${pid1}
"${MINIO[@]}" --address ":$[$start_port+2]" $args > "${WORK_DIR}/dist-minio-server2.log" 2>&1 &
pid2=$!
disown $pid2
"${MINIO[@]}" --address ":$[$start_port+3]" $args > "${WORK_DIR}/dist-minio-server3.log" 2>&1 &
pid3=$!
disown $pid3
sleep "$1"
if ! ps -p $pid1 1>&2 > /dev/null; then
echo "server1 log:"
cat "${WORK_DIR}/dist-minio-server1.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
if ! ps -p $pid2 1>&2 > /dev/null; then
echo "server2 log:"
cat "${WORK_DIR}/dist-minio-server2.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
if ! ps -p $pid3 1>&2 > /dev/null; then
echo "server3 log:"
cat "${WORK_DIR}/dist-minio-server3.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
if ! pkill minio; then
for i in $(seq 1 3); do for i in $(seq 1 3); do
echo "server$i log:" args="$args http://127.0.0.1:$((start_port + i))${WORK_DIR}/$i/1/ http://127.0.0.1:$((start_port + i))${WORK_DIR}/$i/2/ http://127.0.0.1:$((start_port + i))${WORK_DIR}/$i/3/ http://127.0.0.1:$((start_port + i))${WORK_DIR}/$i/4/ http://127.0.0.1:$((start_port + i))${WORK_DIR}/$i/5/ http://127.0.0.1:$((start_port + i))${WORK_DIR}/$i/6/"
cat "${WORK_DIR}/dist-minio-server$i.log"
done done
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
sleep 1; "${MINIO[@]}" --address ":$((start_port + 1))" $args >"${WORK_DIR}/dist-minio-server1.log" 2>&1 &
if pgrep minio; then pid1=$!
# forcibly killing, to proceed further properly. disown ${pid1}
if ! pkill -9 minio; then
echo "no minio process running anymore, proceed." "${MINIO[@]}" --address ":$((start_port + 2))" $args >"${WORK_DIR}/dist-minio-server2.log" 2>&1 &
pid2=$!
disown $pid2
"${MINIO[@]}" --address ":$((start_port + 3))" $args >"${WORK_DIR}/dist-minio-server3.log" 2>&1 &
pid3=$!
disown $pid3
sleep "$1"
if ! ps -p $pid1 1>&2 >/dev/null; then
echo "server1 log:"
cat "${WORK_DIR}/dist-minio-server1.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi fi
fi
}
if ! ps -p $pid2 1>&2 >/dev/null; then
echo "server2 log:"
cat "${WORK_DIR}/dist-minio-server2.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
if ! ps -p $pid3 1>&2 >/dev/null; then
echo "server3 log:"
cat "${WORK_DIR}/dist-minio-server3.log"
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
if ! pkill minio; then
for i in $(seq 1 3); do
echo "server$i log:"
cat "${WORK_DIR}/dist-minio-server$i.log"
done
echo "FAILED"
purge "$WORK_DIR"
exit 1
fi
sleep 1
if pgrep minio; then
# forcibly killing, to proceed further properly.
if ! pkill -9 minio; then
echo "no minio process running anymore, proceed."
fi
fi
}
function check_online() { function check_online() {
if grep -q 'Unable to initialize sub-systems' ${WORK_DIR}/dist-minio-*.log; then if grep -q 'Unable to initialize sub-systems' ${WORK_DIR}/dist-minio-*.log; then
echo "1" echo "1"
fi fi
} }
function purge() function purge() {
{ rm -rf "$1"
rm -rf "$1"
} }
function __init__() function __init__() {
{ echo "Initializing environment"
echo "Initializing environment" mkdir -p "$WORK_DIR"
mkdir -p "$WORK_DIR" mkdir -p "$MINIO_CONFIG_DIR"
mkdir -p "$MINIO_CONFIG_DIR"
## version is purposefully set to '3' for minio to migrate configuration file ## version is purposefully set to '3' for minio to migrate configuration file
echo '{"version": "3", "credential": {"accessKey": "minio", "secretKey": "minio123"}, "region": "us-east-1"}' > "$MINIO_CONFIG_DIR/config.json" echo '{"version": "3", "credential": {"accessKey": "minio", "secretKey": "minio123"}, "region": "us-east-1"}' >"$MINIO_CONFIG_DIR/config.json"
} }
function perform_test() { function perform_test() {
start_minio_3_node 120 $2 start_minio_3_node 120 $2
echo "Testing Distributed Erasure setup healing of drives" echo "Testing Distributed Erasure setup healing of drives"
echo "Remove the contents of the disks belonging to '${1}' erasure set" echo "Remove the contents of the disks belonging to '${1}' erasure set"
rm -rf ${WORK_DIR}/${1}/*/ rm -rf ${WORK_DIR}/${1}/*/
start_minio_3_node 120 $2 start_minio_3_node 120 $2
rv=$(check_online) rv=$(check_online)
if [ "$rv" == "1" ]; then if [ "$rv" == "1" ]; then
for i in $(seq 1 3); do for i in $(seq 1 3); do
echo "server$i log:" echo "server$i log:"
cat "${WORK_DIR}/dist-minio-server$i.log" cat "${WORK_DIR}/dist-minio-server$i.log"
done done
pkill -9 minio pkill -9 minio
echo "FAILED" echo "FAILED"
purge "$WORK_DIR" purge "$WORK_DIR"
exit 1 exit 1
fi fi
} }
function main() function main() {
{ # use same ports for all tests
# use same ports for all tests start_port=$(shuf -i 10000-65000 -n 1)
start_port=$(shuf -i 10000-65000 -n 1)
perform_test "2" ${start_port} perform_test "2" ${start_port}
perform_test "1" ${start_port} perform_test "1" ${start_port}
perform_test "3" ${start_port} perform_test "3" ${start_port}
} }
( __init__ "$@" && main "$@" ) (__init__ "$@" && main "$@")
rv=$? rv=$?
purge "$WORK_DIR" purge "$WORK_DIR"
exit "$rv" exit "$rv"

View File

@ -5,21 +5,21 @@ sudo sysctl net.ipv6.conf.all.disable_ipv6=0
release=$(git describe --abbrev=0 --tags) release=$(git describe --abbrev=0 --tags)
docker buildx build --push --no-cache \ docker buildx build --push --no-cache \
--build-arg RELEASE="${release}" \ --build-arg RELEASE="${release}" \
-t "minio/minio:latest" \ -t "minio/minio:latest" \
-t "quay.io/minio/minio:latest" \ -t "quay.io/minio/minio:latest" \
-t "minio/minio:${release}" \ -t "minio/minio:${release}" \
-t "quay.io/minio/minio:${release}" \ -t "quay.io/minio/minio:${release}" \
--platform=linux/arm64,linux/amd64,linux/ppc64le,linux/s390x \ --platform=linux/arm64,linux/amd64,linux/ppc64le,linux/s390x \
-f Dockerfile.release . -f Dockerfile.release .
docker buildx prune -f docker buildx prune -f
docker buildx build --push --no-cache \ docker buildx build --push --no-cache \
--build-arg RELEASE="${release}" \ --build-arg RELEASE="${release}" \
-t "minio/minio:${release}.fips" \ -t "minio/minio:${release}.fips" \
-t "quay.io/minio/minio:${release}.fips" \ -t "quay.io/minio/minio:${release}.fips" \
--platform=linux/amd64 -f Dockerfile.release.fips . --platform=linux/amd64 -f Dockerfile.release.fips .
docker buildx prune -f docker buildx prune -f

View File

@ -3,26 +3,26 @@
# If command starts with an option, prepend minio. # If command starts with an option, prepend minio.
if [ "${1}" != "minio" ]; then if [ "${1}" != "minio" ]; then
if [ -n "${1}" ]; then if [ -n "${1}" ]; then
set -- minio "$@" set -- minio "$@"
fi fi
fi fi
# su-exec to requested user, if service cannot run exec will fail. # su-exec to requested user, if service cannot run exec will fail.
docker_switch_user() { docker_switch_user() {
if [ -n "${MINIO_USERNAME}" ] && [ -n "${MINIO_GROUPNAME}" ]; then if [ -n "${MINIO_USERNAME}" ] && [ -n "${MINIO_GROUPNAME}" ]; then
if [ -n "${MINIO_UID}" ] && [ -n "${MINIO_GID}" ]; then if [ -n "${MINIO_UID}" ] && [ -n "${MINIO_GID}" ]; then
groupadd -f -g "$MINIO_GID" "$MINIO_GROUPNAME" && \ groupadd -f -g "$MINIO_GID" "$MINIO_GROUPNAME" &&
useradd -u "$MINIO_UID" -g "$MINIO_GROUPNAME" "$MINIO_USERNAME" useradd -u "$MINIO_UID" -g "$MINIO_GROUPNAME" "$MINIO_USERNAME"
else else
groupadd -f "$MINIO_GROUPNAME" && \ groupadd -f "$MINIO_GROUPNAME" &&
useradd -g "$MINIO_GROUPNAME" "$MINIO_USERNAME" useradd -g "$MINIO_GROUPNAME" "$MINIO_USERNAME"
fi fi
exec setpriv --reuid="${MINIO_USERNAME}" \ exec setpriv --reuid="${MINIO_USERNAME}" \
--regid="${MINIO_GROUPNAME}" --keep-groups "$@" --regid="${MINIO_GROUPNAME}" --keep-groups "$@"
else else
exec "$@" exec "$@"
fi fi
} }
## Switch to user if applicable. ## Switch to user if applicable.

View File

@ -4,28 +4,28 @@
set -e set -e
if [ ! -x "/opt/bin/minio" ]; then if [ ! -x "/opt/bin/minio" ]; then
echo "minio executable binary not found refusing to proceed" echo "minio executable binary not found refusing to proceed"
exit 1 exit 1
fi fi
verify_sha256sum() { verify_sha256sum() {
echo "verifying binary checksum" echo "verifying binary checksum"
echo "$(awk '{print $1}' /opt/bin/minio.sha256sum) /opt/bin/minio" | sha256sum -c echo "$(awk '{print $1}' /opt/bin/minio.sha256sum) /opt/bin/minio" | sha256sum -c
} }
verify_signature() { verify_signature() {
if [ "${TARGETARCH}" = "arm" ]; then if [ "${TARGETARCH}" = "arm" ]; then
echo "ignoring verification of binary signature" echo "ignoring verification of binary signature"
return return
fi fi
echo "verifying binary signature" echo "verifying binary signature"
minisign -VQm /opt/bin/minio -P RWTx5Zr1tiHQLwG9keckT0c45M3AGeHD6IvimQHpyRywVWGbP1aVSGav minisign -VQm /opt/bin/minio -P RWTx5Zr1tiHQLwG9keckT0c45M3AGeHD6IvimQHpyRywVWGbP1aVSGav
} }
main() { main() {
verify_sha256sum verify_sha256sum
verify_signature verify_signature
} }
main "$@" main "$@"

View File

@ -1,26 +1,26 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [ -n "$TEST_DEBUG" ]; then if [ -n "$TEST_DEBUG" ]; then
set -x set -x
fi fi
trap 'catch $LINENO' ERR trap 'catch $LINENO' ERR
# shellcheck disable=SC2120 # shellcheck disable=SC2120
catch() { catch() {
if [ $# -ne 0 ]; then if [ $# -ne 0 ]; then
echo "error on line $1" echo "error on line $1"
echo "dc1 server logs =========" echo "dc1 server logs ========="
cat /tmp/dc1.log cat /tmp/dc1.log
echo "dc2 server logs =========" echo "dc2 server logs ========="
cat /tmp/dc2.log cat /tmp/dc2.log
fi fi
echo "Cleaning up instances of MinIO" echo "Cleaning up instances of MinIO"
set +e set +e
pkill minio pkill minio
pkill mc pkill mc
rm -rf /tmp/xl/ rm -rf /tmp/xl/
} }
catch catch
@ -39,8 +39,8 @@ unset MINIO_KMS_KES_ENDPOINT
unset MINIO_KMS_KES_KEY_NAME unset MINIO_KMS_KES_KEY_NAME
if [ ! -f ./mc ]; then if [ ! -f ./mc ]; then
wget --quiet -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc && \ wget --quiet -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc &&
chmod +x mc chmod +x mc
fi fi
mkdir -p /tmp/xl/1/ /tmp/xl/2/ mkdir -p /tmp/xl/1/ /tmp/xl/2/
@ -49,8 +49,8 @@ export MINIO_KMS_SECRET_KEY="my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmG
export MINIO_ROOT_USER="minioadmin" export MINIO_ROOT_USER="minioadmin"
export MINIO_ROOT_PASSWORD="minioadmin" export MINIO_ROOT_PASSWORD="minioadmin"
./minio server --address ":9001" /tmp/xl/1/{1...4}/ 2>&1 > /tmp/dc1.log & ./minio server --address ":9001" /tmp/xl/1/{1...4}/ 2>&1 >/tmp/dc1.log &
./minio server --address ":9002" /tmp/xl/2/{1...4}/ 2>&1 > /tmp/dc2.log & ./minio server --address ":9002" /tmp/xl/2/{1...4}/ 2>&1 >/tmp/dc2.log &
sleep 3 sleep 3
@ -79,27 +79,27 @@ versionId="$(mc ls --json --versions myminio1/testbucket/dir/ | tail -n1 | jq -r
aws s3api --endpoint-url http://localhost:9001 --profile minio delete-object --bucket testbucket --key dir/file --version-id "$versionId" aws s3api --endpoint-url http://localhost:9001 --profile minio delete-object --bucket testbucket --key dir/file --version-id "$versionId"
./mc ls -r --versions myminio1/testbucket > /tmp/myminio1.txt ./mc ls -r --versions myminio1/testbucket >/tmp/myminio1.txt
./mc ls -r --versions myminio2/testbucket > /tmp/myminio2.txt ./mc ls -r --versions myminio2/testbucket >/tmp/myminio2.txt
out=$(diff -qpruN /tmp/myminio1.txt /tmp/myminio2.txt) out=$(diff -qpruN /tmp/myminio1.txt /tmp/myminio2.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no missing entries after replication: $out" echo "BUG: expected no missing entries after replication: $out"
exit 1 exit 1
fi fi
./mc rm myminio1/testbucket/dir/file ./mc rm myminio1/testbucket/dir/file
sleep 1s sleep 1s
./mc ls -r --versions myminio1/testbucket > /tmp/myminio1.txt ./mc ls -r --versions myminio1/testbucket >/tmp/myminio1.txt
./mc ls -r --versions myminio2/testbucket > /tmp/myminio2.txt ./mc ls -r --versions myminio2/testbucket >/tmp/myminio2.txt
out=$(diff -qpruN /tmp/myminio1.txt /tmp/myminio2.txt) out=$(diff -qpruN /tmp/myminio1.txt /tmp/myminio2.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no missing entries after replication: $out" echo "BUG: expected no missing entries after replication: $out"
exit 1 exit 1
fi fi
echo "Success" echo "Success"

View File

@ -6,22 +6,22 @@ trap 'catch $LINENO' ERR
# shellcheck disable=SC2120 # shellcheck disable=SC2120
catch() { catch() {
if [ $# -ne 0 ]; then if [ $# -ne 0 ]; then
echo "error on line $1" echo "error on line $1"
for site in sitea siteb; do for site in sitea siteb; do
echo "$site server logs =========" echo "$site server logs ========="
cat "/tmp/${site}_1.log" cat "/tmp/${site}_1.log"
echo "===========================" echo "==========================="
cat "/tmp/${site}_2.log" cat "/tmp/${site}_2.log"
done done
fi fi
echo "Cleaning up instances of MinIO" echo "Cleaning up instances of MinIO"
pkill minio pkill minio
pkill -9 minio pkill -9 minio
rm -rf /tmp/multisitea rm -rf /tmp/multisitea
rm -rf /tmp/multisiteb rm -rf /tmp/multisiteb
rm -rf /tmp/data rm -rf /tmp/data
} }
catch catch
@ -40,19 +40,19 @@ unset MINIO_KMS_KES_ENDPOINT
unset MINIO_KMS_KES_KEY_NAME unset MINIO_KMS_KES_KEY_NAME
if [ ! -f ./mc ]; then if [ ! -f ./mc ]; then
wget --quiet -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc && \ wget --quiet -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc &&
chmod +x mc chmod +x mc
fi fi
minio server --address 127.0.0.1:9001 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9001 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_1.log 2>&1 & "http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_1.log 2>&1 &
minio server --address 127.0.0.1:9002 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9002 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_2.log 2>&1 & "http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_2.log 2>&1 &
minio server --address 127.0.0.1:9003 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9003 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_1.log 2>&1 & "http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_1.log 2>&1 &
minio server --address 127.0.0.1:9004 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9004 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_2.log 2>&1 & "http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_2.log 2>&1 &
sleep 10s sleep 10s
@ -64,7 +64,7 @@ export MC_HOST_siteb=http://minio:minio123@127.0.0.1:9004
## Create 100 files ## Create 100 files
mkdir -p /tmp/data mkdir -p /tmp/data
for i in $(seq 1 10); do for i in $(seq 1 10); do
echo "T" > /tmp/data/file_${i}.txt echo "T" >/tmp/data/file_${i}.txt
done done
./mc mirror /tmp/data sitea/bucket/ ./mc mirror /tmp/data sitea/bucket/
@ -78,7 +78,7 @@ done
echo "adding replication rule for site a -> site b" echo "adding replication rule for site a -> site b"
./mc replicate add sitea/bucket/ \ ./mc replicate add sitea/bucket/ \
--remote-bucket http://minio:minio123@127.0.0.1:9004/bucket --remote-bucket http://minio:minio123@127.0.0.1:9004/bucket
remote_arn=$(./mc replicate ls sitea/bucket --json | jq -r .rule.Destination.Bucket) remote_arn=$(./mc replicate ls sitea/bucket --json | jq -r .rule.Destination.Bucket)
sleep 1 sleep 1
@ -88,20 +88,20 @@ sleep 10s ## sleep for 10s idea is that we give 100ms per object.
count=$(./mc replicate resync status sitea/bucket --remote-bucket "${remote_arn}" --json | jq .resyncInfo.target[].replicationCount) count=$(./mc replicate resync status sitea/bucket --remote-bucket "${remote_arn}" --json | jq .resyncInfo.target[].replicationCount)
./mc ls -r --versions sitea/bucket > /tmp/sitea.txt ./mc ls -r --versions sitea/bucket >/tmp/sitea.txt
./mc ls -r --versions siteb/bucket > /tmp/siteb.txt ./mc ls -r --versions siteb/bucket >/tmp/siteb.txt
out=$(diff -qpruN /tmp/sitea.txt /tmp/siteb.txt) out=$(diff -qpruN /tmp/sitea.txt /tmp/siteb.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no missing entries after replication: $out" echo "BUG: expected no missing entries after replication: $out"
exit 1 exit 1
fi fi
if [ $count -ne 12 ]; then if [ $count -ne 12 ]; then
echo "resync not complete after 10s unexpected failure" echo "resync not complete after 10s unexpected failure"
./mc diff sitea/bucket siteb/bucket ./mc diff sitea/bucket siteb/bucket
exit 1 exit 1
fi fi
./mc cp /tmp/data/file_1.txt sitea/bucket/marker_new ./mc cp /tmp/data/file_1.txt sitea/bucket/marker_new
@ -109,27 +109,27 @@ fi
sleep 12s ## sleep for 12s idea is that we give 100ms per object. sleep 12s ## sleep for 12s idea is that we give 100ms per object.
./mc ls -r --versions sitea/bucket > /tmp/sitea.txt ./mc ls -r --versions sitea/bucket >/tmp/sitea.txt
./mc ls -r --versions siteb/bucket > /tmp/siteb.txt ./mc ls -r --versions siteb/bucket >/tmp/siteb.txt
out=$(diff -qpruN /tmp/sitea.txt /tmp/siteb.txt) out=$(diff -qpruN /tmp/sitea.txt /tmp/siteb.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no 'diff' after replication: $out" echo "BUG: expected no 'diff' after replication: $out"
exit 1 exit 1
fi fi
./mc rm -r --force --versions sitea/bucket/marker ./mc rm -r --force --versions sitea/bucket/marker
sleep 14s ## sleep for 14s idea is that we give 100ms per object. sleep 14s ## sleep for 14s idea is that we give 100ms per object.
./mc ls -r --versions sitea/bucket > /tmp/sitea.txt ./mc ls -r --versions sitea/bucket >/tmp/sitea.txt
./mc ls -r --versions siteb/bucket > /tmp/siteb.txt ./mc ls -r --versions siteb/bucket >/tmp/siteb.txt
out=$(diff -qpruN /tmp/sitea.txt /tmp/siteb.txt) out=$(diff -qpruN /tmp/sitea.txt /tmp/siteb.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no 'diff' after replication: $out" echo "BUG: expected no 'diff' after replication: $out"
exit 1 exit 1
fi fi
./mc mb sitea/bucket-version/ ./mc mb sitea/bucket-version/
@ -140,34 +140,34 @@ fi
echo "adding replication rule for site a -> site b" echo "adding replication rule for site a -> site b"
./mc replicate add sitea/bucket-version/ \ ./mc replicate add sitea/bucket-version/ \
--remote-bucket http://minio:minio123@127.0.0.1:9004/bucket-version --remote-bucket http://minio:minio123@127.0.0.1:9004/bucket-version
./mc mb sitea/bucket-version/directory/ ./mc mb sitea/bucket-version/directory/
sleep 2s sleep 2s
./mc ls -r --versions sitea/bucket-version/ > /tmp/sitea_dirs.txt ./mc ls -r --versions sitea/bucket-version/ >/tmp/sitea_dirs.txt
./mc ls -r --versions siteb/bucket-version/ > /tmp/siteb_dirs.txt ./mc ls -r --versions siteb/bucket-version/ >/tmp/siteb_dirs.txt
out=$(diff -qpruN /tmp/sitea_dirs.txt /tmp/siteb_dirs.txt) out=$(diff -qpruN /tmp/sitea_dirs.txt /tmp/siteb_dirs.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no 'diff' after replication: $out" echo "BUG: expected no 'diff' after replication: $out"
exit 1 exit 1
fi fi
./mc rm -r --versions --force sitea/bucket-version/ ./mc rm -r --versions --force sitea/bucket-version/
sleep 2s sleep 2s
./mc ls -r --versions sitea/bucket-version/ > /tmp/sitea_dirs.txt ./mc ls -r --versions sitea/bucket-version/ >/tmp/sitea_dirs.txt
./mc ls -r --versions siteb/bucket-version/ > /tmp/siteb_dirs.txt ./mc ls -r --versions siteb/bucket-version/ >/tmp/siteb_dirs.txt
out=$(diff -qpruN /tmp/sitea_dirs.txt /tmp/siteb_dirs.txt) out=$(diff -qpruN /tmp/sitea_dirs.txt /tmp/siteb_dirs.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no 'diff' after replication: $out" echo "BUG: expected no 'diff' after replication: $out"
exit 1 exit 1
fi fi
## check if we don't create delete markers on the directory objects, its always permanent delete. ## check if we don't create delete markers on the directory objects, its always permanent delete.
@ -179,14 +179,14 @@ sleep 2s
sleep 2s sleep 2s
./mc ls -r --versions sitea/bucket-version/ > /tmp/sitea_dirs.txt ./mc ls -r --versions sitea/bucket-version/ >/tmp/sitea_dirs.txt
./mc ls -r --versions siteb/bucket-version/ > /tmp/siteb_dirs.txt ./mc ls -r --versions siteb/bucket-version/ >/tmp/siteb_dirs.txt
out=$(diff -qpruN /tmp/sitea_dirs.txt /tmp/siteb_dirs.txt) out=$(diff -qpruN /tmp/sitea_dirs.txt /tmp/siteb_dirs.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no 'diff' after replication: $out" echo "BUG: expected no 'diff' after replication: $out"
exit 1 exit 1
fi fi
sitea_count=$(cat /tmp/sitea_dirs.txt | wc -l) # need to do it this way to avoid filename in the output sitea_count=$(cat /tmp/sitea_dirs.txt | wc -l) # need to do it this way to avoid filename in the output
@ -195,13 +195,13 @@ sitea_out=$(cat /tmp/sitea_dirs.txt)
siteb_out=$(cat /tmp/siteb_dirs.txt) siteb_out=$(cat /tmp/siteb_dirs.txt)
if [ $sitea_count -ne 0 ]; then if [ $sitea_count -ne 0 ]; then
echo "BUG: expected no 'directory objects' left after deletion: ${sitea_out}" echo "BUG: expected no 'directory objects' left after deletion: ${sitea_out}"
exit 1 exit 1
fi fi
if [ $siteb_count -ne 0 ]; then if [ $siteb_count -ne 0 ]; then
echo "BUG: expected no 'directory objects' left after deletion: ${siteb_out}" echo "BUG: expected no 'directory objects' left after deletion: ${siteb_out}"
exit 1 exit 1
fi fi
catch catch

View File

@ -1,29 +1,29 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [ -n "$TEST_DEBUG" ]; then if [ -n "$TEST_DEBUG" ]; then
set -x set -x
fi fi
trap 'catch $LINENO' ERR trap 'catch $LINENO' ERR
# shellcheck disable=SC2120 # shellcheck disable=SC2120
catch() { catch() {
if [ $# -ne 0 ]; then if [ $# -ne 0 ]; then
echo "error on line $1" echo "error on line $1"
for site in sitea siteb sitec; do for site in sitea siteb sitec; do
echo "$site server logs =========" echo "$site server logs ========="
cat "/tmp/${site}_1.log" cat "/tmp/${site}_1.log"
echo "===========================" echo "==========================="
cat "/tmp/${site}_2.log" cat "/tmp/${site}_2.log"
done done
fi fi
echo "Cleaning up instances of MinIO" echo "Cleaning up instances of MinIO"
pkill minio pkill minio
pkill -9 minio pkill -9 minio
rm -rf /tmp/multisitea rm -rf /tmp/multisitea
rm -rf /tmp/multisiteb rm -rf /tmp/multisiteb
rm -rf /tmp/multisitec rm -rf /tmp/multisitec
} }
catch catch
@ -42,25 +42,25 @@ unset MINIO_KMS_KES_ENDPOINT
unset MINIO_KMS_KES_KEY_NAME unset MINIO_KMS_KES_KEY_NAME
go build ./docs/debugging/s3-check-md5/ go build ./docs/debugging/s3-check-md5/
wget -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc \ wget -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc &&
&& chmod +x mc chmod +x mc
wget -O mc.RELEASE.2021-03-12T03-36-59Z https://dl.minio.io/client/mc/release/linux-amd64/archive/mc.RELEASE.2021-03-12T03-36-59Z \ wget -O mc.RELEASE.2021-03-12T03-36-59Z https://dl.minio.io/client/mc/release/linux-amd64/archive/mc.RELEASE.2021-03-12T03-36-59Z &&
&& chmod +x mc.RELEASE.2021-03-12T03-36-59Z chmod +x mc.RELEASE.2021-03-12T03-36-59Z
minio server --address 127.0.0.1:9001 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9001 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_1.log 2>&1 & "http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_1.log 2>&1 &
minio server --address 127.0.0.1:9002 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9002 "http://127.0.0.1:9001/tmp/multisitea/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_2.log 2>&1 & "http://127.0.0.1:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_2.log 2>&1 &
minio server --address 127.0.0.1:9003 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9003 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_1.log 2>&1 & "http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_1.log 2>&1 &
minio server --address 127.0.0.1:9004 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9004 "http://127.0.0.1:9003/tmp/multisiteb/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_2.log 2>&1 & "http://127.0.0.1:9004/tmp/multisiteb/data/disterasure/xl{5...8}" >/tmp/siteb_2.log 2>&1 &
minio server --address 127.0.0.1:9005 "http://127.0.0.1:9005/tmp/multisitec/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9005 "http://127.0.0.1:9005/tmp/multisitec/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9006/tmp/multisitec/data/disterasure/xl{5...8}" >/tmp/sitec_1.log 2>&1 & "http://127.0.0.1:9006/tmp/multisitec/data/disterasure/xl{5...8}" >/tmp/sitec_1.log 2>&1 &
minio server --address 127.0.0.1:9006 "http://127.0.0.1:9005/tmp/multisitec/data/disterasure/xl{1...4}" \ minio server --address 127.0.0.1:9006 "http://127.0.0.1:9005/tmp/multisitec/data/disterasure/xl{1...4}" \
"http://127.0.0.1:9006/tmp/multisitec/data/disterasure/xl{5...8}" >/tmp/sitec_2.log 2>&1 & "http://127.0.0.1:9006/tmp/multisitec/data/disterasure/xl{5...8}" >/tmp/sitec_2.log 2>&1 &
sleep 30 sleep 30
@ -83,74 +83,74 @@ export MC_HOST_sitec=http://minio:minio123@127.0.0.1:9006
echo "adding replication rule for a -> b : ${remote_arn}" echo "adding replication rule for a -> b : ${remote_arn}"
sleep 1 sleep 1
./mc replicate add sitea/bucket/ \ ./mc replicate add sitea/bucket/ \
--remote-bucket http://minio:minio123@127.0.0.1:9004/bucket \ --remote-bucket http://minio:minio123@127.0.0.1:9004/bucket \
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --replicate "existing-objects,delete,delete-marker,replica-metadata-sync"
sleep 1 sleep 1
echo "adding replication rule for b -> a : ${remote_arn}" echo "adding replication rule for b -> a : ${remote_arn}"
./mc replicate add siteb/bucket/ \ ./mc replicate add siteb/bucket/ \
--remote-bucket http://minio:minio123@127.0.0.1:9001/bucket \ --remote-bucket http://minio:minio123@127.0.0.1:9001/bucket \
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --replicate "existing-objects,delete,delete-marker,replica-metadata-sync"
sleep 1 sleep 1
echo "adding replication rule for a -> c : ${remote_arn}" echo "adding replication rule for a -> c : ${remote_arn}"
./mc replicate add sitea/bucket/ \ ./mc replicate add sitea/bucket/ \
--remote-bucket http://minio:minio123@127.0.0.1:9006/bucket \ --remote-bucket http://minio:minio123@127.0.0.1:9006/bucket \
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2 --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2
sleep 1 sleep 1
echo "adding replication rule for c -> a : ${remote_arn}" echo "adding replication rule for c -> a : ${remote_arn}"
./mc replicate add sitec/bucket/ \ ./mc replicate add sitec/bucket/ \
--remote-bucket http://minio:minio123@127.0.0.1:9001/bucket \ --remote-bucket http://minio:minio123@127.0.0.1:9001/bucket \
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2 --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2
sleep 1 sleep 1
echo "adding replication rule for b -> c : ${remote_arn}" echo "adding replication rule for b -> c : ${remote_arn}"
./mc replicate add siteb/bucket/ \ ./mc replicate add siteb/bucket/ \
--remote-bucket http://minio:minio123@127.0.0.1:9006/bucket \ --remote-bucket http://minio:minio123@127.0.0.1:9006/bucket \
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3 --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3
sleep 1 sleep 1
echo "adding replication rule for c -> b : ${remote_arn}" echo "adding replication rule for c -> b : ${remote_arn}"
./mc replicate add sitec/bucket/ \ ./mc replicate add sitec/bucket/ \
--remote-bucket http://minio:minio123@127.0.0.1:9004/bucket \ --remote-bucket http://minio:minio123@127.0.0.1:9004/bucket \
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3 --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3
sleep 1 sleep 1
echo "adding replication rule for olockbucket a -> b : ${remote_arn}" echo "adding replication rule for olockbucket a -> b : ${remote_arn}"
./mc replicate add sitea/olockbucket/ \ ./mc replicate add sitea/olockbucket/ \
--remote-bucket http://minio:minio123@127.0.0.1:9004/olockbucket \ --remote-bucket http://minio:minio123@127.0.0.1:9004/olockbucket \
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --replicate "existing-objects,delete,delete-marker,replica-metadata-sync"
sleep 1 sleep 1
echo "adding replication rule for olockbucket b -> a : ${remote_arn}" echo "adding replication rule for olockbucket b -> a : ${remote_arn}"
./mc replicate add siteb/olockbucket/ \ ./mc replicate add siteb/olockbucket/ \
--remote-bucket http://minio:minio123@127.0.0.1:9001/olockbucket \ --remote-bucket http://minio:minio123@127.0.0.1:9001/olockbucket \
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --replicate "existing-objects,delete,delete-marker,replica-metadata-sync"
sleep 1 sleep 1
echo "adding replication rule for olockbucket a -> c : ${remote_arn}" echo "adding replication rule for olockbucket a -> c : ${remote_arn}"
./mc replicate add sitea/olockbucket/ \ ./mc replicate add sitea/olockbucket/ \
--remote-bucket http://minio:minio123@127.0.0.1:9006/olockbucket \ --remote-bucket http://minio:minio123@127.0.0.1:9006/olockbucket \
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2 --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2
sleep 1 sleep 1
echo "adding replication rule for olockbucket c -> a : ${remote_arn}" echo "adding replication rule for olockbucket c -> a : ${remote_arn}"
./mc replicate add sitec/olockbucket/ \ ./mc replicate add sitec/olockbucket/ \
--remote-bucket http://minio:minio123@127.0.0.1:9001/olockbucket \ --remote-bucket http://minio:minio123@127.0.0.1:9001/olockbucket \
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2 --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 2
sleep 1 sleep 1
echo "adding replication rule for olockbucket b -> c : ${remote_arn}" echo "adding replication rule for olockbucket b -> c : ${remote_arn}"
./mc replicate add siteb/olockbucket/ \ ./mc replicate add siteb/olockbucket/ \
--remote-bucket http://minio:minio123@127.0.0.1:9006/olockbucket \ --remote-bucket http://minio:minio123@127.0.0.1:9006/olockbucket \
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3 --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3
sleep 1 sleep 1
echo "adding replication rule for olockbucket c -> b : ${remote_arn}" echo "adding replication rule for olockbucket c -> b : ${remote_arn}"
./mc replicate add sitec/olockbucket/ \ ./mc replicate add sitec/olockbucket/ \
--remote-bucket http://minio:minio123@127.0.0.1:9004/olockbucket \ --remote-bucket http://minio:minio123@127.0.0.1:9004/olockbucket \
--replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3 --replicate "existing-objects,delete,delete-marker,replica-metadata-sync" --priority 3
sleep 1 sleep 1
echo "Set default governance retention 30d" echo "Set default governance retention 30d"
@ -166,20 +166,20 @@ sleep 1
echo "Verifying the metadata difference between source and target" echo "Verifying the metadata difference between source and target"
if diff -pruN <(./mc stat --json sitea/bucket/hosts | jq .) <(./mc stat --json siteb/bucket/hosts | jq .) | grep -q 'COMPLETED\|REPLICA'; then if diff -pruN <(./mc stat --json sitea/bucket/hosts | jq .) <(./mc stat --json siteb/bucket/hosts | jq .) | grep -q 'COMPLETED\|REPLICA'; then
echo "verified sitea-> COMPLETED, siteb-> REPLICA" echo "verified sitea-> COMPLETED, siteb-> REPLICA"
fi fi
if diff -pruN <(./mc stat --json sitea/bucket/hosts | jq .) <(./mc stat --json sitec/bucket/hosts | jq .) | grep -q 'COMPLETED\|REPLICA'; then if diff -pruN <(./mc stat --json sitea/bucket/hosts | jq .) <(./mc stat --json sitec/bucket/hosts | jq .) | grep -q 'COMPLETED\|REPLICA'; then
echo "verified sitea-> COMPLETED, sitec-> REPLICA" echo "verified sitea-> COMPLETED, sitec-> REPLICA"
fi fi
echo "Verifying the metadata difference between source and target" echo "Verifying the metadata difference between source and target"
if diff -pruN <(./mc stat --json sitea/olockbucket/hosts | jq .) <(./mc stat --json siteb/olockbucket/hosts | jq .) | grep -q 'COMPLETED\|REPLICA'; then if diff -pruN <(./mc stat --json sitea/olockbucket/hosts | jq .) <(./mc stat --json siteb/olockbucket/hosts | jq .) | grep -q 'COMPLETED\|REPLICA'; then
echo "verified sitea-> COMPLETED, siteb-> REPLICA" echo "verified sitea-> COMPLETED, siteb-> REPLICA"
fi fi
if diff -pruN <(./mc stat --json sitea/olockbucket/hosts | jq .) <(./mc stat --json sitec/olockbucket/hosts | jq .) | grep -q 'COMPLETED\|REPLICA'; then if diff -pruN <(./mc stat --json sitea/olockbucket/hosts | jq .) <(./mc stat --json sitec/olockbucket/hosts | jq .) | grep -q 'COMPLETED\|REPLICA'; then
echo "verified sitea-> COMPLETED, sitec-> REPLICA" echo "verified sitea-> COMPLETED, sitec-> REPLICA"
fi fi
sleep 5 sleep 5

View File

@ -9,7 +9,7 @@ mc mb -l dest/bucket
mc admin user add source repladmin repladmin123 mc admin user add source repladmin repladmin123
# create a replication policy for repladmin # create a replication policy for repladmin
cat > repladmin-policy-source.json <<EOF cat >repladmin-policy-source.json <<EOF
{ {
"Version": "2012-10-17", "Version": "2012-10-17",
"Statement": [ "Statement": [
@ -51,7 +51,7 @@ mc admin user add dest repluser repluser123
# create a replication policy for repluser # create a replication policy for repluser
# Remove "s3:GetBucketObjectLockConfiguration" if object locking is not enabled, i.e. bucket was not created with `mc mb --with-lock` option # Remove "s3:GetBucketObjectLockConfiguration" if object locking is not enabled, i.e. bucket was not created with `mc mb --with-lock` option
# Remove "s3:ReplicateDelete" if delete marker replication is not required # Remove "s3:ReplicateDelete" if delete marker replication is not required
cat > replpolicy.json <<EOF cat >replpolicy.json <<EOF
{ {
"Version": "2012-10-17", "Version": "2012-10-17",
"Statement": [ "Statement": [
@ -98,4 +98,4 @@ mc admin policy attach dest replpolicy --user=repluser
# configure replication config to remote bucket at http://localhost:9000 # configure replication config to remote bucket at http://localhost:9000
mc replicate add source/bucket --priority 1 --remote-bucket http://repluser:repluser123@localhost:9000/bucket \ mc replicate add source/bucket --priority 1 --remote-bucket http://repluser:repluser123@localhost:9000/bucket \
--replicate existing-objects,delete,delete-marker,replica-metadata-sync --replicate existing-objects,delete,delete-marker,replica-metadata-sync

View File

@ -1,15 +1,15 @@
#!/bin/bash #!/bin/bash
if [ -n "$TEST_DEBUG" ]; then if [ -n "$TEST_DEBUG" ]; then
set -x set -x
fi fi
pkill minio pkill minio
rm -rf /tmp/xl rm -rf /tmp/xl
if [ ! -f ./mc ]; then if [ ! -f ./mc ]; then
wget --quiet -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc && \ wget --quiet -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc &&
chmod +x mc chmod +x mc
fi fi
export CI=true export CI=true
@ -21,7 +21,7 @@ export MINIO_KMS_AUTO_ENCRYPTION=on
export MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= export MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw=
export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9000/" export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9000/"
(minio server /tmp/xl/{1...10}/disk{0...1} 2>&1 >/dev/null)& (minio server /tmp/xl/{1...10}/disk{0...1} 2>&1 >/dev/null) &
pid=$! pid=$!
sleep 2 sleep 2
@ -61,38 +61,37 @@ expanded_user_count=$(./mc admin user list myminio/ | wc -l)
expanded_policy_count=$(./mc admin policy list myminio/ | wc -l) expanded_policy_count=$(./mc admin policy list myminio/ | wc -l)
if [ $user_count -ne $expanded_user_count ]; then if [ $user_count -ne $expanded_user_count ]; then
echo "BUG: original user count differs from expanded setup" echo "BUG: original user count differs from expanded setup"
exit 1 exit 1
fi fi
if [ $policy_count -ne $expanded_policy_count ]; then if [ $policy_count -ne $expanded_policy_count ]; then
echo "BUG: original policy count differs from expanded setup" echo "BUG: original policy count differs from expanded setup"
exit 1 exit 1
fi fi
./mc version info myminio/versioned | grep -q "versioning is enabled" ./mc version info myminio/versioned | grep -q "versioning is enabled"
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "expected versioning enabled after expansion" echo "expected versioning enabled after expansion"
exit 1 exit 1
fi fi
./mc mirror cmd myminio/versioned/ --quiet >/dev/null ./mc mirror cmd myminio/versioned/ --quiet >/dev/null
./mc ls -r myminio/versioned/ > expanded_ns.txt ./mc ls -r myminio/versioned/ >expanded_ns.txt
./mc ls -r --versions myminio/versioned/ > expanded_ns_versions.txt ./mc ls -r --versions myminio/versioned/ >expanded_ns_versions.txt
./mc admin decom start myminio/ /tmp/xl/{1...10}/disk{0...1} ./mc admin decom start myminio/ /tmp/xl/{1...10}/disk{0...1}
until $(./mc admin decom status myminio/ | grep -q Complete) until $(./mc admin decom status myminio/ | grep -q Complete); do
do echo "waiting for decom to finish..."
echo "waiting for decom to finish..." sleep 1
sleep 1
done done
kill $pid kill $pid
(minio server /tmp/xl/{11...30}/disk{0...3} 2>&1 >/tmp/removed.log)& (minio server /tmp/xl/{11...30}/disk{0...3} 2>&1 >/tmp/removed.log) &
pid=$! pid=$!
sleep 2 sleep 2
@ -101,43 +100,43 @@ decom_user_count=$(./mc admin user list myminio/ | wc -l)
decom_policy_count=$(./mc admin policy list myminio/ | wc -l) decom_policy_count=$(./mc admin policy list myminio/ | wc -l)
if [ $user_count -ne $decom_user_count ]; then if [ $user_count -ne $decom_user_count ]; then
echo "BUG: original user count differs after decommission" echo "BUG: original user count differs after decommission"
exit 1 exit 1
fi fi
if [ $policy_count -ne $decom_policy_count ]; then if [ $policy_count -ne $decom_policy_count ]; then
echo "BUG: original policy count differs after decommission" echo "BUG: original policy count differs after decommission"
exit 1 exit 1
fi fi
./mc version info myminio/versioned | grep -q "versioning is enabled" ./mc version info myminio/versioned | grep -q "versioning is enabled"
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected versioning enabled after decommission" echo "BUG: expected versioning enabled after decommission"
exit 1 exit 1
fi fi
got_checksum=$(./mc cat myminio/versioned/dsync/drwmutex.go | md5sum) got_checksum=$(./mc cat myminio/versioned/dsync/drwmutex.go | md5sum)
if [ "${expected_checksum}" != "${got_checksum}" ]; then if [ "${expected_checksum}" != "${got_checksum}" ]; then
echo "BUG: decommission failed on encrypted objects: expected ${expected_checksum} got ${got_checksum}" echo "BUG: decommission failed on encrypted objects: expected ${expected_checksum} got ${got_checksum}"
exit 1 exit 1
fi fi
./mc ls -r myminio/versioned > decommissioned_ns.txt ./mc ls -r myminio/versioned >decommissioned_ns.txt
./mc ls -r --versions myminio/versioned > decommissioned_ns_versions.txt ./mc ls -r --versions myminio/versioned >decommissioned_ns_versions.txt
out=$(diff -qpruN expanded_ns.txt decommissioned_ns.txt) out=$(diff -qpruN expanded_ns.txt decommissioned_ns.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no missing entries after decommission: $out" echo "BUG: expected no missing entries after decommission: $out"
exit 1 exit 1
fi fi
out=$(diff -qpruN expanded_ns_versions.txt decommissioned_ns_versions.txt) out=$(diff -qpruN expanded_ns_versions.txt decommissioned_ns_versions.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no missing entries after decommission: $out" echo "BUG: expected no missing entries after decommission: $out"
exit 1 exit 1
fi fi
# kill $pid # kill $pid

View File

@ -1,22 +1,22 @@
#!/bin/bash #!/bin/bash
if [ -n "$TEST_DEBUG" ]; then if [ -n "$TEST_DEBUG" ]; then
set -x set -x
fi fi
pkill minio pkill minio
rm -rf /tmp/xl rm -rf /tmp/xl
if [ ! -f ./mc ]; then if [ ! -f ./mc ]; then
wget --quiet -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc && \ wget --quiet -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc &&
chmod +x mc chmod +x mc
fi fi
export CI=true export CI=true
export MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= export MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw=
export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9000/" export MC_HOST_myminio="http://minioadmin:minioadmin@localhost:9000/"
(minio server /tmp/xl/{1...10}/disk{0...1} 2>&1 >/dev/null)& (minio server /tmp/xl/{1...10}/disk{0...1} 2>&1 >/dev/null) &
pid=$! pid=$!
sleep 2 sleep 2
@ -58,45 +58,44 @@ expanded_user_count=$(./mc admin user list myminio/ | wc -l)
expanded_policy_count=$(./mc admin policy list myminio/ | wc -l) expanded_policy_count=$(./mc admin policy list myminio/ | wc -l)
if [ $user_count -ne $expanded_user_count ]; then if [ $user_count -ne $expanded_user_count ]; then
echo "BUG: original user count differs from expanded setup" echo "BUG: original user count differs from expanded setup"
exit 1 exit 1
fi fi
if [ $policy_count -ne $expanded_policy_count ]; then if [ $policy_count -ne $expanded_policy_count ]; then
echo "BUG: original policy count differs from expanded setup" echo "BUG: original policy count differs from expanded setup"
exit 1 exit 1
fi fi
./mc version info myminio/versioned | grep -q "versioning is enabled" ./mc version info myminio/versioned | grep -q "versioning is enabled"
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "expected versioning enabled after expansion" echo "expected versioning enabled after expansion"
exit 1 exit 1
fi fi
./mc encrypt info myminio/versioned | grep -q "Auto encryption 'sse-s3' is enabled" ./mc encrypt info myminio/versioned | grep -q "Auto encryption 'sse-s3' is enabled"
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "expected encryption enabled after expansion" echo "expected encryption enabled after expansion"
exit 1 exit 1
fi fi
./mc mirror cmd myminio/versioned/ --quiet >/dev/null ./mc mirror cmd myminio/versioned/ --quiet >/dev/null
./mc ls -r myminio/versioned/ > expanded_ns.txt ./mc ls -r myminio/versioned/ >expanded_ns.txt
./mc ls -r --versions myminio/versioned/ > expanded_ns_versions.txt ./mc ls -r --versions myminio/versioned/ >expanded_ns_versions.txt
./mc admin decom start myminio/ /tmp/xl/{1...10}/disk{0...1} ./mc admin decom start myminio/ /tmp/xl/{1...10}/disk{0...1}
until $(./mc admin decom status myminio/ | grep -q Complete) until $(./mc admin decom status myminio/ | grep -q Complete); do
do echo "waiting for decom to finish..."
echo "waiting for decom to finish..." sleep 1
sleep 1
done done
kill $pid kill $pid
(minio server /tmp/xl/{11...30}/disk{0...3} 2>&1 >/tmp/removed.log)& (minio server /tmp/xl/{11...30}/disk{0...3} 2>&1 >/tmp/removed.log) &
pid=$! pid=$!
sleep 2 sleep 2
@ -105,50 +104,50 @@ decom_user_count=$(./mc admin user list myminio/ | wc -l)
decom_policy_count=$(./mc admin policy list myminio/ | wc -l) decom_policy_count=$(./mc admin policy list myminio/ | wc -l)
if [ $user_count -ne $decom_user_count ]; then if [ $user_count -ne $decom_user_count ]; then
echo "BUG: original user count differs after decommission" echo "BUG: original user count differs after decommission"
exit 1 exit 1
fi fi
if [ $policy_count -ne $decom_policy_count ]; then if [ $policy_count -ne $decom_policy_count ]; then
echo "BUG: original policy count differs after decommission" echo "BUG: original policy count differs after decommission"
exit 1 exit 1
fi fi
./mc version info myminio/versioned | grep -q "versioning is enabled" ./mc version info myminio/versioned | grep -q "versioning is enabled"
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected versioning enabled after decommission" echo "BUG: expected versioning enabled after decommission"
exit 1 exit 1
fi fi
./mc encrypt info myminio/versioned | grep -q "Auto encryption 'sse-s3' is enabled" ./mc encrypt info myminio/versioned | grep -q "Auto encryption 'sse-s3' is enabled"
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected encryption enabled after expansion" echo "BUG: expected encryption enabled after expansion"
exit 1 exit 1
fi fi
got_checksum=$(./mc cat myminio/versioned/dsync/drwmutex.go | md5sum) got_checksum=$(./mc cat myminio/versioned/dsync/drwmutex.go | md5sum)
if [ "${expected_checksum}" != "${got_checksum}" ]; then if [ "${expected_checksum}" != "${got_checksum}" ]; then
echo "BUG: decommission failed on encrypted objects: expected ${expected_checksum} got ${got_checksum}" echo "BUG: decommission failed on encrypted objects: expected ${expected_checksum} got ${got_checksum}"
exit 1 exit 1
fi fi
./mc ls -r myminio/versioned > decommissioned_ns.txt ./mc ls -r myminio/versioned >decommissioned_ns.txt
./mc ls -r --versions myminio/versioned > decommissioned_ns_versions.txt ./mc ls -r --versions myminio/versioned >decommissioned_ns_versions.txt
out=$(diff -qpruN expanded_ns.txt decommissioned_ns.txt) out=$(diff -qpruN expanded_ns.txt decommissioned_ns.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no missing entries after decommission: $out" echo "BUG: expected no missing entries after decommission: $out"
exit 1 exit 1
fi fi
out=$(diff -qpruN expanded_ns_versions.txt decommissioned_ns_versions.txt) out=$(diff -qpruN expanded_ns_versions.txt decommissioned_ns_versions.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no missing entries after decommission: $out" echo "BUG: expected no missing entries after decommission: $out"
exit 1 exit 1
fi fi
kill $pid kill $pid

View File

@ -1,22 +1,22 @@
#!/bin/bash #!/bin/bash
if [ -n "$TEST_DEBUG" ]; then if [ -n "$TEST_DEBUG" ]; then
set -x set -x
fi fi
pkill minio pkill minio
rm -rf /tmp/xl rm -rf /tmp/xl
if [ ! -f ./mc ]; then if [ ! -f ./mc ]; then
wget --quiet -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc && \ wget --quiet -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc &&
chmod +x mc chmod +x mc
fi fi
export CI=true export CI=true
export MINIO_KMS_AUTO_ENCRYPTION=on export MINIO_KMS_AUTO_ENCRYPTION=on
export MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= export MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw=
(minio server /tmp/xl/{1...10}/disk{0...1} 2>&1 >/dev/null)& (minio server /tmp/xl/{1...10}/disk{0...1} 2>&1 >/dev/null) &
pid=$! pid=$!
sleep 2 sleep 2
@ -57,38 +57,37 @@ expanded_user_count=$(./mc admin user list myminio/ | wc -l)
expanded_policy_count=$(./mc admin policy list myminio/ | wc -l) expanded_policy_count=$(./mc admin policy list myminio/ | wc -l)
if [ $user_count -ne $expanded_user_count ]; then if [ $user_count -ne $expanded_user_count ]; then
echo "BUG: original user count differs from expanded setup" echo "BUG: original user count differs from expanded setup"
exit 1 exit 1
fi fi
if [ $policy_count -ne $expanded_policy_count ]; then if [ $policy_count -ne $expanded_policy_count ]; then
echo "BUG: original policy count differs from expanded setup" echo "BUG: original policy count differs from expanded setup"
exit 1 exit 1
fi fi
./mc version info myminio/versioned | grep -q "versioning is enabled" ./mc version info myminio/versioned | grep -q "versioning is enabled"
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "expected versioning enabled after expansion" echo "expected versioning enabled after expansion"
exit 1 exit 1
fi fi
./mc mirror cmd myminio/versioned/ --quiet >/dev/null ./mc mirror cmd myminio/versioned/ --quiet >/dev/null
./mc ls -r myminio/versioned/ > expanded_ns.txt ./mc ls -r myminio/versioned/ >expanded_ns.txt
./mc ls -r --versions myminio/versioned/ > expanded_ns_versions.txt ./mc ls -r --versions myminio/versioned/ >expanded_ns_versions.txt
./mc admin decom start myminio/ /tmp/xl/{1...10}/disk{0...1} ./mc admin decom start myminio/ /tmp/xl/{1...10}/disk{0...1}
until $(./mc admin decom status myminio/ | grep -q Complete) until $(./mc admin decom status myminio/ | grep -q Complete); do
do echo "waiting for decom to finish..."
echo "waiting for decom to finish..." sleep 1
sleep 1
done done
kill $pid kill $pid
(minio server /tmp/xl/{11...30}/disk{0...3} 2>&1 >/dev/null)& (minio server /tmp/xl/{11...30}/disk{0...3} 2>&1 >/dev/null) &
pid=$! pid=$!
sleep 2 sleep 2
@ -97,43 +96,43 @@ decom_user_count=$(./mc admin user list myminio/ | wc -l)
decom_policy_count=$(./mc admin policy list myminio/ | wc -l) decom_policy_count=$(./mc admin policy list myminio/ | wc -l)
if [ $user_count -ne $decom_user_count ]; then if [ $user_count -ne $decom_user_count ]; then
echo "BUG: original user count differs after decommission" echo "BUG: original user count differs after decommission"
exit 1 exit 1
fi fi
if [ $policy_count -ne $decom_policy_count ]; then if [ $policy_count -ne $decom_policy_count ]; then
echo "BUG: original policy count differs after decommission" echo "BUG: original policy count differs after decommission"
exit 1 exit 1
fi fi
./mc version info myminio/versioned | grep -q "versioning is enabled" ./mc version info myminio/versioned | grep -q "versioning is enabled"
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected versioning enabled after decommission" echo "BUG: expected versioning enabled after decommission"
exit 1 exit 1
fi fi
./mc ls -r myminio/versioned > decommissioned_ns.txt ./mc ls -r myminio/versioned >decommissioned_ns.txt
./mc ls -r --versions myminio/versioned > decommissioned_ns_versions.txt ./mc ls -r --versions myminio/versioned >decommissioned_ns_versions.txt
out=$(diff -qpruN expanded_ns.txt decommissioned_ns.txt) out=$(diff -qpruN expanded_ns.txt decommissioned_ns.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no missing entries after decommission: $out" echo "BUG: expected no missing entries after decommission: $out"
exit 1 exit 1
fi fi
out=$(diff -qpruN expanded_ns_versions.txt decommissioned_ns_versions.txt) out=$(diff -qpruN expanded_ns_versions.txt decommissioned_ns_versions.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no missing entries after decommission: $out" echo "BUG: expected no missing entries after decommission: $out"
exit 1 exit 1
fi fi
got_checksum=$(./mc cat myminio/versioned/dsync/drwmutex.go | md5sum) got_checksum=$(./mc cat myminio/versioned/dsync/drwmutex.go | md5sum)
if [ "${expected_checksum}" != "${got_checksum}" ]; then if [ "${expected_checksum}" != "${got_checksum}" ]; then
echo "BUG: decommission failed on encrypted objects: expected ${expected_checksum} got ${got_checksum}" echo "BUG: decommission failed on encrypted objects: expected ${expected_checksum} got ${got_checksum}"
exit 1 exit 1
fi fi
kill $pid kill $pid

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
if [ -n "$TEST_DEBUG" ]; then if [ -n "$TEST_DEBUG" ]; then
set -x set -x
fi fi
pkill minio pkill minio
@ -9,13 +9,13 @@ rm -rf /tmp/xl
rm -rf /tmp/xltier rm -rf /tmp/xltier
if [ ! -f ./mc ]; then if [ ! -f ./mc ]; then
wget --quiet -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc && \ wget --quiet -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc &&
chmod +x mc chmod +x mc
fi fi
export CI=true export CI=true
(minio server /tmp/xl/{1...10}/disk{0...1} 2>&1 >/dev/null)& (minio server /tmp/xl/{1...10}/disk{0...1} 2>&1 >/dev/null) &
pid=$! pid=$!
sleep 2 sleep 2
@ -47,7 +47,7 @@ user_count=$(./mc admin user list myminio/ | wc -l)
policy_count=$(./mc admin policy list myminio/ | wc -l) policy_count=$(./mc admin policy list myminio/ | wc -l)
## create a warm tier instance ## create a warm tier instance
(minio server /tmp/xltier/{1...4}/disk{0...1} --address :9001 2>&1 >/dev/null)& (minio server /tmp/xltier/{1...4}/disk{0...1} --address :9001 2>&1 >/dev/null) &
sleep 2 sleep 2
export MC_HOST_mytier="http://minioadmin:minioadmin@localhost:9001/" export MC_HOST_mytier="http://minioadmin:minioadmin@localhost:9001/"
@ -58,10 +58,10 @@ export MC_HOST_mytier="http://minioadmin:minioadmin@localhost:9001/"
./mc ilm add myminio/bucket2 --transition-days 0 --transition-tier TIER1 --transition-days 0 ./mc ilm add myminio/bucket2 --transition-days 0 --transition-tier TIER1 --transition-days 0
## mirror some content to bucket2 and capture versions tiered ## mirror some content to bucket2 and capture versions tiered
./mc mirror internal myminio/bucket2/ --quiet >/dev/null ./mc mirror internal myminio/bucket2/ --quiet >/dev/null
./mc ls -r myminio/bucket2/ > bucket2_ns.txt ./mc ls -r myminio/bucket2/ >bucket2_ns.txt
./mc ls -r --versions myminio/bucket2/ > bucket2_ns_versions.txt ./mc ls -r --versions myminio/bucket2/ >bucket2_ns_versions.txt
sleep 2 sleep 2
./mc ls -r --versions mytier/tiered/ > tiered_ns_versions.txt ./mc ls -r --versions mytier/tiered/ >tiered_ns_versions.txt
kill $pid kill $pid
(minio server /tmp/xl/{1...10}/disk{0...1} /tmp/xl/{11...30}/disk{0...3} 2>&1 >/tmp/expanded.log) & (minio server /tmp/xl/{1...10}/disk{0...1} /tmp/xl/{11...30}/disk{0...3} 2>&1 >/tmp/expanded.log) &
@ -73,38 +73,37 @@ expanded_user_count=$(./mc admin user list myminio/ | wc -l)
expanded_policy_count=$(./mc admin policy list myminio/ | wc -l) expanded_policy_count=$(./mc admin policy list myminio/ | wc -l)
if [ $user_count -ne $expanded_user_count ]; then if [ $user_count -ne $expanded_user_count ]; then
echo "BUG: original user count differs from expanded setup" echo "BUG: original user count differs from expanded setup"
exit 1 exit 1
fi fi
if [ $policy_count -ne $expanded_policy_count ]; then if [ $policy_count -ne $expanded_policy_count ]; then
echo "BUG: original policy count differs from expanded setup" echo "BUG: original policy count differs from expanded setup"
exit 1 exit 1
fi fi
./mc version info myminio/versioned | grep -q "versioning is enabled" ./mc version info myminio/versioned | grep -q "versioning is enabled"
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "expected versioning enabled after expansion" echo "expected versioning enabled after expansion"
exit 1 exit 1
fi fi
./mc mirror cmd myminio/versioned/ --quiet >/dev/null ./mc mirror cmd myminio/versioned/ --quiet >/dev/null
./mc ls -r myminio/versioned/ > expanded_ns.txt ./mc ls -r myminio/versioned/ >expanded_ns.txt
./mc ls -r --versions myminio/versioned/ > expanded_ns_versions.txt ./mc ls -r --versions myminio/versioned/ >expanded_ns_versions.txt
./mc admin decom start myminio/ /tmp/xl/{1...10}/disk{0...1} ./mc admin decom start myminio/ /tmp/xl/{1...10}/disk{0...1}
until $(./mc admin decom status myminio/ | grep -q Complete) until $(./mc admin decom status myminio/ | grep -q Complete); do
do echo "waiting for decom to finish..."
echo "waiting for decom to finish..." sleep 1
sleep 1
done done
kill $pid kill $pid
(minio server /tmp/xl/{11...30}/disk{0...3} 2>&1 >/dev/null)& (minio server /tmp/xl/{11...30}/disk{0...3} 2>&1 >/dev/null) &
pid=$! pid=$!
sleep 2 sleep 2
@ -113,82 +112,82 @@ decom_user_count=$(./mc admin user list myminio/ | wc -l)
decom_policy_count=$(./mc admin policy list myminio/ | wc -l) decom_policy_count=$(./mc admin policy list myminio/ | wc -l)
if [ $user_count -ne $decom_user_count ]; then if [ $user_count -ne $decom_user_count ]; then
echo "BUG: original user count differs after decommission" echo "BUG: original user count differs after decommission"
exit 1 exit 1
fi fi
if [ $policy_count -ne $decom_policy_count ]; then if [ $policy_count -ne $decom_policy_count ]; then
echo "BUG: original policy count differs after decommission" echo "BUG: original policy count differs after decommission"
exit 1 exit 1
fi fi
./mc version info myminio/versioned | grep -q "versioning is enabled" ./mc version info myminio/versioned | grep -q "versioning is enabled"
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected versioning enabled after decommission" echo "BUG: expected versioning enabled after decommission"
exit 1 exit 1
fi fi
./mc ls -r myminio/versioned > decommissioned_ns.txt ./mc ls -r myminio/versioned >decommissioned_ns.txt
./mc ls -r --versions myminio/versioned > decommissioned_ns_versions.txt ./mc ls -r --versions myminio/versioned >decommissioned_ns_versions.txt
out=$(diff -qpruN expanded_ns.txt decommissioned_ns.txt) out=$(diff -qpruN expanded_ns.txt decommissioned_ns.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no missing entries after decommission: $out" echo "BUG: expected no missing entries after decommission: $out"
exit 1 exit 1
fi fi
out=$(diff -qpruN expanded_ns_versions.txt decommissioned_ns_versions.txt) out=$(diff -qpruN expanded_ns_versions.txt decommissioned_ns_versions.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no missing entries after decommission: $out" echo "BUG: expected no missing entries after decommission: $out"
exit 1 exit 1
fi fi
got_checksum=$(./mc cat myminio/versioned/dsync/drwmutex.go | md5sum) got_checksum=$(./mc cat myminio/versioned/dsync/drwmutex.go | md5sum)
if [ "${expected_checksum}" != "${got_checksum}" ]; then if [ "${expected_checksum}" != "${got_checksum}" ]; then
echo "BUG: decommission failed on encrypted objects: expected ${expected_checksum} got ${got_checksum}" echo "BUG: decommission failed on encrypted objects: expected ${expected_checksum} got ${got_checksum}"
exit 1 exit 1
fi fi
# after decommissioning, compare listings in bucket2 and tiered # after decommissioning, compare listings in bucket2 and tiered
./mc version info myminio/bucket2 | grep -q "versioning is enabled" ./mc version info myminio/bucket2 | grep -q "versioning is enabled"
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected versioning enabled after decommission on bucket2" echo "BUG: expected versioning enabled after decommission on bucket2"
exit 1 exit 1
fi fi
./mc ls -r myminio/bucket2 > decommissioned_bucket2_ns.txt ./mc ls -r myminio/bucket2 >decommissioned_bucket2_ns.txt
./mc ls -r --versions myminio/bucket2 > decommissioned_bucket2_ns_versions.txt ./mc ls -r --versions myminio/bucket2 >decommissioned_bucket2_ns_versions.txt
./mc ls -r --versions mytier/tiered/ > tiered_ns_versions2.txt ./mc ls -r --versions mytier/tiered/ >tiered_ns_versions2.txt
out=$(diff -qpruN bucket2_ns.txt decommissioned_bucket2_ns.txt) out=$(diff -qpruN bucket2_ns.txt decommissioned_bucket2_ns.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no missing entries after decommission in bucket2: $out" echo "BUG: expected no missing entries after decommission in bucket2: $out"
exit 1 exit 1
fi fi
out=$(diff -qpruN bucket2_ns_versions.txt decommissioned_bucket2_ns_versions.txt) out=$(diff -qpruN bucket2_ns_versions.txt decommissioned_bucket2_ns_versions.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no missing entries after decommission in bucket2x: $out" echo "BUG: expected no missing entries after decommission in bucket2x: $out"
exit 1 exit 1
fi fi
out=$(diff -qpruN tiered_ns_versions.txt tiered_ns_versions2.txt) out=$(diff -qpruN tiered_ns_versions.txt tiered_ns_versions2.txt)
ret=$? ret=$?
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "BUG: expected no missing entries after decommission in warm tier: $out" echo "BUG: expected no missing entries after decommission in warm tier: $out"
exit 1 exit 1
fi fi
got_checksum=$(./mc cat myminio/bucket2/dsync/drwmutex.go | md5sum) got_checksum=$(./mc cat myminio/bucket2/dsync/drwmutex.go | md5sum)
if [ "${expected_checksum}" != "${got_checksum}" ]; then if [ "${expected_checksum}" != "${got_checksum}" ]; then
echo "BUG: decommission failed on encrypted objects with tiering: expected ${expected_checksum} got ${got_checksum}" echo "BUG: decommission failed on encrypted objects with tiering: expected ${expected_checksum} got ${got_checksum}"
exit 1 exit 1
fi fi
kill $pid kill $pid

View File

@ -2,23 +2,23 @@
# shellcheck disable=SC2120 # shellcheck disable=SC2120
exit_1() { exit_1() {
cleanup cleanup
echo "minio1 ============" echo "minio1 ============"
cat /tmp/minio1_1.log cat /tmp/minio1_1.log
echo "minio2 ============" echo "minio2 ============"
cat /tmp/minio2_1.log cat /tmp/minio2_1.log
echo "minio3 ============" echo "minio3 ============"
cat /tmp/minio3_1.log cat /tmp/minio3_1.log
exit 1 exit 1
} }
cleanup() { cleanup() {
echo "Cleaning up instances of MinIO" echo "Cleaning up instances of MinIO"
pkill minio pkill minio
pkill -9 minio pkill -9 minio
rm -rf /tmp/minio-ldap-idp{1,2,3} rm -rf /tmp/minio-ldap-idp{1,2,3}
} }
cleanup cleanup
@ -45,8 +45,8 @@ export MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN="ou=swengg,dc=min,dc=io"
export MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER="(&(objectclass=groupOfNames)(member=%d))" export MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER="(&(objectclass=groupOfNames)(member=%d))"
if [ ! -f ./mc ]; then if [ ! -f ./mc ]; then
wget -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc \ wget -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc &&
&& chmod +x mc chmod +x mc
fi fi
minio server --config-dir /tmp/minio-ldap --address ":9001" /tmp/minio-ldap-idp1/{1...4} >/tmp/minio1_1.log 2>&1 & minio server --config-dir /tmp/minio-ldap --address ":9001" /tmp/minio-ldap-idp1/{1...4} >/tmp/minio1_1.log 2>&1 &
@ -80,72 +80,72 @@ sleep 5
sleep 10 sleep 10
./mc admin policy info minio1 rw ./mc admin policy info minio1 rw
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "expecting the command to fail, exiting.." echo "expecting the command to fail, exiting.."
exit_1; exit_1
fi fi
./mc admin policy info minio2 rw ./mc admin policy info minio2 rw
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "expecting the command to fail, exiting.." echo "expecting the command to fail, exiting.."
exit_1; exit_1
fi fi
./mc admin user info minio1 "uid=dillon,ou=people,ou=swengg,dc=min,dc=io" ./mc admin user info minio1 "uid=dillon,ou=people,ou=swengg,dc=min,dc=io"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "policy mapping missing, exiting.." echo "policy mapping missing, exiting.."
exit_1; exit_1
fi fi
./mc admin user info minio2 "uid=dillon,ou=people,ou=swengg,dc=min,dc=io" ./mc admin user info minio2 "uid=dillon,ou=people,ou=swengg,dc=min,dc=io"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "policy mapping missing, exiting.." echo "policy mapping missing, exiting.."
exit_1; exit_1
fi fi
./mc admin user info minio3 "uid=dillon,ou=people,ou=swengg,dc=min,dc=io" ./mc admin user info minio3 "uid=dillon,ou=people,ou=swengg,dc=min,dc=io"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "policy mapping missing, exiting.." echo "policy mapping missing, exiting.."
exit_1; exit_1
fi fi
# LDAP simple user # LDAP simple user
./mc admin user svcacct add minio2 dillon --access-key testsvc --secret-key testsvc123 ./mc admin user svcacct add minio2 dillon --access-key testsvc --secret-key testsvc123
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "adding svc account failed, exiting.." echo "adding svc account failed, exiting.."
exit_1; exit_1
fi fi
sleep 10 sleep 10
./mc admin user svcacct info minio1 testsvc ./mc admin user svcacct info minio1 testsvc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "svc account not mirrored, exiting.." echo "svc account not mirrored, exiting.."
exit_1; exit_1
fi fi
./mc admin user svcacct info minio2 testsvc ./mc admin user svcacct info minio2 testsvc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "svc account not mirrored, exiting.." echo "svc account not mirrored, exiting.."
exit_1; exit_1
fi fi
./mc admin user svcacct rm minio1 testsvc ./mc admin user svcacct rm minio1 testsvc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "removing svc account failed, exiting.." echo "removing svc account failed, exiting.."
exit_1; exit_1
fi fi
sleep 10 sleep 10
./mc admin user svcacct info minio2 testsvc ./mc admin user svcacct info minio2 testsvc
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "svc account found after delete, exiting.." echo "svc account found after delete, exiting.."
exit_1; exit_1
fi fi
./mc admin user svcacct info minio3 testsvc ./mc admin user svcacct info minio3 testsvc
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "svc account found after delete, exiting.." echo "svc account found after delete, exiting.."
exit_1; exit_1
fi fi
./mc mb minio1/newbucket ./mc mb minio1/newbucket
@ -161,14 +161,14 @@ expected_checksum=$(cat ./lrgfile | md5sum)
sleep 5 sleep 5
./mc stat minio2/newbucket ./mc stat minio2/newbucket
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting bucket to be present. exiting.." echo "expecting bucket to be present. exiting.."
exit_1; exit_1
fi fi
./mc stat minio3/newbucket ./mc stat minio3/newbucket
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting bucket to be present. exiting.." echo "expecting bucket to be present. exiting.."
exit_1; exit_1
fi fi
./mc cp README.md minio2/newbucket/ ./mc cp README.md minio2/newbucket/
@ -176,57 +176,57 @@ fi
sleep 5 sleep 5
./mc stat minio1/newbucket/README.md ./mc stat minio1/newbucket/README.md
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting object to be present. exiting.." echo "expecting object to be present. exiting.."
exit_1; exit_1
fi fi
./mc stat minio3/newbucket/README.md ./mc stat minio3/newbucket/README.md
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting object to be present. exiting.." echo "expecting object to be present. exiting.."
exit_1; exit_1
fi fi
sleep 10 sleep 10
./mc stat minio3/newbucket/lrgfile ./mc stat minio3/newbucket/lrgfile
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expected object to be present, exiting.." echo "expected object to be present, exiting.."
exit_1; exit_1
fi fi
actual_checksum=$(./mc cat minio3/newbucket/lrgfile | md5sum) actual_checksum=$(./mc cat minio3/newbucket/lrgfile | md5sum)
if [ "${expected_checksum}" != "${actual_checksum}" ]; then if [ "${expected_checksum}" != "${actual_checksum}" ]; then
echo "replication failed on multipart objects expected ${expected_checksum} got ${actual_checksum}" echo "replication failed on multipart objects expected ${expected_checksum} got ${actual_checksum}"
exit exit
fi fi
rm ./lrgfile rm ./lrgfile
vID=$(./mc stat minio2/newbucket/README.md --json | jq .versionID) vID=$(./mc stat minio2/newbucket/README.md --json | jq .versionID)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting object to be present. exiting.." echo "expecting object to be present. exiting.."
exit_1; exit_1
fi fi
./mc tag set --version-id "${vID}" minio2/newbucket/README.md "k=v" ./mc tag set --version-id "${vID}" minio2/newbucket/README.md "k=v"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting tag set to be successful. exiting.." echo "expecting tag set to be successful. exiting.."
exit_1; exit_1
fi fi
sleep 5 sleep 5
./mc tag remove --version-id "${vID}" minio2/newbucket/README.md ./mc tag remove --version-id "${vID}" minio2/newbucket/README.md
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting tag removal to be successful. exiting.." echo "expecting tag removal to be successful. exiting.."
exit_1; exit_1
fi fi
sleep 5 sleep 5
replStatus_minio2=$(./mc stat minio2/newbucket/README.md --json | jq -r .replicationStatus) replStatus_minio2=$(./mc stat minio2/newbucket/README.md --json | jq -r .replicationStatus)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting object to be present. exiting.." echo "expecting object to be present. exiting.."
exit_1; exit_1
fi fi
if [ ${replStatus_minio2} != "COMPLETED" ]; then if [ ${replStatus_minio2} != "COMPLETED" ]; then
echo "expected tag removal to have replicated, exiting..." echo "expected tag removal to have replicated, exiting..."
exit_1; exit_1
fi fi
./mc rm minio3/newbucket/README.md ./mc rm minio3/newbucket/README.md
@ -234,54 +234,54 @@ sleep 5
./mc stat minio2/newbucket/README.md ./mc stat minio2/newbucket/README.md
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "expected file to be deleted, exiting.." echo "expected file to be deleted, exiting.."
exit_1; exit_1
fi fi
./mc stat minio1/newbucket/README.md ./mc stat minio1/newbucket/README.md
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "expected file to be deleted, exiting.." echo "expected file to be deleted, exiting.."
exit_1; exit_1
fi fi
./mc mb --with-lock minio3/newbucket-olock ./mc mb --with-lock minio3/newbucket-olock
sleep 5 sleep 5
enabled_minio2=$(./mc stat --json minio2/newbucket-olock| jq -r .ObjectLock.enabled) enabled_minio2=$(./mc stat --json minio2/newbucket-olock | jq -r .ObjectLock.enabled)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expected bucket to be mirrored with object-lock but not present, exiting..." echo "expected bucket to be mirrored with object-lock but not present, exiting..."
exit_1; exit_1
fi fi
if [ "${enabled_minio2}" != "Enabled" ]; then if [ "${enabled_minio2}" != "Enabled" ]; then
echo "expected bucket to be mirrored with object-lock enabled, exiting..." echo "expected bucket to be mirrored with object-lock enabled, exiting..."
exit_1; exit_1
fi fi
enabled_minio1=$(./mc stat --json minio1/newbucket-olock| jq -r .ObjectLock.enabled) enabled_minio1=$(./mc stat --json minio1/newbucket-olock | jq -r .ObjectLock.enabled)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expected bucket to be mirrored with object-lock but not present, exiting..." echo "expected bucket to be mirrored with object-lock but not present, exiting..."
exit_1; exit_1
fi fi
if [ "${enabled_minio1}" != "Enabled" ]; then if [ "${enabled_minio1}" != "Enabled" ]; then
echo "expected bucket to be mirrored with object-lock enabled, exiting..." echo "expected bucket to be mirrored with object-lock enabled, exiting..."
exit_1; exit_1
fi fi
# "Test if most recent tag update is replicated" # "Test if most recent tag update is replicated"
./mc tag set minio2/newbucket "key=val1" ./mc tag set minio2/newbucket "key=val1"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting tag set to be successful. exiting.." echo "expecting tag set to be successful. exiting.."
exit_1; exit_1
fi fi
sleep 10 sleep 10
val=$(./mc tag list minio1/newbucket --json | jq -r .tagset | jq -r .key) val=$(./mc tag list minio1/newbucket --json | jq -r .tagset | jq -r .key)
if [ "${val}" != "val1" ]; then if [ "${val}" != "val1" ]; then
echo "expected bucket tag to have replicated, exiting..." echo "expected bucket tag to have replicated, exiting..."
exit_1; exit_1
fi fi
# stop minio1 # stop minio1
kill -9 ${site1_pid} kill -9 ${site1_pid}
@ -297,17 +297,17 @@ minio server --config-dir /tmp/minio-ldap --address ":9001" /tmp/minio-ldap-idp1
sleep 200 sleep 200
# Test whether most recent tag update on minio2 is replicated to minio1 # Test whether most recent tag update on minio2 is replicated to minio1
val=$(./mc tag list minio1/newbucket --json | jq -r .tagset | jq -r .key ) val=$(./mc tag list minio1/newbucket --json | jq -r .tagset | jq -r .key)
if [ "${val}" != "val2" ]; then if [ "${val}" != "val2" ]; then
echo "expected bucket tag to have replicated, exiting..." echo "expected bucket tag to have replicated, exiting..."
exit_1; exit_1
fi fi
# Test if bucket created/deleted when minio1 is down healed # Test if bucket created/deleted when minio1 is down healed
diff -q <(./mc ls minio1) <(./mc ls minio2) 1>/dev/null diff -q <(./mc ls minio1) <(./mc ls minio2) 1>/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expected 'bucket2' delete and 'newbucket2' creation to have replicated, exiting..." echo "expected 'bucket2' delete and 'newbucket2' creation to have replicated, exiting..."
exit_1; exit_1
fi fi
cleanup cleanup

View File

@ -2,23 +2,23 @@
# shellcheck disable=SC2120 # shellcheck disable=SC2120
exit_1() { exit_1() {
cleanup cleanup
echo "minio1 ============" echo "minio1 ============"
cat /tmp/minio1_1.log cat /tmp/minio1_1.log
echo "minio2 ============" echo "minio2 ============"
cat /tmp/minio2_1.log cat /tmp/minio2_1.log
echo "minio3 ============" echo "minio3 ============"
cat /tmp/minio3_1.log cat /tmp/minio3_1.log
exit 1 exit 1
} }
cleanup() { cleanup() {
echo "Cleaning up instances of MinIO" echo "Cleaning up instances of MinIO"
pkill minio pkill minio
pkill -9 minio pkill -9 minio
rm -rf /tmp/minio-internal-idp{1,2,3} rm -rf /tmp/minio-internal-idp{1,2,3}
} }
cleanup cleanup
@ -37,8 +37,8 @@ export MINIO_PROMETHEUS_AUTH_TYPE=public
export MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= export MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw=
if [ ! -f ./mc ]; then if [ ! -f ./mc ]; then
wget -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc \ wget -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc &&
&& chmod +x mc chmod +x mc
fi fi
minio server --config-dir /tmp/minio-internal --address ":9001" /tmp/minio-internal-idp1/{1...4} >/tmp/minio1_1.log 2>&1 & minio server --config-dir /tmp/minio-internal --address ":9001" /tmp/minio-internal-idp1/{1...4} >/tmp/minio1_1.log 2>&1 &
@ -90,83 +90,83 @@ sleep 10
./mc admin policy info minio1 rw ./mc admin policy info minio1 rw
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "expecting the command to fail, exiting.." echo "expecting the command to fail, exiting.."
exit_1; exit_1
fi fi
./mc admin policy info minio2 rw ./mc admin policy info minio2 rw
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "expecting the command to fail, exiting.." echo "expecting the command to fail, exiting.."
exit_1; exit_1
fi fi
./mc admin policy info minio3 rw ./mc admin policy info minio3 rw
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "expecting the command to fail, exiting.." echo "expecting the command to fail, exiting.."
exit_1; exit_1
fi fi
./mc admin user info minio1 foobar ./mc admin user info minio1 foobar
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "policy mapping missing on 'minio1', exiting.." echo "policy mapping missing on 'minio1', exiting.."
exit_1; exit_1
fi fi
./mc admin user info minio2 foobar ./mc admin user info minio2 foobar
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "policy mapping missing on 'minio2', exiting.." echo "policy mapping missing on 'minio2', exiting.."
exit_1; exit_1
fi fi
./mc admin user info minio3 foobar ./mc admin user info minio3 foobar
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "policy mapping missing on 'minio3', exiting.." echo "policy mapping missing on 'minio3', exiting.."
exit_1; exit_1
fi fi
./mc admin group info minio3 foobar-g ./mc admin group info minio3 foobar-g
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "group mapping missing on 'minio3', exiting.." echo "group mapping missing on 'minio3', exiting.."
exit_1; exit_1
fi fi
./mc admin user svcacct add minio2 foobar --access-key testsvc --secret-key testsvc123 ./mc admin user svcacct add minio2 foobar --access-key testsvc --secret-key testsvc123
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "adding svc account failed, exiting.." echo "adding svc account failed, exiting.."
exit_1; exit_1
fi fi
sleep 10 sleep 10
./mc admin user svcacct info minio1 testsvc ./mc admin user svcacct info minio1 testsvc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "svc account not mirrored, exiting.." echo "svc account not mirrored, exiting.."
exit_1; exit_1
fi fi
./mc admin user svcacct info minio2 testsvc ./mc admin user svcacct info minio2 testsvc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "svc account not mirrored, exiting.." echo "svc account not mirrored, exiting.."
exit_1; exit_1
fi fi
./mc admin user svcacct rm minio1 testsvc ./mc admin user svcacct rm minio1 testsvc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "removing svc account failed, exiting.." echo "removing svc account failed, exiting.."
exit_1; exit_1
fi fi
sleep 10 sleep 10
./mc admin user svcacct info minio2 testsvc ./mc admin user svcacct info minio2 testsvc
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "svc account found after delete, exiting.." echo "svc account found after delete, exiting.."
exit_1; exit_1
fi fi
./mc admin user svcacct info minio3 testsvc ./mc admin user svcacct info minio3 testsvc
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "svc account found after delete, exiting.." echo "svc account found after delete, exiting.."
exit_1; exit_1
fi fi
./mc mb minio1/newbucket ./mc mb minio1/newbucket
@ -179,25 +179,25 @@ expected_checksum=$(cat ./lrgfile | md5sum)
sleep 5 sleep 5
./mc stat minio2/newbucket ./mc stat minio2/newbucket
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting bucket to be present. exiting.." echo "expecting bucket to be present. exiting.."
exit_1; exit_1
fi fi
./mc stat minio3/newbucket ./mc stat minio3/newbucket
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting bucket to be present. exiting.." echo "expecting bucket to be present. exiting.."
exit_1; exit_1
fi fi
err_minio2=$(./mc stat minio2/newbucket/xxx --json | jq -r .error.cause.message) err_minio2=$(./mc stat minio2/newbucket/xxx --json | jq -r .error.cause.message)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting object to be missing. exiting.." echo "expecting object to be missing. exiting.."
exit_1; exit_1
fi fi
if [ "${err_minio2}" != "Object does not exist" ]; then if [ "${err_minio2}" != "Object does not exist" ]; then
echo "expected to see Object does not exist error, exiting..." echo "expected to see Object does not exist error, exiting..."
exit_1; exit_1
fi fi
./mc cp README.md minio2/newbucket/ ./mc cp README.md minio2/newbucket/
@ -205,58 +205,58 @@ fi
sleep 5 sleep 5
./mc stat minio1/newbucket/README.md ./mc stat minio1/newbucket/README.md
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting object to be present. exiting.." echo "expecting object to be present. exiting.."
exit_1; exit_1
fi fi
./mc stat minio3/newbucket/README.md ./mc stat minio3/newbucket/README.md
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting object to be present. exiting.." echo "expecting object to be present. exiting.."
exit_1; exit_1
fi fi
sleep 10 sleep 10
./mc stat minio3/newbucket/lrgfile ./mc stat minio3/newbucket/lrgfile
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expected object to be present, exiting.." echo "expected object to be present, exiting.."
exit_1; exit_1
fi fi
actual_checksum=$(./mc cat minio3/newbucket/lrgfile | md5sum) actual_checksum=$(./mc cat minio3/newbucket/lrgfile | md5sum)
if [ "${expected_checksum}" != "${actual_checksum}" ]; then if [ "${expected_checksum}" != "${actual_checksum}" ]; then
echo "replication failed on multipart objects expected ${expected_checksum} got ${actual_checksum}" echo "replication failed on multipart objects expected ${expected_checksum} got ${actual_checksum}"
exit exit
fi fi
rm ./lrgfile rm ./lrgfile
vID=$(./mc stat minio2/newbucket/README.md --json | jq .versionID) vID=$(./mc stat minio2/newbucket/README.md --json | jq .versionID)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting object to be present. exiting.." echo "expecting object to be present. exiting.."
exit_1; exit_1
fi fi
./mc tag set --version-id "${vID}" minio2/newbucket/README.md "k=v" ./mc tag set --version-id "${vID}" minio2/newbucket/README.md "k=v"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting tag set to be successful. exiting.." echo "expecting tag set to be successful. exiting.."
exit_1; exit_1
fi fi
sleep 5 sleep 5
./mc tag remove --version-id "${vID}" minio2/newbucket/README.md ./mc tag remove --version-id "${vID}" minio2/newbucket/README.md
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting tag removal to be successful. exiting.." echo "expecting tag removal to be successful. exiting.."
exit_1; exit_1
fi fi
sleep 5 sleep 5
replStatus_minio2=$(./mc stat minio2/newbucket/README.md --json | jq -r .replicationStatus ) replStatus_minio2=$(./mc stat minio2/newbucket/README.md --json | jq -r .replicationStatus)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting object to be present. exiting.." echo "expecting object to be present. exiting.."
exit_1; exit_1
fi fi
if [ ${replStatus_minio2} != "COMPLETED" ]; then if [ ${replStatus_minio2} != "COMPLETED" ]; then
echo "expected tag removal to have replicated, exiting..." echo "expected tag removal to have replicated, exiting..."
exit_1; exit_1
fi fi
./mc rm minio3/newbucket/README.md ./mc rm minio3/newbucket/README.md
@ -264,72 +264,72 @@ sleep 5
./mc stat minio2/newbucket/README.md ./mc stat minio2/newbucket/README.md
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "expected file to be deleted, exiting.." echo "expected file to be deleted, exiting.."
exit_1; exit_1
fi fi
./mc stat minio1/newbucket/README.md ./mc stat minio1/newbucket/README.md
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "expected file to be deleted, exiting.." echo "expected file to be deleted, exiting.."
exit_1; exit_1
fi fi
./mc mb --with-lock minio3/newbucket-olock ./mc mb --with-lock minio3/newbucket-olock
sleep 5 sleep 5
enabled_minio2=$(./mc stat --json minio2/newbucket-olock| jq -r .ObjectLock.enabled) enabled_minio2=$(./mc stat --json minio2/newbucket-olock | jq -r .ObjectLock.enabled)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expected bucket to be mirrored with object-lock but not present, exiting..." echo "expected bucket to be mirrored with object-lock but not present, exiting..."
exit_1; exit_1
fi fi
if [ "${enabled_minio2}" != "Enabled" ]; then if [ "${enabled_minio2}" != "Enabled" ]; then
echo "expected bucket to be mirrored with object-lock enabled, exiting..." echo "expected bucket to be mirrored with object-lock enabled, exiting..."
exit_1; exit_1
fi fi
enabled_minio1=$(./mc stat --json minio1/newbucket-olock| jq -r .ObjectLock.enabled) enabled_minio1=$(./mc stat --json minio1/newbucket-olock | jq -r .ObjectLock.enabled)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expected bucket to be mirrored with object-lock but not present, exiting..." echo "expected bucket to be mirrored with object-lock but not present, exiting..."
exit_1; exit_1
fi fi
if [ "${enabled_minio1}" != "Enabled" ]; then if [ "${enabled_minio1}" != "Enabled" ]; then
echo "expected bucket to be mirrored with object-lock enabled, exiting..." echo "expected bucket to be mirrored with object-lock enabled, exiting..."
exit_1; exit_1
fi fi
# "Test if most recent tag update is replicated" # "Test if most recent tag update is replicated"
./mc tag set minio2/newbucket "key=val1" ./mc tag set minio2/newbucket "key=val1"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting tag set to be successful. exiting.." echo "expecting tag set to be successful. exiting.."
exit_1; exit_1
fi fi
sleep 5 sleep 5
val=$(./mc tag list minio1/newbucket --json | jq -r .tagset | jq -r .key) val=$(./mc tag list minio1/newbucket --json | jq -r .tagset | jq -r .key)
if [ "${val}" != "val1" ]; then if [ "${val}" != "val1" ]; then
echo "expected bucket tag to have replicated, exiting..." echo "expected bucket tag to have replicated, exiting..."
exit_1; exit_1
fi fi
# Create user with policy consoleAdmin on minio1 # Create user with policy consoleAdmin on minio1
./mc admin user add minio1 foobarx foobar123 ./mc admin user add minio1 foobarx foobar123
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "adding user failed, exiting.." echo "adding user failed, exiting.."
exit_1; exit_1
fi fi
./mc admin policy attach minio1 consoleAdmin --user=foobarx ./mc admin policy attach minio1 consoleAdmin --user=foobarx
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "adding policy mapping failed, exiting.." echo "adding policy mapping failed, exiting.."
exit_1; exit_1
fi fi
sleep 10 sleep 10
# unset policy for foobarx in minio2 # unset policy for foobarx in minio2
./mc admin policy detach minio2 consoleAdmin --user=foobarx ./mc admin policy detach minio2 consoleAdmin --user=foobarx
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "unset policy mapping failed, exiting.." echo "unset policy mapping failed, exiting.."
exit_1; exit_1
fi fi
# create a bucket bucket2 on minio1. # create a bucket bucket2 on minio1.
@ -340,8 +340,8 @@ sleep 10
# Test whether policy detach replicated to minio1 # Test whether policy detach replicated to minio1
policy=$(./mc admin user info minio1 foobarx --json | jq -r .policyName) policy=$(./mc admin user info minio1 foobarx --json | jq -r .policyName)
if [ "${policy}" != "null" ]; then if [ "${policy}" != "null" ]; then
echo "expected policy detach to have replicated, exiting..." echo "expected policy detach to have replicated, exiting..."
exit_1; exit_1
fi fi
kill -9 ${site1_pid} kill -9 ${site1_pid}
@ -358,15 +358,15 @@ minio server --config-dir /tmp/minio-internal --address ":9001" /tmp/minio-inter
sleep 200 sleep 200
# Test whether most recent tag update on minio2 is replicated to minio1 # Test whether most recent tag update on minio2 is replicated to minio1
val=$(./mc tag list minio1/newbucket --json | jq -r .tagset | jq -r .key ) val=$(./mc tag list minio1/newbucket --json | jq -r .tagset | jq -r .key)
if [ "${val}" != "val2" ]; then if [ "${val}" != "val2" ]; then
echo "expected bucket tag to have replicated, exiting..." echo "expected bucket tag to have replicated, exiting..."
exit_1; exit_1
fi fi
# Test if bucket created/deleted when minio1 is down healed # Test if bucket created/deleted when minio1 is down healed
diff -q <(./mc ls minio1) <(./mc ls minio2) 1>/dev/null diff -q <(./mc ls minio1) <(./mc ls minio2) 1>/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expected 'bucket2' delete and 'newbucket2' creation to have replicated, exiting..." echo "expected 'bucket2' delete and 'newbucket2' creation to have replicated, exiting..."
exit_1; exit_1
fi fi

View File

@ -2,23 +2,23 @@
# shellcheck disable=SC2120 # shellcheck disable=SC2120
exit_1() { exit_1() {
cleanup cleanup
echo "minio1 ============" echo "minio1 ============"
cat /tmp/minio1_1.log cat /tmp/minio1_1.log
echo "minio2 ============" echo "minio2 ============"
cat /tmp/minio2_1.log cat /tmp/minio2_1.log
echo "minio3 ============" echo "minio3 ============"
cat /tmp/minio3_1.log cat /tmp/minio3_1.log
exit 1 exit 1
} }
cleanup() { cleanup() {
echo "Cleaning up instances of MinIO" echo "Cleaning up instances of MinIO"
pkill minio pkill minio
pkill -9 minio pkill -9 minio
rm -rf /tmp/minio{1,2,3} rm -rf /tmp/minio{1,2,3}
} }
cleanup cleanup
@ -53,8 +53,8 @@ minio server --address ":9003" --console-address ":12000" /tmp/minio3/{1...4} >/
site3_pid=$! site3_pid=$!
if [ ! -f ./mc ]; then if [ ! -f ./mc ]; then
wget -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc \ wget -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc &&
&& chmod +x mc chmod +x mc
fi fi
sleep 10 sleep 10
@ -70,13 +70,13 @@ sleep 5
./mc admin policy info minio2 projecta >/dev/null 2>&1 ./mc admin policy info minio2 projecta >/dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting the command to succeed, exiting.." echo "expecting the command to succeed, exiting.."
exit_1; exit_1
fi fi
./mc admin policy info minio3 projecta >/dev/null 2>&1 ./mc admin policy info minio3 projecta >/dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting the command to succeed, exiting.." echo "expecting the command to succeed, exiting.."
exit_1; exit_1
fi fi
./mc admin policy remove minio3 projecta ./mc admin policy remove minio3 projecta
@ -84,14 +84,14 @@ fi
sleep 10 sleep 10
./mc admin policy info minio1 projecta ./mc admin policy info minio1 projecta
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "expecting the command to fail, exiting.." echo "expecting the command to fail, exiting.."
exit_1; exit_1
fi fi
./mc admin policy info minio2 projecta ./mc admin policy info minio2 projecta
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "expecting the command to fail, exiting.." echo "expecting the command to fail, exiting.."
exit_1; exit_1
fi fi
./mc admin policy create minio1 projecta ./docs/site-replication/rw.json ./mc admin policy create minio1 projecta ./docs/site-replication/rw.json
@ -102,8 +102,8 @@ STS_CRED=$(MINIO_ENDPOINT=http://localhost:9001 go run ./docs/site-replication/g
MC_HOST_foo=http://${STS_CRED}@localhost:9001 ./mc ls foo MC_HOST_foo=http://${STS_CRED}@localhost:9001 ./mc ls foo
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Expected sts credential to work, exiting.." echo "Expected sts credential to work, exiting.."
exit_1; exit_1
fi fi
sleep 2 sleep 2
@ -111,14 +111,14 @@ sleep 2
# Check that the STS credential works on minio2 and minio3. # Check that the STS credential works on minio2 and minio3.
MC_HOST_foo=http://${STS_CRED}@localhost:9002 ./mc ls foo MC_HOST_foo=http://${STS_CRED}@localhost:9002 ./mc ls foo
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Expected sts credential to work, exiting.." echo "Expected sts credential to work, exiting.."
exit_1; exit_1
fi fi
MC_HOST_foo=http://${STS_CRED}@localhost:9003 ./mc ls foo MC_HOST_foo=http://${STS_CRED}@localhost:9003 ./mc ls foo
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Expected sts credential to work, exiting.." echo "Expected sts credential to work, exiting.."
exit_1; exit_1
fi fi
STS_ACCESS_KEY=$(echo ${STS_CRED} | cut -d ':' -f 1) STS_ACCESS_KEY=$(echo ${STS_CRED} | cut -d ':' -f 1)
@ -126,41 +126,41 @@ STS_ACCESS_KEY=$(echo ${STS_CRED} | cut -d ':' -f 1)
# Create service account for STS user # Create service account for STS user
./mc admin user svcacct add minio2 $STS_ACCESS_KEY --access-key testsvc --secret-key testsvc123 ./mc admin user svcacct add minio2 $STS_ACCESS_KEY --access-key testsvc --secret-key testsvc123
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "adding svc account failed, exiting.." echo "adding svc account failed, exiting.."
exit_1; exit_1
fi fi
sleep 10 sleep 10
./mc admin user svcacct info minio1 testsvc ./mc admin user svcacct info minio1 testsvc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "svc account not mirrored, exiting.." echo "svc account not mirrored, exiting.."
exit_1; exit_1
fi fi
./mc admin user svcacct info minio2 testsvc ./mc admin user svcacct info minio2 testsvc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "svc account not mirrored, exiting.." echo "svc account not mirrored, exiting.."
exit_1; exit_1
fi fi
./mc admin user svcacct rm minio1 testsvc ./mc admin user svcacct rm minio1 testsvc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "removing svc account failed, exiting.." echo "removing svc account failed, exiting.."
exit_1; exit_1
fi fi
sleep 10 sleep 10
./mc admin user svcacct info minio2 testsvc ./mc admin user svcacct info minio2 testsvc
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "svc account found after delete, exiting.." echo "svc account found after delete, exiting.."
exit_1; exit_1
fi fi
./mc admin user svcacct info minio3 testsvc ./mc admin user svcacct info minio3 testsvc
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "svc account found after delete, exiting.." echo "svc account found after delete, exiting.."
exit_1; exit_1
fi fi
# create a bucket bucket2 on minio1. # create a bucket bucket2 on minio1.
@ -176,14 +176,14 @@ expected_checksum=$(cat ./lrgfile | md5sum)
sleep 5 sleep 5
./mc stat minio2/newbucket ./mc stat minio2/newbucket
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting bucket to be present. exiting.." echo "expecting bucket to be present. exiting.."
exit_1; exit_1
fi fi
./mc stat minio3/newbucket ./mc stat minio3/newbucket
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting bucket to be present. exiting.." echo "expecting bucket to be present. exiting.."
exit_1; exit_1
fi fi
./mc cp README.md minio2/newbucket/ ./mc cp README.md minio2/newbucket/
@ -191,14 +191,14 @@ fi
sleep 5 sleep 5
./mc stat minio1/newbucket/README.md ./mc stat minio1/newbucket/README.md
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting object to be present. exiting.." echo "expecting object to be present. exiting.."
exit_1; exit_1
fi fi
./mc stat minio3/newbucket/README.md ./mc stat minio3/newbucket/README.md
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting object to be present. exiting.." echo "expecting object to be present. exiting.."
exit_1; exit_1
fi fi
./mc rm minio3/newbucket/README.md ./mc rm minio3/newbucket/README.md
@ -206,66 +206,66 @@ sleep 5
./mc stat minio2/newbucket/README.md ./mc stat minio2/newbucket/README.md
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "expected file to be deleted, exiting.." echo "expected file to be deleted, exiting.."
exit_1; exit_1
fi fi
./mc stat minio1/newbucket/README.md ./mc stat minio1/newbucket/README.md
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "expected file to be deleted, exiting.." echo "expected file to be deleted, exiting.."
exit_1; exit_1
fi fi
sleep 10 sleep 10
./mc stat minio3/newbucket/lrgfile ./mc stat minio3/newbucket/lrgfile
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expected object to be present, exiting.." echo "expected object to be present, exiting.."
exit_1; exit_1
fi fi
actual_checksum=$(./mc cat minio3/newbucket/lrgfile | md5sum) actual_checksum=$(./mc cat minio3/newbucket/lrgfile | md5sum)
if [ "${expected_checksum}" != "${actual_checksum}" ]; then if [ "${expected_checksum}" != "${actual_checksum}" ]; then
echo "replication failed on multipart objects expected ${expected_checksum} got ${actual_checksum}" echo "replication failed on multipart objects expected ${expected_checksum} got ${actual_checksum}"
exit exit
fi fi
rm ./lrgfile rm ./lrgfile
./mc mb --with-lock minio3/newbucket-olock ./mc mb --with-lock minio3/newbucket-olock
sleep 5 sleep 5
enabled_minio2=$(./mc stat --json minio2/newbucket-olock| jq -r .ObjectLock.enabled) enabled_minio2=$(./mc stat --json minio2/newbucket-olock | jq -r .ObjectLock.enabled)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expected bucket to be mirrored with object-lock but not present, exiting..." echo "expected bucket to be mirrored with object-lock but not present, exiting..."
exit_1; exit_1
fi fi
if [ "${enabled_minio2}" != "Enabled" ]; then if [ "${enabled_minio2}" != "Enabled" ]; then
echo "expected bucket to be mirrored with object-lock enabled, exiting..." echo "expected bucket to be mirrored with object-lock enabled, exiting..."
exit_1; exit_1
fi fi
enabled_minio1=$(./mc stat --json minio1/newbucket-olock| jq -r .ObjectLock.enabled) enabled_minio1=$(./mc stat --json minio1/newbucket-olock | jq -r .ObjectLock.enabled)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expected bucket to be mirrored with object-lock but not present, exiting..." echo "expected bucket to be mirrored with object-lock but not present, exiting..."
exit_1; exit_1
fi fi
if [ "${enabled_minio1}" != "Enabled" ]; then if [ "${enabled_minio1}" != "Enabled" ]; then
echo "expected bucket to be mirrored with object-lock enabled, exiting..." echo "expected bucket to be mirrored with object-lock enabled, exiting..."
exit_1; exit_1
fi fi
# "Test if most recent tag update is replicated" # "Test if most recent tag update is replicated"
./mc tag set minio2/newbucket "key=val1" ./mc tag set minio2/newbucket "key=val1"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expecting tag set to be successful. exiting.." echo "expecting tag set to be successful. exiting.."
exit_1; exit_1
fi fi
sleep 10 sleep 10
val=$(./mc tag list minio1/newbucket --json | jq -r .tagset | jq -r .key) val=$(./mc tag list minio1/newbucket --json | jq -r .tagset | jq -r .key)
if [ "${val}" != "val1" ]; then if [ "${val}" != "val1" ]; then
echo "expected bucket tag to have replicated, exiting..." echo "expected bucket tag to have replicated, exiting..."
exit_1; exit_1
fi fi
# stop minio1 instance # stop minio1 instance
kill -9 ${site1_pid} kill -9 ${site1_pid}
@ -281,15 +281,15 @@ minio server --address ":9001" --console-address ":10000" /tmp/minio1/{1...4} >/
sleep 200 sleep 200
# Test whether most recent tag update on minio2 is replicated to minio1 # Test whether most recent tag update on minio2 is replicated to minio1
val=$(./mc tag list minio1/newbucket --json | jq -r .tagset | jq -r .key ) val=$(./mc tag list minio1/newbucket --json | jq -r .tagset | jq -r .key)
if [ "${val}" != "val2" ]; then if [ "${val}" != "val2" ]; then
echo "expected bucket tag to have replicated, exiting..." echo "expected bucket tag to have replicated, exiting..."
exit_1; exit_1
fi fi
# Test if bucket created/deleted when minio1 is down healed # Test if bucket created/deleted when minio1 is down healed
diff -q <(./mc ls minio1) <(./mc ls minio2) 1>/dev/null diff -q <(./mc ls minio1) <(./mc ls minio2) 1>/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "expected 'bucket2' delete and 'newbucket2' creation to have replicated, exiting..." echo "expected 'bucket2' delete and 'newbucket2' creation to have replicated, exiting..."
exit_1; exit_1
fi fi