2017-09-12 19:56:33 -04:00
#!/bin/bash
#
2017-09-20 16:22:05 -04:00
set -e
set -E
set -o pipefail
2017-09-12 19:56:33 -04:00
2017-09-20 16:22:05 -04:00
if [ ! -x " $PWD /minio " ] ; then
echo "minio executable binary not found in current directory"
exit 1
fi
2017-09-12 19:56:33 -04:00
2017-09-20 16:22:05 -04:00
WORK_DIR = " $PWD /.verify- $RANDOM "
2017-09-12 19:56:33 -04:00
2017-09-20 16:22:05 -04:00
export MINT_MODE = core
export MINT_DATA_DIR = " $WORK_DIR /data "
export SERVER_ENDPOINT = "127.0.0.1:9000"
export ACCESS_KEY = "minio"
export SECRET_KEY = "minio123"
export ENABLE_HTTPS = 0
2019-04-02 21:28:39 -04:00
export GO111MODULE = on
2021-03-17 12:38:38 -04:00
export GOGC = 25
2021-10-18 12:31:55 -04:00
export ENABLE_ADMIN = 1
2017-09-12 19:56:33 -04:00
2022-02-13 18:42:07 -05:00
export MINIO_CI_CD = 1
2017-09-20 16:22:05 -04:00
MINIO_CONFIG_DIR = " $WORK_DIR /.minio "
MINIO = ( " $PWD /minio " --config-dir " $MINIO_CONFIG_DIR " )
2017-09-12 19:56:33 -04:00
2017-09-20 16:22:05 -04:00
FILE_1_MB = " $MINT_DATA_DIR /datafile-1-MB "
FILE_65_MB = " $MINT_DATA_DIR /datafile-65-MB "
2017-09-12 19:56:33 -04:00
2017-09-20 16:22:05 -04:00
FUNCTIONAL_TESTS = " $WORK_DIR /functional-tests.sh "
2017-09-12 19:56:33 -04:00
function start_minio_fs( )
{
2021-06-11 01:28:09 -04:00
export MINIO_ROOT_USER = $ACCESS_KEY
export MINIO_ROOT_PASSWORD = $SECRET_KEY
2017-09-20 16:22:05 -04:00
" ${ MINIO [@] } " server " ${ WORK_DIR } /fs-disk " >" $WORK_DIR /fs-minio.log " 2>& 1 &
2018-02-15 20:45:57 -05:00
sleep 10
2017-09-12 19:56:33 -04:00
}
2018-02-15 20:45:57 -05:00
function start_minio_erasure( )
2017-09-12 19:56:33 -04:00
{
2018-02-15 20:45:57 -05:00
" ${ 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
}
function start_minio_erasure_sets( )
{
2020-12-10 10:28:37 -05:00
export MINIO_ENDPOINTS = " ${ WORK_DIR } /erasure-disk-sets{1...32} "
" ${ MINIO [@] } " server > " $WORK_DIR /erasure-minio-sets.log " 2>& 1 &
2018-02-15 20:45:57 -05:00
sleep 15
2017-09-12 19:56:33 -04:00
}
2020-12-05 16:00:44 -05:00
function start_minio_pool_erasure_sets( )
2018-12-14 02:37:46 -05:00
{
2021-01-05 13:22:57 -05:00
export MINIO_ROOT_USER = $ACCESS_KEY
export MINIO_ROOT_PASSWORD = $SECRET_KEY
2020-12-10 10:28:37 -05:00
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 ":9001" > " $WORK_DIR /pool-minio-9001.log " 2>& 1 &
2019-12-02 18:54:26 -05:00
sleep 40
2018-02-15 20:45:57 -05:00
}
2020-12-05 16:00:44 -05:00
function start_minio_pool_erasure_sets_ipv6( )
2019-11-21 07:24:51 -05:00
{
2021-01-05 13:22:57 -05:00
export MINIO_ROOT_USER = $ACCESS_KEY
export MINIO_ROOT_PASSWORD = $SECRET_KEY
2021-12-02 15:40:48 -05:00
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} "
2020-12-10 10:28:37 -05:00
" ${ 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 &
2019-11-21 07:24:51 -05:00
2019-12-02 18:54:26 -05:00
sleep 40
2019-11-21 07:24:51 -05:00
}
2018-02-15 20:45:57 -05:00
function start_minio_dist_erasure( )
2017-09-12 19:56:33 -04:00
{
2021-01-05 13:22:57 -05:00
export MINIO_ROOT_USER = $ACCESS_KEY
export MINIO_ROOT_PASSWORD = $SECRET_KEY
2020-12-10 10:28:37 -05:00
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
" ${ MINIO [@] } " server --address " :900 ${ i } " > " $WORK_DIR /dist-minio-900 ${ i } .log " 2>& 1 &
done
2017-09-12 19:56:33 -04:00
2019-12-02 18:54:26 -05:00
sleep 40
2017-09-12 19:56:33 -04:00
}
function run_test_fs( )
{
2020-09-11 09:39:19 -04:00
start_minio_fs
2017-09-12 19:56:33 -04:00
2017-09-20 16:22:05 -04:00
( cd " $WORK_DIR " && " $FUNCTIONAL_TESTS " )
2017-09-12 19:56:33 -04:00
rv = $?
2020-09-11 09:39:19 -04:00
pkill minio
2017-09-12 19:56:33 -04:00
sleep 3
if [ " $rv " -ne 0 ] ; then
2017-10-04 14:16:39 -04:00
cat " $WORK_DIR /fs-minio.log "
2017-09-12 19:56:33 -04:00
fi
2017-10-04 14:16:39 -04:00
rm -f " $WORK_DIR /fs-minio.log "
2017-09-12 19:56:33 -04:00
return " $rv "
}
2020-12-10 10:28:37 -05:00
function run_test_erasure_sets( )
{
2020-09-11 09:39:19 -04:00
start_minio_erasure_sets
2018-02-15 20:45:57 -05:00
( cd " $WORK_DIR " && " $FUNCTIONAL_TESTS " )
rv = $?
2020-09-11 09:39:19 -04:00
pkill minio
2018-02-15 20:45:57 -05:00
sleep 3
if [ " $rv " -ne 0 ] ; then
cat " $WORK_DIR /erasure-minio-sets.log "
fi
rm -f " $WORK_DIR /erasure-minio-sets.log "
return " $rv "
}
2020-12-05 16:00:44 -05:00
function run_test_pool_erasure_sets( )
2018-02-15 20:45:57 -05:00
{
2020-12-05 16:00:44 -05:00
start_minio_pool_erasure_sets
2018-02-15 20:45:57 -05:00
( cd " $WORK_DIR " && " $FUNCTIONAL_TESTS " )
rv = $?
2020-09-11 09:39:19 -04:00
pkill minio
2018-02-15 20:45:57 -05:00
sleep 3
if [ " $rv " -ne 0 ] ; then
2019-12-02 18:54:26 -05:00
for i in $( seq 0 1) ; do
2018-02-15 20:45:57 -05:00
echo " server $i log: "
2020-12-05 16:00:44 -05:00
cat " $WORK_DIR /pool-minio-900 $i .log "
2018-02-15 20:45:57 -05:00
done
fi
2019-12-02 18:54:26 -05:00
for i in $( seq 0 1) ; do
2020-12-05 16:00:44 -05:00
rm -f " $WORK_DIR /pool-minio-900 $i .log "
2018-02-15 20:45:57 -05:00
done
return " $rv "
}
2020-12-05 16:00:44 -05:00
function run_test_pool_erasure_sets_ipv6( )
2019-11-21 07:24:51 -05:00
{
2020-12-05 16:00:44 -05:00
start_minio_pool_erasure_sets_ipv6
2019-12-02 18:54:26 -05:00
export SERVER_ENDPOINT = "[::1]:9000"
2019-11-21 07:24:51 -05:00
( cd " $WORK_DIR " && " $FUNCTIONAL_TESTS " )
rv = $?
2020-09-11 09:39:19 -04:00
pkill minio
2019-11-21 07:24:51 -05:00
sleep 3
if [ " $rv " -ne 0 ] ; then
for i in $( seq 0 1) ; do
echo " server $i log: "
2020-12-05 16:00:44 -05:00
cat " $WORK_DIR /pool-minio-ipv6-900 $i .log "
2019-11-21 07:24:51 -05:00
done
fi
for i in $( seq 0 1) ; do
2020-12-05 16:00:44 -05:00
rm -f " $WORK_DIR /pool-minio-ipv6-900 $i .log "
2019-11-21 07:24:51 -05:00
done
return " $rv "
}
2018-02-15 20:45:57 -05:00
function run_test_erasure( )
2017-09-12 19:56:33 -04:00
{
2020-09-11 09:39:19 -04:00
start_minio_erasure
2017-09-12 19:56:33 -04:00
2017-09-20 16:22:05 -04:00
( cd " $WORK_DIR " && " $FUNCTIONAL_TESTS " )
2017-09-12 19:56:33 -04:00
rv = $?
2020-09-11 09:39:19 -04:00
pkill minio
2017-09-12 19:56:33 -04:00
sleep 3
if [ " $rv " -ne 0 ] ; then
2018-02-15 20:45:57 -05:00
cat " $WORK_DIR /erasure-minio.log "
2017-09-12 19:56:33 -04:00
fi
2018-02-15 20:45:57 -05:00
rm -f " $WORK_DIR /erasure-minio.log "
2017-09-12 19:56:33 -04:00
return " $rv "
}
2018-02-15 20:45:57 -05:00
function run_test_dist_erasure( )
2017-09-12 19:56:33 -04:00
{
2020-09-11 09:39:19 -04:00
start_minio_dist_erasure
2017-09-12 19:56:33 -04:00
2017-09-20 16:22:05 -04:00
( cd " $WORK_DIR " && " $FUNCTIONAL_TESTS " )
2017-09-12 19:56:33 -04:00
rv = $?
2020-09-11 09:39:19 -04:00
pkill minio
2017-09-12 19:56:33 -04:00
sleep 3
if [ " $rv " -ne 0 ] ; then
echo "server1 log:"
2017-10-04 14:16:39 -04:00
cat " $WORK_DIR /dist-minio-9000.log "
2017-09-12 19:56:33 -04:00
echo "server2 log:"
2017-10-04 14:16:39 -04:00
cat " $WORK_DIR /dist-minio-9001.log "
2017-09-12 19:56:33 -04:00
echo "server3 log:"
2017-10-04 14:16:39 -04:00
cat " $WORK_DIR /dist-minio-9002.log "
2017-09-12 19:56:33 -04:00
echo "server4 log:"
2017-10-04 14:16:39 -04:00
cat " $WORK_DIR /dist-minio-9003.log "
2017-09-12 19:56:33 -04:00
fi
2018-02-15 20:45:57 -05:00
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 "
2017-09-12 19:56:33 -04:00
2020-12-10 10:28:37 -05:00
return " $rv "
2017-09-12 19:56:33 -04:00
}
2019-04-02 21:28:39 -04:00
function purge( )
2017-10-04 14:16:39 -04:00
{
2019-04-02 21:28:39 -04:00
rm -rf " $1 "
2017-10-04 14:16:39 -04:00
}
2017-09-20 16:22:05 -04:00
function __init__( )
2017-09-12 19:56:33 -04:00
{
2017-09-20 16:22:05 -04:00
echo "Initializing environment"
mkdir -p " $WORK_DIR "
mkdir -p " $MINIO_CONFIG_DIR "
mkdir -p " $MINT_DATA_DIR "
2017-09-12 19:56:33 -04:00
2019-04-02 21:28:39 -04:00
MC_BUILD_DIR = " mc- $RANDOM "
if ! git clone --quiet https://github.com/minio/mc " $MC_BUILD_DIR " ; then
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 " )
2017-09-12 19:56:33 -04:00
2019-04-02 21:28:39 -04:00
# remove mc source.
purge " ${ MC_BUILD_DIR } "
2017-09-20 16:22:05 -04:00
2017-10-04 14:16:39 -04:00
shred -n 1 -s 1M - 1>" $FILE_1_MB " 2>/dev/null
shred -n 1 -s 65M - 1>" $FILE_65_MB " 2>/dev/null
2017-09-12 19:56:33 -04:00
2017-09-20 16:22:05 -04:00
## 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 "
2017-09-12 19:56:33 -04:00
2017-09-20 16:22:05 -04:00
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"
exit 1
fi
2017-09-12 19:56:33 -04:00
2018-12-14 02:37:46 -05:00
sed -i 's|-sS|-sSg|g' " $FUNCTIONAL_TESTS "
2017-09-20 16:22:05 -04:00
chmod a+x " $FUNCTIONAL_TESTS "
}
2017-09-12 19:56:33 -04:00
2017-09-20 16:22:05 -04:00
function main( )
{
echo "Testing in FS setup"
2017-09-12 19:56:33 -04:00
if ! run_test_fs; then
2017-10-04 14:16:39 -04:00
echo "FAILED"
2019-04-02 21:28:39 -04:00
purge " $WORK_DIR "
2017-09-12 19:56:33 -04:00
exit 1
fi
2018-02-15 20:45:57 -05:00
echo "Testing in Erasure setup"
if ! run_test_erasure; then
echo "FAILED"
2019-04-02 21:28:39 -04:00
purge " $WORK_DIR "
2018-02-15 20:45:57 -05:00
exit 1
fi
echo "Testing in Distributed Erasure setup"
if ! run_test_dist_erasure; then
echo "FAILED"
2019-04-02 21:28:39 -04:00
purge " $WORK_DIR "
2018-02-15 20:45:57 -05:00
exit 1
fi
echo "Testing in Erasure setup as sets"
if ! run_test_erasure_sets; then
2017-10-04 14:16:39 -04:00
echo "FAILED"
2019-04-02 21:28:39 -04:00
purge " $WORK_DIR "
2017-09-12 19:56:33 -04:00
exit 1
fi
2019-11-21 07:24:51 -05:00
echo "Testing in Distributed Eraure expanded setup"
2020-12-05 16:00:44 -05:00
if ! run_test_pool_erasure_sets; then
2019-11-21 07:24:51 -05:00
echo "FAILED"
purge " $WORK_DIR "
exit 1
fi
2019-12-02 18:54:26 -05:00
echo "Testing in Distributed Erasure expanded setup with ipv6"
2020-12-05 16:00:44 -05:00
if ! run_test_pool_erasure_sets_ipv6; then
2018-12-14 02:37:46 -05:00
echo "FAILED"
2019-04-02 21:28:39 -04:00
purge " $WORK_DIR "
2017-09-12 19:56:33 -04:00
exit 1
fi
2019-04-02 21:28:39 -04:00
purge " $WORK_DIR "
2017-09-12 19:56:33 -04:00
}
2017-09-20 16:22:05 -04:00
( __init__ " $@ " && main " $@ " )
rv = $?
2019-04-02 21:28:39 -04:00
purge " $WORK_DIR "
2017-09-20 16:22:05 -04:00
exit " $rv "