mirror of
https://github.com/minio/minio.git
synced 2025-11-11 14:30:17 -05:00
cleanup object-lock/bucket tagging for gateways (#9548)
This PR is to ensure that we call the relevant object
layer APIs for necessary S3 API level functionalities
allowing gateway implementations to return proper
errors as NotImplemented{}
This allows for all our tests in mint to behave
appropriately and can be handled appropriately as
well.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Mint (C) 2017, 2018 Minio, Inc.
|
||||
# Mint (C) 2017-2020 Minio, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -69,24 +69,6 @@ function make_bucket() {
|
||||
return $rv
|
||||
}
|
||||
|
||||
function make_bucket_with_lock() {
|
||||
# Make bucket
|
||||
bucket_name="awscli-mint-test-bucket-$RANDOM"
|
||||
function="${AWS} s3api create-bucket --bucket ${bucket_name} --object-lock-enabled-for-bucket"
|
||||
|
||||
# execute the test
|
||||
out=$($function 2>&1)
|
||||
rv=$?
|
||||
|
||||
# if command is successful print bucket_name or print error
|
||||
if [ $rv -eq 0 ]; then
|
||||
echo "${bucket_name}"
|
||||
else
|
||||
echo "${out}"
|
||||
fi
|
||||
|
||||
return $rv
|
||||
}
|
||||
function delete_bucket() {
|
||||
# Delete bucket
|
||||
function="${AWS} s3 rb s3://${1} --force"
|
||||
@@ -688,7 +670,7 @@ function test_copy_object_storage_class() {
|
||||
out=$($function 2>&1)
|
||||
rv=$?
|
||||
# if this functionality is not implemented return right away.
|
||||
if [ $rv -eq 255 ]; then
|
||||
if [ $rv -ne 0 ]; then
|
||||
if echo "$out" | greq -q "NotImplemented"; then
|
||||
${AWS} s3 rb s3://"${bucket_name}" --force > /dev/null 2>&1
|
||||
return 0
|
||||
@@ -758,7 +740,7 @@ function test_copy_object_storage_class_same() {
|
||||
out=$($function 2>&1)
|
||||
rv=$?
|
||||
# if this functionality is not implemented return right away.
|
||||
if [ $rv -eq 255 ]; then
|
||||
if [ $rv -ne 0 ]; then
|
||||
if echo "$out" | greq -q "NotImplemented"; then
|
||||
${AWS} s3 rb s3://"${bucket_name}" --force > /dev/null 2>&1
|
||||
return 0
|
||||
@@ -1591,9 +1573,22 @@ function test_legal_hold() {
|
||||
# log start time
|
||||
start_time=$(get_time)
|
||||
|
||||
function="make_bucket_with_lock"
|
||||
bucket_name=$(make_bucket_with_lock)
|
||||
# Make bucket
|
||||
bucket_name="awscli-mint-test-bucket-$RANDOM"
|
||||
function="${AWS} s3api create-bucket --bucket ${bucket_name} --object-lock-enabled-for-bucket"
|
||||
|
||||
# execute the test
|
||||
out=$($function 2>&1)
|
||||
rv=$?
|
||||
|
||||
if [ $rv -ne 0 ]; then
|
||||
# if this functionality is not implemented return right away.
|
||||
if echo "$out" | greq -q "NotImplemented"; then
|
||||
${AWS} s3 rb s3://"${bucket_name}" --force > /dev/null 2>&1
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# if make bucket succeeds upload a file
|
||||
if [ $rv -eq 0 ]; then
|
||||
function="${AWS} s3api put-object --body ${MINT_DATA_DIR}/datafile-1-kB --bucket ${bucket_name} --key datafile-1-kB --object-lock-legal-hold-status ON"
|
||||
|
||||
Reference in New Issue
Block a user