From 4a31d0d5d2bb171c9b8717581ba55f51b968ec96 Mon Sep 17 00:00:00 2001 From: Luke McCrone Date: Wed, 17 Dec 2025 15:00:54 -0300 Subject: [PATCH] test: Get/PutObjectTagging tests with versioning --- .github/workflows/system.yml | 4 +- .../get_object_tagging_rest.sh | 79 ++++++++++++++++++ tests/drivers/head_object/head_object_rest.sh | 25 ++++++ .../list_object_versions_rest.sh | 50 ++++++++++++ tests/drivers/put_object/put_object_rest.sh | 22 +++++ .../put_object_tagging_rest.sh | 23 ++++++ tests/drivers/rest.sh | 19 ++++- tests/drivers/xml.sh | 12 ++- .../rest_scripts/command/putTaggingCommand.go | 6 +- tests/rest_scripts/command/s3Command.go | 6 +- tests/run.sh | 16 +++- tests/test_rest_get_object_tagging.sh | 80 +++++++++++++++++++ tests/test_rest_list_object_versions.sh | 39 +++++++++ tests/test_rest_put_object.sh | 18 ++++- tests/test_rest_put_object_tagging.sh | 16 ++++ 15 files changed, 405 insertions(+), 10 deletions(-) create mode 100644 tests/drivers/list_object_versions/list_object_versions_rest.sh create mode 100755 tests/test_rest_get_object_tagging.sh create mode 100755 tests/test_rest_list_object_versions.sh diff --git a/.github/workflows/system.yml b/.github/workflows/system.yml index f44c184..99e416b 100644 --- a/.github/workflows/system.yml +++ b/.github/workflows/system.yml @@ -67,14 +67,14 @@ jobs: AWS_REGION: "us-east-1" - set: "REST, posix, static, rest-put-bucket-tagging|rest-get-bucket-location|rest-put-object-tagging, folder IAM" IAM_TYPE: folder - RUN_SET: "rest-put-bucket-tagging,rest-get-bucket-location,rest-put-object-tagging" + RUN_SET: "rest-put-bucket-tagging,rest-get-bucket-location,rest-put-object-tagging,rest-get-object-tagging,rest-list-object-versions" RECREATE_BUCKETS: "false" DELETE_BUCKETS_AFTER_TEST: "false" BACKEND: "posix" AWS_REGION: "us-east-1" - set: "REST, posix, non-static, rest-put-bucket-tagging|rest-get-bucket-location|rest-put-object-tagging, folder IAM" IAM_TYPE: folder - RUN_SET: "rest-put-bucket-tagging,rest-get-bucket-location,rest-put-object-tagging" + RUN_SET: "rest-put-bucket-tagging,rest-get-bucket-location,rest-put-object-tagging,rest-get-object-tagging,rest-list-object-versions" RECREATE_BUCKETS: "true" DELETE_BUCKETS_AFTER_TEST: "true" BACKEND: "posix" diff --git a/tests/drivers/get_object_tagging/get_object_tagging_rest.sh b/tests/drivers/get_object_tagging/get_object_tagging_rest.sh index 66226f3..14c896b 100644 --- a/tests/drivers/get_object_tagging/get_object_tagging_rest.sh +++ b/tests/drivers/get_object_tagging/get_object_tagging_rest.sh @@ -14,6 +14,8 @@ # specific language governing permissions and limitations # under the License. +source ./tests/drivers/put_object_tagging/put_object_tagging_rest.sh + parse_object_tags_rest() { if ! check_param_count_v2 "data file" 1 $#; then return 1 @@ -61,3 +63,80 @@ check_object_tags_single_set() { fi return 0 } + +check_for_empty_tagset() { + if ! check_param_count_v2 "data file" 1 $#; then + return 1 + fi + if ! check_for_empty_element "$1" "Tagging" "TagSet"; then + log 2 "error checking for empty XML element" + return 1 + fi + return 0 +} + +get_check_object_tags_empty() { + if ! check_param_count_v2 "bucket name, key" 2 $#; then + return 1 + fi + if ! send_rest_go_command_callback "200" "check_for_empty_tagset" "-bucketName" "$1" "-objectKey" "$2" \ + "-method" "GET" "-query" "tagging="; then + log 2 "error sending get object tagging command" + return 1 + fi + return 0 +} + +check_header_version_id() { + if ! check_param_count_v2 "data file" 1 $#; then + return 1 + fi + if ! check_for_header_key_and_value "$1" "x-amz-version-id" "$version_id"; then + log 2 "error checking for x-amz-version-id header" + return 1 + fi + return 0 +} + +add_version_tags_check_version_id() { + if ! check_param_count_v2 "bucket name, key" 2 $#; then + return 1 + fi + if ! tag_old_version "$1" "$2"; then + log 2 "error tagging old version" + return 1 + fi + if ! send_rest_go_command_callback "200" "check_header_version_id" "-bucketName" "$1" "-objectKey" "$2" "-debug" "-logFile" "signature.log" \ + "-method" "GET" "-query" "tagging=&versionId=$version_id" "-tagKey" "key" "-tagValue" "value" "-contentMD5"; then + log 2 "error tagging object" + return 1 + fi + return 0 +} + +check_invalid_version_id_error() { + if ! check_param_count_v2 "data file" 1 $#; then + return 1 + fi + if ! check_error_parameter "$1" "ArgumentName" "versionId"; then + return 1 + fi + if ! check_error_parameter "$1" "ArgumentValue" "$invalid_version_id"; then + return 1 + fi + return 0 +} + +get_object_tagging_invalid_version_id() { + if ! check_param_count_v2 "bucket name, key" 2 $#; then + return 1 + fi + invalid_version_id="$2" + if ! send_rest_go_command_expect_error_callback "400" "InvalidArgument" "Invalid version id specified" "check_invalid_version_id_error" \ + "-bucketName" "$1" "-objectKey" "$2" "-debug" "-logFile" "signature.log" \ + "-method" "GET" "-query" "tagging=&versionId=$invalid_version_id" "-tagKey" "key" "-tagValue" "value" "-contentMD5"; then + log 2 "error tagging object" + return 1 + fi + return 0 +} diff --git a/tests/drivers/head_object/head_object_rest.sh b/tests/drivers/head_object/head_object_rest.sh index 9a29609..e15ba27 100644 --- a/tests/drivers/head_object/head_object_rest.sh +++ b/tests/drivers/head_object/head_object_rest.sh @@ -202,3 +202,28 @@ check_metadata() { fi return 0 } + +check_header_key_and_value() { + if ! check_param_count_v2 "data file" 1 $#; then + return 1 + fi + if ! check_for_header_key_and_value "$1" "$header_key" "$header_value"; then + log 2 "error checking header key '$header_key' and value '$header_value'" + return 1 + fi + return 0 +} + +head_object_check_header_key_and_value() { + if ! check_param_count_v2 "bucket, key, expected key, expected value" 4 $#; then + return 1 + fi + header_key="$3" + header_value="$4" + if ! send_rest_go_command_callback "200" "check_header_key_and_value" "-bucketName" "$1" "-objectKey" "$2" \ + "-method" "HEAD"; then + log 2 "error with head object command or callback" + return 1 + fi + return 0 +} diff --git a/tests/drivers/list_object_versions/list_object_versions_rest.sh b/tests/drivers/list_object_versions/list_object_versions_rest.sh new file mode 100644 index 0000000..b819a1a --- /dev/null +++ b/tests/drivers/list_object_versions/list_object_versions_rest.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bats + +# Copyright 2025 Versity Software +# This file is licensed under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http:#www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +parse_non_latest_version_id() { + if ! check_param_count_v2 "data file" 1 $#; then + return 1 + fi + log 5 "data: $(cat "$1")" + not_latest_string="//*[local-name()=\"Version\"][*[local-name()=\"IsLatest\" and text()=\"false\"]]" + log 5 "match string: $not_latest_string" + if ! get_xml_data "$1" "$1.xml"; then + log 2 "error getting XML data" + return 1 + fi + if ! not_latest=$(xmllint --xpath "$not_latest_string" "$1.xml" 2>&1); then + log 2 "error getting result: $not_latest" + return 1 + fi + log 5 "not latest: $not_latest" + if ! version_id=$(xmllint --xpath "//*[local-name()=\"VersionId\"]/text()" <(echo "$not_latest" | head -n 1) 2>&1); then + log 2 "error getting version ID: $version_id" + return 1 + fi + log 5 "version ID: $version_id" + return 0 +} + +get_non_latest_version() { + if ! check_param_count_v2 "bucket" $# 1; then + return 1 + fi + if ! send_rest_go_command_callback "200" "parse_non_latest_version_id" "-method" "GET" "-query" "versions=" "-bucketName" "$1"; then + log 2 "error retrieving version tags" + return 1 + fi + return 0 +} diff --git a/tests/drivers/put_object/put_object_rest.sh b/tests/drivers/put_object/put_object_rest.sh index 2bb67e9..370bd16 100644 --- a/tests/drivers/put_object/put_object_rest.sh +++ b/tests/drivers/put_object/put_object_rest.sh @@ -369,3 +369,25 @@ chunked_upload_trailer_different_chunk_size() { return 0 } +setup_bucket_versioning_file_two_versions() { + if ! check_param_count_v2 "bucket, key" 2 $#; then + return 1 + fi + if ! setup_bucket_and_file_v2 "$1" "$2"; then + log 2 "error setting up bucket" + return 1 + fi + if ! put_bucket_versioning_rest "$1" "Enabled"; then + log 2 "error enabling bucket versioning" + return 1 + fi + if ! put_object "rest" "$TEST_FILE_FOLDER/$2" "$1" "$2"; then + log 2 "error putting object" + return 1 + fi + if ! put_object "rest" "$TEST_FILE_FOLDER/$2" "$1" "$2"; then + log 2 "error putting object second time" + return 1 + fi + return 0 +} diff --git a/tests/drivers/put_object_tagging/put_object_tagging_rest.sh b/tests/drivers/put_object_tagging/put_object_tagging_rest.sh index 494858c..596287d 100644 --- a/tests/drivers/put_object_tagging/put_object_tagging_rest.sh +++ b/tests/drivers/put_object_tagging/put_object_tagging_rest.sh @@ -14,6 +14,8 @@ # specific language governing permissions and limitations # under the License. +source ./tests/drivers/list_object_versions/list_object_versions_rest.sh + get_check_tag_error_with_invalid_key() { if ! check_param_count_v2 "bucket name, key, tag key, tag value" 4 $#; then return 1 @@ -36,4 +38,25 @@ check_invalid_key_error() { return 1 fi return 0 +} + +tag_old_version() { + if ! check_param_count_v2 "bucket name, key" 2 $#; then + return 1 + fi + if ! get_non_latest_version "$1"; then + log 2 "error getting non-latest object version" + return 1 + fi + if ! send_rest_go_command "200" "-bucketName" "$1" "-objectKey" "$2" "-query" "versionId=$version_id" "-debug" "-logFile" "signature.log" \ + "-commandType" "putObjectTagging" "-tagKey" "key" "-tagValue" "value" "-contentMD5"; then + log 2 "error tagging object" + return 1 + fi + if ! send_rest_go_command "200" "-bucketName" "$1" "-objectKey" "$2" "-debug" "-logFile" "signature.log" \ + "-method" "GET" "-query" "tagging=&versionId=$version_id" "-tagKey" "key" "-tagValue" "value" "-contentMD5"; then + log 2 "error tagging object" + return 1 + fi + return 0 } \ No newline at end of file diff --git a/tests/drivers/rest.sh b/tests/drivers/rest.sh index d3ae9a7..0da5698 100644 --- a/tests/drivers/rest.sh +++ b/tests/drivers/rest.sh @@ -178,7 +178,7 @@ rest_go_command_perform_send() { local full_command="send_command $curl_command" log 5 "full command: $full_command" if ! result=$(eval "${full_command[*]}" 2>&1); then - log 3 "error sending command: $result" + log 2 "error sending command: $result" return 1 fi log 5 "result: $result" @@ -272,3 +272,20 @@ send_rest_go_command_callback() { fi return 0 } + +check_for_header_key_and_value() { + if ! check_param_count_v2 "data file, header key, header value" 3 $#; then + return 1 + fi + while IFS=$': \r' read -r key value; do + if [ "$key" == "$2" ]; then + if [ "$value" != "$3" ]; then + log 2 "expected value of '$3', was '$value'" + return 1 + fi + return 0 + fi + done <<< "$(grep -E '^.+: .+$' "$1")" + log 2 "no header key '$2' found" + return 1 +} diff --git a/tests/drivers/xml.sh b/tests/drivers/xml.sh index f018428..ffd8d01 100644 --- a/tests/drivers/xml.sh +++ b/tests/drivers/xml.sh @@ -29,12 +29,18 @@ check_for_empty_element() { fi # shellcheck disable=SC2068 - if ! build_xpath_string ${@:2}; then + if ! build_xpath_string_for_element ${@:2}; then log 2 "error building XPath search string" return 1 fi - if grep '<[^/][^ >]*>' "$1" | xmllint --xpath "'${xpath}[not(normalize-space())]'" -; then - return 0 + if ! get_xml_data "$1" "$1.xml"; then + log 2 "error getting XML data" + return 1 + fi + if grep -q '<[^/][^ >]*>' "$1.xml"; then + if xmllint --xpath "${xpath}[not(normalize-space())]" "$1.xml" 1>/dev/null 2>&1; then + return 0 + fi fi return 1 } diff --git a/tests/rest_scripts/command/putTaggingCommand.go b/tests/rest_scripts/command/putTaggingCommand.go index 797df66..4045b6b 100644 --- a/tests/rest_scripts/command/putTaggingCommand.go +++ b/tests/rest_scripts/command/putTaggingCommand.go @@ -14,7 +14,11 @@ type PutTaggingCommand struct { func (p *PutTaggingCommand) createTaggingPayload(fields *TaggingFields) error { p.Method = "PUT" - p.Query = "tagging=" + if p.Query != "" { + p.Query = "tagging=&" + p.Query + } else { + p.Query = "tagging=" + } if len(fields.TagKeys) != len(fields.TagValues) { return errors.New("must be same number of tag keys and tag values") } diff --git a/tests/rest_scripts/command/s3Command.go b/tests/rest_scripts/command/s3Command.go index 61c84cc..a37ec58 100644 --- a/tests/rest_scripts/command/s3Command.go +++ b/tests/rest_scripts/command/s3Command.go @@ -345,7 +345,11 @@ func (s *S3Command) buildCurlShellCommand() (string, error) { if s.MissingHostParam { return "", fmt.Errorf("missingHostParam option only available for OpenSSL commands") } - curlCommand := []string{"curl", "-iks"} + curlOpts := "-iks" + if s.Method == "HEAD" { + curlOpts += "I" + } + curlCommand := []string{"curl", curlOpts} if s.Method != "GET" { curlCommand = append(curlCommand, fmt.Sprintf("-X %s ", s.Method)) } diff --git a/tests/run.sh b/tests/run.sh index 9053412..d78a1fd 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -42,8 +42,10 @@ show_help() { echo " rest-delete-bucket-ownership-controls Run REST delete bucket ownership controls tests" echo " rest-delete-bucket-tagging Run REST delete bucket tagging tests" echo " rest-get-bucket-location Run REST get bucket location tests" + echo " rest-get-object-tagging Run REST get object tagging tests" echo " rest-head-bucket Run REST head bucket tests" echo " rest-list-buckets Run REST list-buckets tests" + echo " rest-list-object-versions Run REST list-object-versions tests" echo " rest-multipart Run REST multipart tests" echo " rest-not-implemented Run REST multipart tests" echo " rest-put-bucket-tagging Run REST put-bucket-tagging tests" @@ -65,7 +67,7 @@ handle_param() { rest-create-bucket|rest-head-bucket|rest-list-buckets|rest-not-implemented|\ rest-put-object|rest-versioning|rest-bucket|rest-multipart|rest-delete-bucket-ownership-controls|\ rest-delete-bucket-tagging|setup-remove-static|rest-put-bucket-tagging|rest-get-bucket-location|\ - rest-put-object-tagging) + rest-put-object-tagging|rest-get-object-tagging|rest-list-object-versions) run_suite "$1" ;; *) # Handle unrecognized options or positional arguments @@ -178,10 +180,14 @@ run_suite() { exit_code=1 elif ! "$HOME"/bin/bats ./tests/test_rest_get_bucket_location.sh; then exit_code=1 + elif ! "$HOME"/bin/bats ./tests/test_rest_get_object_tagging.sh; then + exit_code=1 elif ! "$HOME"/bin/bats ./tests/test_rest_head_bucket.sh; then exit_code=1 elif ! "$HOME"/bin/bats ./tests/test_rest_list_buckets.sh; then exit_code=1 + elif ! "$HOME"/bin/bats ./tests/test_rest_list_object_versions.sh; then + exit_code=1 elif ! "$HOME"/bin/bats ./tests/test_rest_multipart.sh; then exit_code=1 elif ! "$HOME"/bin/bats ./tests/test_rest_not_implemented.sh; then @@ -234,6 +240,10 @@ run_suite() { echo "Running REST get bucket location tests ..." "$HOME"/bin/bats ./tests/test_rest_get_bucket_location.sh || exit_code=$? ;; + rest-get-object-tagging) + echo "Running REST get object tagging tests ..." + "$HOME"/bin/bats ./tests/test_rest_get_object_tagging.sh || exit_code=$? + ;; rest-head-bucket) echo "Running REST head bucket tests ..." "$HOME"/bin/bats ./tests/test_rest_head_bucket.sh || exit_code=$? @@ -242,6 +252,10 @@ run_suite() { echo "Running REST list-buckets tests ..." "$HOME"/bin/bats ./tests/test_rest_list_buckets.sh || exit_code=$? ;; + rest-list-object-versions) + echo "Running REST list-object-versions tests ..." + "$HOME"/bin/bats ./tests/test_rest_list_object_versions.sh || exit_code=$? + ;; rest-not-implemented) echo "Running REST not-implemented tests ..." "$HOME"/bin/bats ./tests/test_rest_not_implemented.sh || exit_code=$? diff --git a/tests/test_rest_get_object_tagging.sh b/tests/test_rest_get_object_tagging.sh new file mode 100755 index 0000000..e2a9892 --- /dev/null +++ b/tests/test_rest_get_object_tagging.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bats + +# Copyright 2025 Versity Software +# This file is licensed under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http:#www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +load ./bats-support/load +load ./bats-assert/load + +source ./tests/setup.sh +source ./tests/drivers/create_bucket/create_bucket_rest.sh +source ./tests/drivers/get_object_tagging/get_object_tagging_rest.sh +source ./tests/drivers/put_object/put_object_rest.sh + +@test "REST - GetObjectTagging - no tags" { + if [ "$DIRECT" != "true" ]; then + skip "https://github.com/versity/versitygw/issues/1686" + fi + test_file="test_file" + + run get_bucket_name "$BUCKET_ONE_NAME" + assert_success + bucket_name="$output" + + run setup_bucket_and_add_file "$bucket_name" "$test_file" + assert_success + + run get_check_object_tags_empty "$bucket_name" "$test_file" + assert_success +} + +@test "REST - GetObjectTagging - older version returns version ID" { + if [ "$DIRECT" != "true" ]; then + skip "https://github.com/versity/versitygw/issues/1693" + fi + test_file="test_file" + + run get_bucket_name "$BUCKET_ONE_NAME" + assert_success + bucket_name="$output" + + run setup_bucket_versioning_file_two_versions "$bucket_name" "$test_file" + assert_success + + run add_version_tags_check_version_id "$bucket_name" "$test_file" + assert_success +} + +@test "REST - GetObjectTagging - invalid version ID error returns version ID" { + if [ "$DIRECT" != "true" ]; then + skip "https://github.com/versity/versitygw/issues/1698" + fi + test_file="test_file" + + run get_bucket_name "$BUCKET_ONE_NAME" + assert_success + bucket_name="$output" + + run setup_bucket_and_add_file "$bucket_name" "$test_file" + assert_success + + run put_bucket_versioning_rest "$bucket_name" "Enabled" + assert_success + + run put_object_rest "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" + assert_success + + run get_object_tagging_invalid_version_id "$bucket_name" "$test_file" + assert_success +} \ No newline at end of file diff --git a/tests/test_rest_list_object_versions.sh b/tests/test_rest_list_object_versions.sh new file mode 100755 index 0000000..1ba1d3a --- /dev/null +++ b/tests/test_rest_list_object_versions.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bats + +# Copyright 2025 Versity Software +# This file is licensed under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http:#www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +load ./bats-support/load +load ./bats-assert/load + +source ./tests/setup.sh +source ./tests/drivers/create_bucket/create_bucket_rest.sh + +@test "ListObjectVersions - accidental query of versions on object returns correct error" { + if [ "$DIRECT" != "true" ]; then + skip "https://github.com/versity/versitygw/issues/1688" + fi + test_file="test_file" + + run get_bucket_name "$BUCKET_ONE_NAME" + assert_success + bucket_name="$output" + + run setup_bucket_and_add_file "$bucket_name" "$test_file" + assert_success + + run send_rest_go_command_expect_error "400" "InvalidRequest" "There is no such thing as the ?versions sub-resource for a key" \ + "-bucketName" "$bucket_name" "-objectKey" "$test_file" "-query" "versions=" + assert_success +} \ No newline at end of file diff --git a/tests/test_rest_put_object.sh b/tests/test_rest_put_object.sh index 5cf5cc6..bdbde12 100755 --- a/tests/test_rest_put_object.sh +++ b/tests/test_rest_put_object.sh @@ -445,7 +445,7 @@ export RUN_USERS=true assert_success } -@test "REST - PutObjectTagging - invalid x-amz-request-payer" { +@test "REST - PutObject - invalid x-amz-request-payer" { run get_bucket_name "$BUCKET_ONE_NAME" assert_success bucket_name="$output" @@ -473,3 +473,19 @@ export RUN_USERS=true "-method" "PUT" "-contentMD5" "-awsAccessKeyId" "$username" "-awsSecretAccessKey" "$password" "-signedParams" "x-amz-request-payer:dummy" assert_success } + +@test "REST - PutObject - content disposition" { + 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 "200" "-bucketName" "$bucket_name" "-objectKey" "$test_file" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \ + "-method" "PUT" "-contentMD5" "-signedParams" "Content-Disposition:dummy" + assert_success + + run head_object_check_header_key_and_value "$bucket_name" "$test_file" "Content-Disposition" "dummy" + assert_success +} diff --git a/tests/test_rest_put_object_tagging.sh b/tests/test_rest_put_object_tagging.sh index 76fb3d4..53c85f3 100755 --- a/tests/test_rest_put_object_tagging.sh +++ b/tests/test_rest_put_object_tagging.sh @@ -19,6 +19,7 @@ load ./bats-assert/load source ./tests/drivers/create_bucket/create_bucket_rest.sh source ./tests/drivers/get_object_tagging/get_object_tagging_rest.sh +source ./tests/drivers/list_object_versions/list_object_versions_rest.sh source ./tests/drivers/put_object_tagging/put_object_tagging_rest.sh source ./tests/util/util_public_access_block.sh source ./tests/setup.sh @@ -73,3 +74,18 @@ test_file="test_file" "-commandType" "putObjectTagging" "-tagKey" "key" "-tagValue" "value" "-contentMD5" "-signedParams" "x-amz-expected-bucket-owner:012345678901" assert_success } + +@test "REST -PutObjectTagging - older version" { + if [ "$RECREATE_BUCKETS" == "false" ]; then + skip "cannot change versioning status for static buckets" + fi + run get_bucket_name "$BUCKET_ONE_NAME" + assert_success + bucket_name="$output" + + run setup_bucket_versioning_file_two_versions "$bucket_name" "$test_file" + assert_success + + run tag_old_version "$bucket_name" "$test_file" + assert_success +} \ No newline at end of file