2021-08-26 21:53:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-08-30 08:33:17 +00:00
|
|
|
# Usage for local run:
|
|
|
|
#
|
|
|
|
# ./docker/test/stateless/setup_minio.sh ./tests/
|
|
|
|
#
|
|
|
|
|
|
|
|
set -e -x -a -u
|
2021-08-26 21:53:32 +00:00
|
|
|
|
2021-08-29 19:32:37 +00:00
|
|
|
ls -lha
|
2021-08-27 14:22:04 +00:00
|
|
|
|
2021-08-30 08:33:17 +00:00
|
|
|
mkdir -p ./minio_data
|
|
|
|
|
|
|
|
if [ ! -f ./minio ]; then
|
|
|
|
echo 'MinIO binary not found, downloading...'
|
|
|
|
|
|
|
|
BINARY_TYPE=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
|
|
|
|
|
|
wget "https://dl.min.io/server/minio/release/${BINARY_TYPE}-amd64/minio" \
|
|
|
|
&& chmod +x ./minio \
|
|
|
|
&& wget "https://dl.min.io/client/mc/release/${BINARY_TYPE}-amd64/mc" \
|
|
|
|
&& chmod +x ./mc
|
|
|
|
fi
|
|
|
|
|
|
|
|
MINIO_ROOT_USER=${MINIO_ROOT_USER:-clickhouse}
|
|
|
|
MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD:-clickhouse}
|
|
|
|
|
|
|
|
./minio server --address ":11111" ./minio_data &
|
2021-08-29 19:32:37 +00:00
|
|
|
|
2021-08-30 10:45:46 +00:00
|
|
|
while ! curl -v --silent http://localhost:11111 2>&1 | grep AccessDenied
|
2021-08-29 19:32:37 +00:00
|
|
|
do
|
|
|
|
echo "Trying to connect to minio"
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
|
|
|
lsof -i :11111
|
|
|
|
|
2021-08-29 23:08:12 +00:00
|
|
|
sleep 5
|
|
|
|
|
2021-08-29 19:32:37 +00:00
|
|
|
./mc alias set clickminio http://localhost:11111 clickhouse clickhouse
|
|
|
|
./mc admin user add clickminio test testtest
|
|
|
|
./mc admin policy set clickminio readwrite user=test
|
|
|
|
./mc mb clickminio/test
|
2021-08-26 21:53:32 +00:00
|
|
|
|
2021-08-27 13:12:19 +00:00
|
|
|
|
|
|
|
# Upload data to Minio. By default after unpacking all tests will in
|
|
|
|
# /usr/share/clickhouse-test/queries
|
|
|
|
|
2021-08-30 08:33:17 +00:00
|
|
|
TEST_PATH=${1:-/usr/share/clickhouse-test}
|
|
|
|
MINIO_DATA_PATH=${TEST_PATH}/queries/0_stateless/data_minio
|
2021-08-29 20:31:54 +00:00
|
|
|
|
2021-08-31 12:51:11 +00:00
|
|
|
# Iterating over globs will cause redudant FILE variale to be a path to a file, not a filename
|
|
|
|
# shellcheck disable=SC2045
|
|
|
|
for FILE in $(ls "${MINIO_DATA_PATH}"); do
|
|
|
|
echo "$FILE";
|
|
|
|
./mc cp "${MINIO_DATA_PATH}"/"$FILE" clickminio/test/"$FILE";
|
2021-08-29 22:21:05 +00:00
|
|
|
done
|