mirror of
https://github.com/versity/versitygw.git
synced 2026-06-02 09:06:19 +00:00
test: ListObjectsV2 REST capability, initial multi-page testing
This commit is contained in:
@@ -20,24 +20,55 @@ source ./tests/rest_scripts/rest.sh
|
||||
|
||||
# shellcheck disable=SC2153
|
||||
bucket_name="$BUCKET_NAME"
|
||||
version_two="${VERSION_TWO:-FALSE}"
|
||||
max_keys="${MAX_KEYS:-0}"
|
||||
# shellcheck disable=SC2153
|
||||
if [ "$CONTINUATION_TOKEN" != "" ]; then
|
||||
continuation_token=$(jq -rn --arg token "$CONTINUATION_TOKEN" '$token | @uri')
|
||||
fi
|
||||
|
||||
current_date_time=$(date -u +"%Y%m%dT%H%M%SZ")
|
||||
|
||||
#x-amz-object-attributes:ETag
|
||||
canonical_request="GET
|
||||
/$bucket_name
|
||||
"
|
||||
|
||||
if [ "$CONTINUATION_TOKEN" != "" ]; then
|
||||
add_parameter "canonical_request" "continuation-token=$continuation_token"
|
||||
fi
|
||||
if [ "$version_two" != "FALSE" ]; then
|
||||
add_parameter "canonical_request" "list-type=2"
|
||||
fi
|
||||
if [ "$max_keys" -ne 0 ]; then
|
||||
add_parameter "canonical_request" "max-keys=$max_keys"
|
||||
fi
|
||||
first_param_added="false"
|
||||
|
||||
canonical_request+="
|
||||
host:$host
|
||||
x-amz-content-sha256:UNSIGNED-PAYLOAD
|
||||
x-amz-date:$current_date_time
|
||||
|
||||
host;x-amz-content-sha256;x-amz-date
|
||||
UNSIGNED-PAYLOAD"
|
||||
|
||||
create_canonical_hash_sts_and_signature
|
||||
|
||||
curl_command+=(curl -ks -w "\"%{http_code}\"" "$AWS_ENDPOINT_URL/$bucket_name"
|
||||
-H "\"Authorization: AWS4-HMAC-SHA256 Credential=$aws_access_key_id/$year_month_day/$aws_region/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=$signature\""
|
||||
curl_command+=(curl -ks -w "\"%{http_code}\"")
|
||||
url="'$AWS_ENDPOINT_URL/$bucket_name"
|
||||
if [ "$CONTINUATION_TOKEN" != "" ]; then
|
||||
add_parameter "url" "continuation-token=$continuation_token"
|
||||
fi
|
||||
if [ "$version_two" != "FALSE" ]; then
|
||||
add_parameter "url" "list-type=2"
|
||||
fi
|
||||
if [ "$max_keys" -ne 0 ]; then
|
||||
add_parameter "url" "max-keys=$max_keys"
|
||||
fi
|
||||
first_param_added="false"
|
||||
url+="'"
|
||||
curl_command+=("$url")
|
||||
curl_command+=(-H "\"Authorization: AWS4-HMAC-SHA256 Credential=$aws_access_key_id/$year_month_day/$aws_region/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=$signature\""
|
||||
-H "\"x-amz-content-sha256: UNSIGNED-PAYLOAD\""
|
||||
-H "\"x-amz-date: $current_date_time\""
|
||||
-o "$OUTPUT_FILE")
|
||||
|
||||
@@ -65,3 +65,18 @@ $canonical_request_hash"
|
||||
curl_command=()
|
||||
add_command_recording_if_enabled
|
||||
}
|
||||
|
||||
add_parameter() {
|
||||
if [ "$#" -ne 2 ]; then
|
||||
return
|
||||
fi
|
||||
if [ "$first_param_added" != "true" ]; then
|
||||
if [ "$1" == "url" ]; then
|
||||
eval "$1"+='?'
|
||||
fi
|
||||
eval "$1"+="$2"
|
||||
first_param_added="true"
|
||||
else
|
||||
eval "$1"+="'&$2'"
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user