test: add WORM check matching new S3 error string

This commit is contained in:
Luke McCrone
2025-09-24 21:10:05 -03:00
parent 068b04ec62
commit 5ef61af6f3
2 changed files with 5 additions and 5 deletions

View File

@@ -128,12 +128,12 @@ test_get_put_object_legal_hold_s3api_root() {
echo "fdkljafajkfs" > "$TEST_FILE_FOLDER/$bucket_file"
run put_object_with_user "s3api" "$TEST_FILE_FOLDER/$bucket_file" "$BUCKET_ONE_NAME" "$bucket_file" "$username" "$password"
assert_failure
assert_output --partial "Object is WORM protected and cannot be overwritten"
assert_output --partial "object protected by object lock"
run delete_object_with_user "s3api" "$BUCKET_ONE_NAME" "$bucket_file" "$username" "$password"
assert_failure 1
# shellcheck disable=SC2154
assert_output --partial "Object is WORM protected and cannot be overwritten"
assert_output --partial "object protected by object lock"
run put_object_legal_hold "s3api" "$BUCKET_ONE_NAME" "$bucket_file" "OFF"
assert_success
@@ -173,12 +173,12 @@ test_get_put_object_retention_s3api_root() {
run put_object_with_user "s3api" "$TEST_FILE_FOLDER/$bucket_file" "$BUCKET_ONE_NAME" "$bucket_file" "$username" "$secret_key"
assert_failure
# shellcheck disable=SC2154
assert_output --partial "Object is WORM protected and cannot be overwritten"
assert_output --partial "object protected by object lock"
run delete_object_with_user "s3api" "$BUCKET_ONE_NAME" "$bucket_file" "$username" "$secret_key"
assert_failure
# shellcheck disable=SC2154
assert_output --partial "Object is WORM protected and cannot be overwritten"
assert_output --partial "object protected by object lock"
}
test_retention_bypass_s3api_root() {

View File

@@ -51,7 +51,7 @@ check_for_and_remove_worm_protection() {
return 2
fi
if [[ $3 == *"WORM"* ]]; then
if [[ $3 == *"WORM"* ]] || [[ "$3" == *"object protected by object lock"* ]]; then
log 5 "WORM protection found"
if ! put_object_legal_hold "rest" "$1" "$2" "OFF"; then
log 2 "error removing object legal hold"