Skip to content

Commit

Permalink
Experiment with minio
Browse files Browse the repository at this point in the history
This allows testing SSE which S3Proxy does not.

TODO: Remove SSE hard-coding.
  • Loading branch information
gaul committed Jul 22, 2023
1 parent 5371cd1 commit 6ada1f6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
32 changes: 12 additions & 20 deletions test/integration-test-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export TEST_BUCKET_MOUNT_POINT_1=${TEST_BUCKET_1}

S3PROXY_VERSION="2.0.0"
S3PROXY_BINARY="${S3PROXY_BINARY-"s3proxy-${S3PROXY_VERSION}"}"
MINIO_BINARY="${MINIO_BINARY-minio}"

CHAOS_HTTP_PROXY_VERSION="1.1.0"
CHAOS_HTTP_PROXY_BINARY="chaos-http-proxy-${CHAOS_HTTP_PROXY_VERSION}"
Expand Down Expand Up @@ -142,22 +143,12 @@ function retry {
# PUBLIC=1: use s3proxy-noauth.conf (no request signing)
#
function start_s3proxy {
if [ -n "${PUBLIC}" ]; then
local S3PROXY_CONFIG="s3proxy-noauth.conf"
else
if [ -z "${CHAOS_HTTP_PROXY}" ] && [ -z "${CHAOS_HTTP_PROXY_OPT}" ]; then
local S3PROXY_CONFIG="s3proxy.conf"
else
local S3PROXY_CONFIG="s3proxy_http.conf"
fi
fi

if [ -n "${S3PROXY_BINARY}" ]
if [ -n "${MINIO_BINARY}" ]
then
if [ ! -e "${S3PROXY_BINARY}" ]; then
curl "https://github.com/gaul/s3proxy/releases/download/s3proxy-${S3PROXY_VERSION}/s3proxy" \
--fail --location --silent --output "${S3PROXY_BINARY}"
chmod +x "${S3PROXY_BINARY}"
if [ ! -e "${MINIO_BINARY}" ]; then
# TODO: arm64
curl https://dl.min.io/server/minio/release/linux-amd64/minio --fail --silent --output "${MINIO_BINARY}"
chmod +x "${MINIO_BINARY}"
fi

# generate self-signed SSL certificate
Expand All @@ -166,15 +157,16 @@ function start_s3proxy {
# The PROXY test is HTTP only, so do not create CA certificates.
#
if [ -z "${CHAOS_HTTP_PROXY}" ] && [ -z "${CHAOS_HTTP_PROXY_OPT}" ]; then
S3PROXY_CACERT_FILE="/tmp/keystore.pem"
rm -f /tmp/keystore.jks "${S3PROXY_CACERT_FILE}"
printf 'password\npassword\n\n\n\n\n\n\ny' | keytool -genkey -keystore /tmp/keystore.jks -keyalg RSA -keysize 2048 -validity 365 -ext SAN=IP:127.0.0.1
echo password | keytool -exportcert -keystore /tmp/keystore.jks -rfc -file "${S3PROXY_CACERT_FILE}"
S3PROXY_CACERT_FILE="/tmp/certs/public.crt"
rm -rf /tmp/certs/
mkdir -p /tmp/certs
echo -e '\n\n\n\n\n\n127.0.0.1' | openssl req -new -x509 -nodes -days 365 -addext 'subjectAltName = IP:127.0.0.1' -keyout /tmp/certs/private.key -out /tmp/certs/public.crt
else
S3PROXY_CACERT_FILE=""
fi

"${STDBUF_BIN}" -oL -eL java -jar "${S3PROXY_BINARY}" --properties "${S3PROXY_CONFIG}" &
rm -rf /tmp/blobstore/
MINIO_ROOT_USER=local-identity MINIO_ROOT_PASSWORD=local-credential "${STDBUF_BIN}" -oL -eL "./${MINIO_BINARY}" server --address "127.0.0.1:8080" --certs-dir /tmp/certs /tmp/blobstore &
S3PROXY_PID=$!

# wait for S3Proxy to start
Expand Down
3 changes: 2 additions & 1 deletion test/integration-test-main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2654,7 +2654,8 @@ function add_all_tests {
#
# add_tests test_chmod_mountpoint
# add_tests test_chown_mountpoint
add_tests test_time_mountpoint
# TODO: fails with minio
#add_tests test_time_mountpoint
}

init_suite
Expand Down
5 changes: 4 additions & 1 deletion test/small-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ if [ -n "${ALL_TESTS}" ]; then
"use_cache=${CACHE_DIR} -o ensure_diskfree=${ENSURE_DISKFREE_SIZE} -o fake_diskfree=${FAKE_FREE_DISK_SIZE} -o streamupload"
)
else
install -m 600 <(head -c 32 < /dev/urandom) /tmp/ssekey.bin
install -m 600 <(base64 < /tmp/ssekey.bin) /tmp/ssekey
install -m 600 <(openssl md5 -binary < /tmp/ssekey.bin | base64) /tmp/ssekeymd5
FLAGS=(
sigv4
"use_sse=custom:/tmp/ssekey"
)
fi

Expand Down
8 changes: 7 additions & 1 deletion test/test-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,16 @@ function aws_cli() {
if [ -n "${S3FS_PROFILE}" ]; then
FLAGS="--profile ${S3FS_PROFILE}"
fi
if [ "$1" = "s3" ] && [ "$2" != "ls" -a "$2" != "mb" ]; then
FLAGS="${FLAGS} --sse-c AES256 --sse-c-key fileb:///tmp/ssekey.bin"
elif [ "$1" = "s3api" ] && [ "$2" != "head-bucket" ]; then
# TODO: use file:// syntax?
FLAGS="${FLAGS} --sse-customer-algorithm AES256 --sse-customer-key $(cat /tmp/ssekey) --sse-customer-key-md5 $(cat /tmp/ssekeymd5)"
fi
# [NOTE]
# AWS_EC2_METADATA_DISABLED for preventing the metadata service(to 169.254.169.254).
# shellcheck disable=SC2086,SC2068
AWS_EC2_METADATA_DISABLED=true aws $@ --endpoint-url "${S3_URL}" --ca-bundle /tmp/keystore.pem ${FLAGS}
AWS_EC2_METADATA_DISABLED=true aws $@ --endpoint-url "${S3_URL}" --ca-bundle /tmp/certs/public.crt ${FLAGS}
}

function wait_for_port() {
Expand Down

0 comments on commit 6ada1f6

Please sign in to comment.