mirror of
https://github.com/versity/versitygw.git
synced 2026-01-10 05:17:25 +00:00
test: temp
This commit is contained in:
@@ -289,3 +289,31 @@ check_for_header_key_and_value() {
|
||||
log 2 "no header key '$2' found"
|
||||
return 1
|
||||
}
|
||||
|
||||
check_argument_name_and_value() {
|
||||
if ! check_param_count_v2 "data file" 1 $#; then
|
||||
return 1
|
||||
fi
|
||||
if ! check_error_parameter "$1" "ArgumentName" "$argument_name"; then
|
||||
log 2 "error checking 'ArgumentName' parameter"
|
||||
return 1
|
||||
fi
|
||||
if ! check_error_parameter "$1" "ArgumentValue" "$argument_value"; then
|
||||
log 2 "error checking 'ArgumentValue' parameter"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
send_rest_go_command_expect_error_with_arg_name_value() {
|
||||
if ! check_param_count_gt "response code, error code, message, arg name, arg value, params" 5 $#; then
|
||||
return 1
|
||||
fi
|
||||
argument_name=$4
|
||||
argument_value=$5
|
||||
if ! send_rest_go_command_expect_error_callback "$1" "$2" "$3" "check_argument_name_and_value" "${@:6}"; then
|
||||
log 2 "error checking error response values"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -462,3 +462,32 @@ export RUN_USERS=true
|
||||
run head_object_check_header_key_and_value "$bucket_name" "$test_file" "Content-Disposition" "dummy"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "REST - PutObject - x-amz-object-lock-retain-until-date - invalid format" {
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
assert_success
|
||||
bucket_name="$output"
|
||||
|
||||
run setup_bucket_and_file_v2 "$bucket_name" "$test_file"
|
||||
assert_success
|
||||
|
||||
run send_rest_go_command_expect_error "400" "InvalidArgument" "must be provided in ISO 8601 format" "-bucketName" "$bucket_name" \
|
||||
"-objectKey" "$test_file" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
|
||||
"-method" "PUT" "-contentMD5" "-signedParams" "x-amz-object-lock-mode:abc,x-amz-object-lock-retain-until-date:abc"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "REST - PutObject - x-amz-object-lock-retain-until-date - earlier date" {
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
assert_success
|
||||
bucket_name="$output"
|
||||
|
||||
run setup_bucket_and_file_v2 "$bucket_name" "$test_file"
|
||||
assert_success
|
||||
|
||||
earlier_date="2025-12-25T12:00:00Z"
|
||||
run send_rest_go_command_expect_error_with_arg_name_value "400" "InvalidArgument" "must be in the future" \
|
||||
"x-amz-object-lock-retain-until-date" "$earlier_date" "-bucketName" "$bucket_name" "-objectKey" "$test_file" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
|
||||
"-method" "PUT" "-contentMD5" "-signedParams" "x-amz-object-lock-mode:abc,x-amz-object-lock-retain-until-date:$earlier_date"
|
||||
assert_success
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user