mirror of
https://github.com/versity/versitygw.git
synced 2026-10-22 06:12:39 +00:00
test: skips removal, some updates
This commit is contained in:
@@ -556,13 +556,15 @@ split_file_irregular() {
|
||||
# param: file location
|
||||
# return 0 for success, 1 for error
|
||||
split_file() {
|
||||
if ! check_param_count_ge_le "file name, number of pieces, piece size (optional)" 2 3 $#; then
|
||||
if ! check_param_count_v2 "file name, number of pieces" 2 $#; then
|
||||
return 1
|
||||
fi
|
||||
local file_name="$1" number_of_parts="$2"
|
||||
|
||||
# -n l/K : Split into K pieces without breaking lines (or use 'K' for raw bytes)
|
||||
# -d : Use numeric suffixes
|
||||
# -a 2 : Allow up to 100 pieces (00-99)
|
||||
if ! error=$(split -a 2 -d -n "$2" "$1" "${1}-" 2>&1); then
|
||||
if ! error=$(split -a 2 -d -n "$number_of_parts" "$file_name" "${file_name}-" 2>&1); then
|
||||
log 2 "error splitting file: $error"
|
||||
return 1
|
||||
fi
|
||||
@@ -578,6 +580,9 @@ split_file() {
|
||||
if [ "${#parts[@]}" -eq 0 ]; then
|
||||
log 2 "split produced no output files"
|
||||
return 1
|
||||
elif [ "${#parts[@]}" -ne "$number_of_parts" ]; then
|
||||
log 2 "glob mismatch: expected '$number_of_parts', was '${#parts[@]}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "${parts[*]}" | sort
|
||||
|
||||
@@ -14,20 +14,30 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
source ./tests/drivers/complete_multipart_upload/complete_multipart_upload_rest.sh
|
||||
|
||||
upload_and_check_attributes() {
|
||||
if ! check_param_count_v2 "bucket, test file, file size" 3 $#; then
|
||||
if ! check_param_count_v2 "bucket, test file, file size, parts one to four" 7 $#; then
|
||||
return 1
|
||||
fi
|
||||
if ! perform_multipart_upload_rest "$1" "$2" "$TEST_FILE_FOLDER/$2-0" "$TEST_FILE_FOLDER/$2-1" \
|
||||
"$TEST_FILE_FOLDER/$2-2" "$TEST_FILE_FOLDER/$2-3"; then
|
||||
local bucket="$1" test_file="$2" file_size="$3" part_one="$4" part_two="$5" part_three="$6" part_four="$7"
|
||||
local result attributes_file
|
||||
|
||||
if ! perform_multipart_upload_rest "$bucket" "$test_file" "$part_one" "$part_two" "$part_three" "$part_four"; then
|
||||
log 2 "error uploading and checking parts"
|
||||
return 1
|
||||
fi
|
||||
if ! result=$(COMMAND_LOG="$COMMAND_LOG" BUCKET_NAME="$1" OBJECT_KEY="$2" ATTRIBUTES="ETag,StorageClass,ObjectParts,ObjectSize" OUTPUT_FILE="$TEST_FILE_FOLDER/attributes.txt" ./tests/rest_scripts/get_object_attributes.sh); then
|
||||
if ! result=$(get_file_name 2>&1); then
|
||||
log 2 "error getting file name: $result"
|
||||
return 1
|
||||
fi
|
||||
attributes_file="$result"
|
||||
|
||||
if ! result=$(COMMAND_LOG="$COMMAND_LOG" BUCKET_NAME="$bucket" OBJECT_KEY="$test_file" ATTRIBUTES="ETag,StorageClass,ObjectParts,ObjectSize" OUTPUT_FILE="$TEST_FILE_FOLDER/$attributes_file" ./tests/rest_scripts/get_object_attributes.sh 2>&1); then
|
||||
log 2 "error listing object attributes: $result"
|
||||
return 1
|
||||
fi
|
||||
if ! check_attributes_after_upload "$3"; then
|
||||
if ! check_attributes_after_upload "$TEST_FILE_FOLDER/$attributes_file" "$file_size"; then
|
||||
log 2 "error checking attributes after upload"
|
||||
return 1
|
||||
fi
|
||||
@@ -35,36 +45,44 @@ upload_and_check_attributes() {
|
||||
}
|
||||
|
||||
check_attributes_after_upload() {
|
||||
if [ $# -ne 1 ]; then
|
||||
log 2 "'check_attributes_after_upload' requires file size"
|
||||
if ! check_param_count_v2 "data file, expected file size" 2 $#; then
|
||||
return 1
|
||||
fi
|
||||
log 5 "attributes: $(cat "$TEST_FILE_FOLDER/attributes.txt")"
|
||||
if ! object_size=$(xmllint --xpath '//*[local-name()="ObjectSize"]/text()' "$TEST_FILE_FOLDER/attributes.txt" 2>&1); then
|
||||
log 2 "error getting checksum: $object_size"
|
||||
local data_file="$1" expected_size="$2"
|
||||
local response object_size etag parts_count
|
||||
|
||||
log 5 "attributes: $(cat "$data_file")"
|
||||
if ! response=$(xmllint --xpath '//*[local-name()="ObjectSize"]/text()' "$data_file" 2>&1); then
|
||||
log 2 "error getting checksum: $response"
|
||||
return 1
|
||||
fi
|
||||
object_size="$response"
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
if [ "$object_size" != "$1" ]; then
|
||||
log 2 "expected file size of '$file_size', was '$object_size'"
|
||||
if [ "$object_size" != "$expected_size" ]; then
|
||||
log 2 "expected file size of '$expected_size', was '$object_size'"
|
||||
return 1
|
||||
fi
|
||||
if ! error=$(xmllint --xpath '//*[local-name()="StorageClass"]/text()' "$TEST_FILE_FOLDER/attributes.txt" 2>&1); then
|
||||
log 2 "error getting storage class: $error"
|
||||
if ! response=$(xmllint --xpath '//*[local-name()="StorageClass"]/text()' "$data_file" 2>&1); then
|
||||
log 2 "error getting storage class: $response"
|
||||
return 1
|
||||
fi
|
||||
if ! etag=$(xmllint --xpath '//*[local-name()="ETag"]/text()' "$TEST_FILE_FOLDER/attributes.txt" 2>&1); then
|
||||
log 2 "error getting etag: $etag"
|
||||
|
||||
if ! response=$(xmllint --xpath '//*[local-name()="ETag"]/text()' "$data_file" 2>&1); then
|
||||
log 2 "error getting etag: $response"
|
||||
return 1
|
||||
fi
|
||||
etag="$response"
|
||||
if ! [[ $etag =~ ^[a-fA-F0-9]{32}-4$ ]]; then
|
||||
log 2 "unexpected etag pattern ($etag)"
|
||||
return 1
|
||||
fi
|
||||
if ! parts_count=$(xmllint --xpath '//*[local-name()="PartsCount"]/text()' "$TEST_FILE_FOLDER/attributes.txt" 2>&1); then
|
||||
log 2 "error getting parts_count: $parts_count"
|
||||
|
||||
if ! response=$(xmllint --xpath '//*[local-name()="PartsCount"]/text()' "$data_file" 2>&1); then
|
||||
log 2 "error getting parts_count: $response"
|
||||
return 1
|
||||
fi
|
||||
parts_count="$response"
|
||||
if [[ $parts_count != 4 ]]; then
|
||||
log 2 "unexpected parts count, expected 4, was $parts_count"
|
||||
return 1
|
||||
|
||||
@@ -189,9 +189,6 @@ fi
|
||||
|
||||
# tags: curl,PutBucketAcl,x-amz-acl
|
||||
@test "REST - invalid canned acl" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1367"
|
||||
fi
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
assert_success
|
||||
bucket_name="$output"
|
||||
|
||||
@@ -24,18 +24,13 @@ source ./tests/drivers/get_object_attributes/get_object_attributes_rest.sh
|
||||
# tags: curl,GetObjectAttributes,attributes,x-amz-object-attributes,multipart
|
||||
@test "REST - get object attributes" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1001"
|
||||
skip "https://github.com/versity/versitygw/issues/925"
|
||||
fi
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
assert_success
|
||||
bucket_name="$output"
|
||||
local bucket_name test_file file_size part_one part_two part_three part_four
|
||||
|
||||
run get_file_name
|
||||
assert_success
|
||||
test_file="$output"
|
||||
|
||||
run setup_bucket_and_large_file_v2 "$bucket_name" "$test_file"
|
||||
run setup_bucket_and_large_file_v3 "$BUCKET_ONE_NAME" "$test_file"
|
||||
assert_success
|
||||
read -r bucket_name test_file <<< "$output"
|
||||
|
||||
run get_file_size "$TEST_FILE_FOLDER/$test_file"
|
||||
assert_success
|
||||
@@ -43,15 +38,16 @@ source ./tests/drivers/get_object_attributes/get_object_attributes_rest.sh
|
||||
|
||||
run split_file "$TEST_FILE_FOLDER/$test_file" 4
|
||||
assert_success
|
||||
read -r part_one part_two part_three part_four <<< "$output"
|
||||
|
||||
run upload_and_check_attributes "$bucket_name" "$test_file" "$file_size"
|
||||
run upload_and_check_attributes "$bucket_name" "$test_file" "$file_size" "$part_one" "$part_two" "$part_three" "$part_four"
|
||||
assert_success
|
||||
}
|
||||
|
||||
# tags: curl,GetObjectAttributes,attributes,x-amz-object-attributes,invalid-header
|
||||
@test "REST - attributes - invalid param" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1001"
|
||||
skip "https://github.com/versity/versitygw/issues/925"
|
||||
fi
|
||||
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
|
||||
@@ -21,6 +21,7 @@ source ./tests/commands/get_object_lock_configuration.sh
|
||||
source ./tests/commands/head_bucket.sh
|
||||
source ./tests/commands/list_buckets.sh
|
||||
source ./tests/drivers/create_bucket/create_bucket_rest.sh
|
||||
source ./tests/drivers/delete_objects/delete_objects_rest.sh
|
||||
source ./tests/drivers/get_bucket_ownership_controls/get_bucket_ownership_controls_rest.sh
|
||||
source ./tests/drivers/get_bucket_tagging/get_bucket_tagging_rest.sh
|
||||
source ./tests/drivers/get_object_lock_config/get_object_lock_config_rest.sh
|
||||
@@ -140,16 +141,12 @@ export RUN_USERS=true
|
||||
|
||||
# tags: curl,minimal-request,GetBucketPolicy
|
||||
@test "REST - get policy w/o policy" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/959"
|
||||
fi
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
local bucket_name
|
||||
|
||||
run setup_bucket_v3 "$BUCKET_ONE_NAME"
|
||||
assert_success
|
||||
bucket_name="$output"
|
||||
|
||||
run setup_bucket_v2 "$bucket_name"
|
||||
assert_success
|
||||
|
||||
run get_and_check_no_policy_error "$bucket_name"
|
||||
assert_success
|
||||
}
|
||||
@@ -182,9 +179,6 @@ export RUN_USERS=true
|
||||
|
||||
# tags: curl,malformed-message,invalid-method
|
||||
@test "REST - POST call on root endpoint" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1487"
|
||||
fi
|
||||
run delete_object_empty_bucket_check_error
|
||||
assert_success
|
||||
}
|
||||
|
||||
@@ -93,9 +93,6 @@ export RUN_USERS=true
|
||||
|
||||
# tags: curl,DeleteBucketOwnershipControls,ownershipControls
|
||||
@test "REST - DeleteBucketOwnershipControls - BucketName is reported in error" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1493"
|
||||
fi
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
assert_success
|
||||
bucket_name="$output"
|
||||
|
||||
@@ -78,9 +78,6 @@ export RUN_USERS=true
|
||||
|
||||
# tags: curl,ListBuckets,required-headers,Authorization,x-amz-date,invalid-header
|
||||
@test "REST - incorrect year/month/day" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1514"
|
||||
fi
|
||||
run list_buckets_check_request_time_too_skewed_error
|
||||
assert_success
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user