mirror of
https://github.com/versity/versitygw.git
synced 2026-09-19 22:44:28 +00:00
test: chunked upload - invalid checksums, retention, legal hold tests
This commit is contained in:
@@ -49,35 +49,12 @@ if [ -n "$expires" ]; then
|
||||
cr_data+=("expires:$expires")
|
||||
fi
|
||||
cr_data+=("host:$host")
|
||||
if [ "$checksum_type" == "sha256" ]; then
|
||||
if [ -z "$checksum_hash" ]; then
|
||||
checksum_hash="$(sha256sum "$data_file" | awk '{print $1}' | xxd -r -p | base64)"
|
||||
fi
|
||||
cr_data+=("x-amz-checksum-sha256:$checksum_hash")
|
||||
elif [ "$checksum_type" == "sha1" ]; then
|
||||
if [ -z "$checksum_hash" ]; then
|
||||
checksum_hash="$(sha1sum "$data_file" | awk '{print $1}' | xxd -r -p | base64)"
|
||||
fi
|
||||
cr_data+=("x-amz-checksum-sha1:$checksum_hash")
|
||||
elif [ "$checksum_type" == "crc32" ]; then
|
||||
if [ -z "$checksum_hash" ]; then
|
||||
checksum_hash="$(gzip -c -1 "$data_file" | tail -c8 | od -t x4 -N 4 -A n | awk '{print $1}' | xxd -r -p | base64)"
|
||||
fi
|
||||
cr_data+=("x-amz-checksum-crc32:$checksum_hash")
|
||||
elif [ "$checksum_type" == "crc64nvme" ]; then
|
||||
if [ -z "$checksum_hash" ] && ! checksum_hash=$(DATA_FILE="$data_file" TEST_FILE_FOLDER="$TEST_FILE_FOLDER" CHECKSUM_TYPE="crc64nvme" ./tests/rest_scripts/calculate_checksum.sh 2>&1); then
|
||||
log_rest 2 "error calculating crc64nvme checksum: $checksum_hash"
|
||||
if [ "$checksum_type" != "" ]; then
|
||||
if [ "$checksum_hash" == "" ] && ! checksum_hash=$(DATA_FILE="$data_file" CHECKSUM_TYPE="$checksum_type" ./tests/rest_scripts/calculate_checksum.sh 2>&1); then
|
||||
log_rest 2 "error calculating checksum hash"
|
||||
exit 1
|
||||
fi
|
||||
cr_data+=("x-amz-checksum-crc64nvme:$checksum_hash")
|
||||
elif [ "$checksum_type" == "crc32c" ]; then
|
||||
if [ -z "$checksum_hash" ] && ! checksum_hash=$(DATA_FILE="$data_file" TEST_FILE_FOLDER="$TEST_FILE_FOLDER" CHECKSUM_TYPE="crc32c" ./tests/rest_scripts/calculate_checksum.sh 2>&1); then
|
||||
log_rest 2 "error calculating crc32c checksum: $checksum_hash"
|
||||
exit 1
|
||||
fi
|
||||
cr_data+=("x-amz-checksum-crc32c:$checksum_hash")
|
||||
elif [ "$checksum_type" != "" ]; then
|
||||
cr_data+=("x-amz-checksum-$checksum_type:$checksum_hash")
|
||||
cr_data+=("x-amz-checksum-${checksum_type}:$checksum_hash")
|
||||
fi
|
||||
cr_data+=("x-amz-content-sha256:$payload_hash" "x-amz-date:$current_date_time")
|
||||
build_canonical_request "${cr_data[@]}"
|
||||
|
||||
Reference in New Issue
Block a user