aboutsummaryrefslogtreecommitdiff
path: root/test/s3/compatibility/run.sh
diff options
context:
space:
mode:
authorvados <vados@vadosware.io>2023-11-09 14:03:47 +0900
committerChris Lu <chrislusf@users.noreply.github.com>2023-11-08 23:16:40 -0800
commita1c6f1fbd68b64a4546ea00d1adf33ada95f024b (patch)
tree9776f7c4e856e4ae4a2bcc06ba63e4b26b6175fa /test/s3/compatibility/run.sh
parent5db82e594a711ca7b45f9ffb04b036e72df25c35 (diff)
downloadseaweedfs-a1c6f1fbd68b64a4546ea00d1adf33ada95f024b.tar.xz
seaweedfs-a1c6f1fbd68b64a4546ea00d1adf33ada95f024b.zip
chore(tests): update S3 compat tests
While present, the S3 compatibility tests were broken (at the very least when running on Linux) due to a few issues: - `ubuntu:latest` moving ahead of Python 3.6 - Docker networking not working as expected (host.docker.internal) This commit fixes the s3 compatibility tests, ensuring they run properly on linux, and updates the repository to contain some results. Signed-off-by: vados <vados@vadosware.io>
Diffstat (limited to 'test/s3/compatibility/run.sh')
-rwxr-xr-xtest/s3/compatibility/run.sh86
1 files changed, 75 insertions, 11 deletions
diff --git a/test/s3/compatibility/run.sh b/test/s3/compatibility/run.sh
index 990599df5..adfee1366 100755
--- a/test/s3/compatibility/run.sh
+++ b/test/s3/compatibility/run.sh
@@ -1,24 +1,88 @@
#!/usr/bin/env bash
-set -ex
+CONTAINER_NAME=${CONTAINER_NAME:-s3test-instance}
+CONF_FILE=${CONF_FILE:-s3tests.conf}
+WEED_BIN=${WEED_BIN:-../../../weed/weed}
+TEST_RAW_OUTPUT_FILE=${TEST_RAW_OUTPUT_FILE:-compat.raw.txt}
+TEST_PROCESSED_OUTPUT_FILE=${TEST_PROCESSED_OUTPUT_FILE:-compat.summary.txt}
+# Set up debugging for this bash script if DEBUG is set
+if [ -n "${DEBUG}" ]; then
+ echo -e "DEBUG set [${DEBUG}], enabling debugging output...";
+ set -ex
+fi
+
+# Reset from possible previous test run
killall -9 weed || echo "already stopped"
rm -Rf tmp
mkdir tmp
-docker stop s3test-instance || echo "already stopped"
+docker stop $CONTAINER_NAME || echo "already stopped"
+# Ensure ulimit is set to reasonable value
ulimit -n 10000
-../../../weed/weed server -filer -s3 -volume.max 0 -master.volumeSizeLimitMB 5 -dir "$(pwd)/tmp" 1>&2>weed.log &
+# Start weed w/ filer + s3 in the background
+$WEED_BIN server \
+ -filer \
+ -s3 \
+ -volume.max 0 \
+ -master.volumeSizeLimitMB 5 \
+ -dir "$(pwd)/tmp" \
+ 1>&2>weed.log &
+
+# Wait for master to start up
+echo -e "\n[info] waiting for master @ 9333...";
until curl --output /dev/null --silent --head --fail http://127.0.0.1:9333; do
- printf '.'
- sleep 5
+ printf '.';
+ sleep 5;
+done
+sleep 3;
+
+# Wait for s3 to start up
+echo -e "\n[info] waiting for S3 @ 8333...";
+until curl --output /dev/null --silent --fail http://127.0.0.1:8333; do
+ printf '.';
+ sleep 5;
done
-sleep 3
+sleep 3;
+
+# Determine whether docker net
+DOCKER_NET_HOST_ARGS=""
+if [ -n "${DOCKER_NET_HOST}" ]; then
+ DOCKER_NET_HOST_ARGS="--net=host"
+ echo -e "\n[info] setting docker to het nost"
+fi
+
+echo -e "\n[warn] You may have to run with UNFILTERED=y to disable output filtering, if you get the broken pipe error";
+echo -e "\n[info] running tests with unfiltered output...";
+docker run \
+ --name $CONTAINER_NAME \
+ --rm \
+ ${DOCKER_NET_HOST_ARGS} \
+ -e S3TEST_CONF=$CONF_FILE \
+ -v "$(pwd)"/$CONF_FILE:/s3-tests/s3tests.conf \
+ -it \
+ s3tests \
+ ./virtualenv/bin/nosetests \
+ s3tests_boto3/functional/test_s3.py \
+ -v \
+ -a 'resource=object,!bucket-policy,!versioning,!encryption' \
+ | tee ${TEST_RAW_OUTPUT_FILE}
+
+# If the summary logs are present, process them
+if [ -f "${TEST_RAW_OUTPUT_FILE}" ]; then
+ cat ${TEST_RAW_OUTPUT_FILE} | sed -n -e '/botocore.hooks/!p;//q' | tee ${TEST_PROCESSED_OUTPUT_FILE}
+ echo -e "\n[info] ✅ Successfully wrote processed output @ [${TEST_PROCESSED_OUTPUT_FILE}]";
+ if [ -z "${TEST_KEEP_RAW_OUTPUT}" ]; then
+ echo -e "\n[info] removing test raw output file @ [${TEST_RAW_OUTPUT_FILE}] (to disable this, set TEST_KEEP_RAW_OUTPUT=y)...";
+ rm -rf ${TEST_RAW_OUTPUT_FILE};
+ fi
+else
+ echo -e "\n[warn] failed to find raw output @ [${TEST_RAW_OUTPUT_FILE}]";
+fi
-rm -Rf logs-full.txt logs-summary.txt
-# docker run --name s3test-instance --rm -e S3TEST_CONF=s3tests.conf -v `pwd`/s3tests.conf:/s3-tests/s3tests.conf -it s3tests ./virtualenv/bin/nosetests s3tests_boto3/functional/test_s3.py:test_get_obj_tagging -v -a 'resource=object,!bucket-policy,!versioning,!encryption'
-docker run --name s3test-instance --rm -e S3TEST_CONF=s3tests.conf -v "$(pwd)"/s3tests.conf:/s3-tests/s3tests.conf -it s3tests ./virtualenv/bin/nosetests s3tests_boto3/functional/test_s3.py -v -a 'resource=object,!bucket-policy,!versioning,!encryption' | sed -n -e '/botocore.hooks/!p;//q' | tee logs-summary.txt
+echo -e "\n[info] stopping [${CONTAINER_NAME}] container...";
+docker stop $CONTAINER_NAME || echo "[info] already stopped";
-docker stop s3test-instance || echo "already stopped"
-killall -9 weed
+echo -e "\n[info] stopping seaweedfs processes (all, via kill -9)...";
+killall -9 weed;