diff --git a/.github/workflows/system.yml b/.github/workflows/system.yml
index 6e47627..91e5d49 100644
--- a/.github/workflows/system.yml
+++ b/.github/workflows/system.yml
@@ -39,6 +39,24 @@ jobs:
RECREATE_BUCKETS: "true"
DELETE_BUCKETS_AFTER_TEST: "true"
BACKEND: "posix"
+ - set: "REST, posix, static, base|acl|multipart|put-object, folder IAM"
+ IAM_TYPE: folder
+ RUN_SET: "rest-base,rest-acl,rest-multipart,rest-put-object"
+ RECREATE_BUCKETS: "false"
+ DELETE_BUCKETS_AFTER_TEST: "false"
+ BACKEND: "posix"
+ - set: "REST, posix, static, chunked|checksum|versioning|bucket, folder IAM"
+ IAM_TYPE: folder
+ RUN_SET: "rest-chunked,rest-checksum,rest-versioning,rest-bucket,rest-list-buckets,rest-create-bucket,rest-head-bucket"
+ RECREATE_BUCKETS: "false"
+ DELETE_BUCKETS_AFTER_TEST: "false"
+ BACKEND: "posix"
+ - set: "REST, posix, static, not implemented|rest-delete-bucket-ownership-controls|rest-delete-bucket-tagging, folder IAM"
+ IAM_TYPE: folder
+ RUN_SET: "rest-not-implemented,rest-delete-bucket-ownership-controls,rest-delete-bucket-tagging"
+ RECREATE_BUCKETS: "false"
+ DELETE_BUCKETS_AFTER_TEST: "false"
+ BACKEND: "posix"
- set: "s3, posix, non-file count, non-static, folder IAM"
IAM_TYPE: folder
RUN_SET: "s3-non-file-count"
@@ -201,9 +219,9 @@ jobs:
MC_ALIAS: versity
LOG_LEVEL: 4
GOCOVERDIR: ${{ github.workspace }}/cover
- USERNAME_ONE: ABCDEFG
+ USERNAME_ONE: HIJKLMN
PASSWORD_ONE: 1234567
- USERNAME_TWO: HIJKLMN
+ USERNAME_TWO: OPQRSTU
PASSWORD_TWO: 8901234
TEST_FILE_FOLDER: ${{ github.workspace }}/versity-gwtest-files
REMOVE_TEST_FILE_FOLDER: true
diff --git a/tests/commands/complete_multipart_upload.sh b/tests/commands/complete_multipart_upload.sh
index 3c8b25b..04ea7b6 100644
--- a/tests/commands/complete_multipart_upload.sh
+++ b/tests/commands/complete_multipart_upload.sh
@@ -92,6 +92,7 @@ complete_multipart_upload_rest_invalid_checksum() {
if ! check_param_count_v2 "bucket, key, upload ID, parts payload, type, algorithm, correct hash" 7 $#; then
return 1
fi
+ log 5 "bucket name: $1"
if ! result=$(COMMAND_LOG="$COMMAND_LOG" BUCKET_NAME="$1" OBJECT_KEY="$2" UPLOAD_ID="$3" PARTS="$4" CHECKSUM_TYPE="$5" CHECKSUM_ALGORITHM="$6" CHECKSUM_HASH="$7" OUTPUT_FILE="$TEST_FILE_FOLDER/result.txt" ./tests/rest_scripts/complete_multipart_upload.sh 2>&1); then
log 2 "error completing multipart upload: $result"
return 1
diff --git a/tests/commands/put_bucket_acl.sh b/tests/commands/put_bucket_acl.sh
index 365097c..0ebfad0 100644
--- a/tests/commands/put_bucket_acl.sh
+++ b/tests/commands/put_bucket_acl.sh
@@ -69,7 +69,7 @@ reset_bucket_acl() {
log 2 "error resetting direct ACL"
return 1
fi
- if ! put_bucket_acl_rest "$BUCKET_ONE_NAME" "$TEST_FILE_FOLDER/$acl_file"; then
+ if ! put_bucket_acl_rest "$1" "$TEST_FILE_FOLDER/$acl_file"; then
log 2 "error putting bucket acl (s3api)"
return 1
fi
diff --git a/tests/commands/upload_part.sh b/tests/commands/upload_part.sh
index 04bc0f4..23da052 100644
--- a/tests/commands/upload_part.sh
+++ b/tests/commands/upload_part.sh
@@ -96,7 +96,7 @@ upload_part_rest_without_upload_id() {
log 2 "error uploading part $i: $result"
return 1
fi
- if ! check_rest_expected_error "$result" "$TEST_FILE_FOLDER/response.txt" "405" "MethodNotAllowed" "method is not allowed"; then
+ if ! check_rest_expected_error "$result" "$TEST_FILE_FOLDER/response.txt" "400" "InvalidArgument" "does not accept partNumber without uploadId"; then
log 2 "error checking error"
return 1
fi
diff --git a/tests/drivers/complete_multipart_upload/complete_multipart_upload_rest.sh b/tests/drivers/complete_multipart_upload/complete_multipart_upload_rest.sh
index dc135ea..145c7f3 100644
--- a/tests/drivers/complete_multipart_upload/complete_multipart_upload_rest.sh
+++ b/tests/drivers/complete_multipart_upload/complete_multipart_upload_rest.sh
@@ -110,7 +110,7 @@ test_multipart_upload_with_checksum() {
log 2 "error calculating multipart checksum"
return 1
fi
- if ! complete_multipart_upload_with_checksum "$1" "$2" "$TEST_FILE_FOLDER/$2" "$upload_id" 2 "$3" "$4"; then
+ if ! complete_multipart_upload_with_checksum "$bucket_name" "$2" "$TEST_FILE_FOLDER/$2" "$upload_id" 2 "$3" "$4"; then
log 2 "error completing multipart upload"
return 1
fi
@@ -125,7 +125,7 @@ test_complete_multipart_upload_unneeded_algorithm_parameter() {
log 2 "error performing multipart upload with checksum before completion"
return 1
fi
- if ! complete_multipart_upload_rest_nonexistent_param "$1" "$2" "$upload_id" "$parts_payload"; then
+ if ! complete_multipart_upload_rest_nonexistent_param "$bucket_name" "$2" "$upload_id" "$parts_payload"; then
log 2 "error completing multipart upload with nonexistent param"
return 1
fi
@@ -144,7 +144,7 @@ test_complete_multipart_upload_incorrect_checksum() {
log 2 "error calculating multipart checksum"
return 1
fi
- if ! complete_multipart_upload_rest_incorrect_checksum "$1" "$2" "$upload_id" "$parts_payload" "$3" "$4" "$checksum"; then
+ if ! complete_multipart_upload_rest_incorrect_checksum "$bucket_name" "$2" "$upload_id" "$parts_payload" "$3" "$4" "$checksum"; then
log 2 "error completing multipart upload with nonexistent param"
return 1
fi
@@ -159,7 +159,7 @@ test_complete_multipart_upload_invalid_checksum() {
log 2 "error performing multipart upload with checksum before completion"
return 1
fi
- if ! complete_multipart_upload_rest_invalid_checksum "$1" "$2" "$upload_id" "$parts_payload" "$3" "$4" "wrong"; then
+ if ! complete_multipart_upload_rest_invalid_checksum "$bucket_name" "$2" "$upload_id" "$parts_payload" "$3" "$4" "wrong"; then
log 2 "error completing multipart upload with nonexistent param"
return 1
fi
diff --git a/tests/drivers/copy_object/copy_object_rest.sh b/tests/drivers/copy_object/copy_object_rest.sh
index 0db4e56..040bdd3 100644
--- a/tests/drivers/copy_object/copy_object_rest.sh
+++ b/tests/drivers/copy_object/copy_object_rest.sh
@@ -39,7 +39,7 @@ copy_object_invalid_copy_source() {
log 2 "'copy_object_invalid_copy_source' requires bucket name"
return 1
fi
- if ! result=$(COMMAND_LOG="$COMMAND_LOG" BUCKET_NAME="$BUCKET_ONE_NAME" OBJECT_KEY="dummy-copy" COPY_SOURCE="dummy" OUTPUT_FILE="$TEST_FILE_FOLDER/result.txt" ./tests/rest_scripts/copy_object.sh); then
+ if ! result=$(COMMAND_LOG="$COMMAND_LOG" BUCKET_NAME="$1" OBJECT_KEY="dummy-copy" COPY_SOURCE="dummy" OUTPUT_FILE="$TEST_FILE_FOLDER/result.txt" ./tests/rest_scripts/copy_object.sh); then
log 2 "error copying object: $result"
return 1
fi
diff --git a/tests/drivers/create_bucket/create_bucket_rest.sh b/tests/drivers/create_bucket/create_bucket_rest.sh
index df97ea0..cce553f 100644
--- a/tests/drivers/create_bucket/create_bucket_rest.sh
+++ b/tests/drivers/create_bucket/create_bucket_rest.sh
@@ -48,8 +48,14 @@ setup_and_create_bucket_and_check_acl() {
log 5 "username=$username, password=$password"
envs="$1=$id OBJECT_OWNERSHIP=BucketOwnerPreferred"
log 5 "envs: $envs"
+
+ if ! bucket_name=$(get_bucket_name "$BUCKET_ONE_NAME" 2>&1); then
+ log 2 "error retrieving bucket name: $bucket_name"
+ return 1
+ fi
+
# shellcheck disable=SC2154
- if ! create_bucket_and_check_acl "$BUCKET_ONE_NAME" "$envs" "$username" "$password" "$user_canonical_id" "$owner_canonical_id"; then
+ if ! create_bucket_and_check_acl "$bucket_name" "$envs" "$username" "$password" "$user_canonical_id" "$owner_canonical_id"; then
log 2 "error creating bucket and checking ACL"
return 1
fi
@@ -128,6 +134,7 @@ get_bucket_prefix() {
}
setup_bucket_v2() {
+ log 6 "setup_bucket_v2 '$1'"
if ! check_param_count_v2 "bucket prefix or name" 1 $#; then
return 1
fi
@@ -135,6 +142,7 @@ setup_bucket_v2() {
log 2 "error getting prefix: $prefix"
return 1
fi
+ log 5 "bucket prefix: $prefix"
if ! bucket_cleanup_if_bucket_exists_v2 "$prefix"; then
log 2 "error cleaning up bucket(s), if it/they exist(s)"
return 1
@@ -149,12 +157,41 @@ setup_bucket_v2() {
return 0
}
+# params: client, bucket name(s)
+# return 0 for success, 1 for failure
+setup_buckets() {
+ if ! check_param_count_gt "minimum of 1 bucket name" 1 $#; then
+ return 1
+ fi
+ for name in "$@"; do
+ if ! setup_bucket "$name"; then
+ log 2 "error setting up bucket $name"
+ return 1
+ fi
+ done
+ return 0
+}
+
+setup_buckets_v2() {
+ if ! check_param_count_gt "minimum of 1 bucket name" 1 $#; then
+ return 1
+ fi
+ for name in "$@"; do
+ if ! setup_bucket_v2 "$name"; then
+ log 2 "error setting up bucket $name"
+ return 1
+ fi
+ done
+ return 0
+}
+
get_bucket_name() {
if ! check_param_count_v2 "bucket" 1 $#; then
return 1
fi
if [ "$RECREATE_BUCKETS" == "false" ]; then
echo "$1"
+ return 0
fi
echo "$1-$(date +%Y%m%d%H%M%S)"
}
@@ -188,10 +225,6 @@ setup_bucket_object_lock_enabled() {
log 2 "error cleaning up bucket"
return 1
fi
- if [ "$DIRECT" == "true" ] && [ "$RECREATE_BUCKETS" == "true" ]; then
- log 2 "bucket not confirmed as deleted"
- return 1
- fi
# in static bucket config, bucket will still exist
if ! bucket_exists "$1"; then
@@ -200,9 +233,5 @@ setup_bucket_object_lock_enabled() {
return 1
fi
fi
- if [ "$DIRECT" == "true" ]; then
- log 2 "bucket not confirmed as created"
- return 1
- fi
return 0
}
diff --git a/tests/drivers/delete_bucket/delete_bucket_rest.sh b/tests/drivers/delete_bucket/delete_bucket_rest.sh
index 7ca6bd7..d16146c 100644
--- a/tests/drivers/delete_bucket/delete_bucket_rest.sh
+++ b/tests/drivers/delete_bucket/delete_bucket_rest.sh
@@ -15,6 +15,7 @@
# under the License.
source ./tests/commands/list_buckets.sh
+source ./tests/drivers/list_buckets/list_buckets_rest.sh
delete_buckets_with_prefix() {
if ! check_param_count_v2 "bucket prefix" 1 $#; then
@@ -119,3 +120,23 @@ bucket_cleanup_if_bucket_exists_v2() {
fi
return 0
}
+
+# params: bucket name
+# return 0 if able to delete recursively, 1 if not
+delete_bucket_recursive() {
+ log 6 "delete_bucket_recursive '$1'"
+ if ! check_param_count "delete_bucket_recursive_s3api" "bucket" 1 $#; then
+ return 1
+ fi
+
+ if ! reset_bucket "$1"; then
+ log 2 "error clearing bucket (s3api)"
+ return 1
+ fi
+
+ if ! delete_bucket_rest "$1"; then
+ log 2 "error deleting bucket"
+ return 1
+ fi
+ return 0
+}
diff --git a/tests/util/util_setup.sh b/tests/drivers/file.sh
similarity index 61%
rename from tests/util/util_setup.sh
rename to tests/drivers/file.sh
index b19dc01..0306b00 100644
--- a/tests/util/util_setup.sh
+++ b/tests/drivers/file.sh
@@ -1,4 +1,18 @@
-#!/usr/bin/env bash
+#!/usr/bin/env bats
+
+# Copyright 2024 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.
source ./tests/drivers/params.sh
@@ -72,11 +86,11 @@ setup_bucket_and_files_base() {
return 0
}
-setup_bucket_and_large_file() {
- if ! check_param_count "setup_bucket_and_large_file" "bucket, file name" 2 $#; then
+setup_bucket_and_large_file_base() {
+ if ! check_param_count_v2 "bucket, file name, function" 3 $#; then
return 1
fi
- if ! setup_bucket "$1"; then
+ if ! "$3" "$1"; then
log 2 "error setting up bucket"
return 1
fi
@@ -87,18 +101,24 @@ setup_bucket_and_large_file() {
return 0
}
-setup_bucket_file_and_user() {
- if ! check_param_count "setup_bucket_file_and_user" "bucket, file, username, password, user type" 5 $#; then
+setup_bucket_and_large_file() {
+ if ! check_param_count_v2 "bucket, file name" 2 $#; then
return 1
fi
- if ! setup_bucket_and_files "$1" "$2"; then
- log 2 "error setting up bucket and file"
+ if ! setup_bucket_and_large_file_base "$1" "$2" "setup_bucket"; then
+ log 2 "error setting up bucket and large file"
+ return 1
+ fi
+ return 0
+}
+
+setup_bucket_and_large_file_v2() {
+ if ! check_param_count_v2 "bucket, file name" 2 $#; then
+ return 1
+ fi
+ if ! setup_bucket_and_large_file_base "$1" "$2" "setup_bucket_v2"; then
+ log 2 "error setting up bucket and large file"
return 1
fi
- if ! result=$(setup_user_versitygw_or_direct "$3" "$4" "$5" "$1"); then
- log 2 "error setting up user"
- return 1
- fi
- echo "$result"
return 0
}
diff --git a/tests/drivers/get_bucket_acl/get_bucket_acl.sh b/tests/drivers/get_bucket_acl/get_bucket_acl.sh
index 96349da..7410add 100644
--- a/tests/drivers/get_bucket_acl/get_bucket_acl.sh
+++ b/tests/drivers/get_bucket_acl/get_bucket_acl.sh
@@ -49,7 +49,7 @@ get_check_acl_after_first_put() {
log 2 "'get_check_acl_after_first_put' requires client, bucket"
return 1
fi
- if ! get_bucket_acl "$1" "$BUCKET_ONE_NAME"; then
+ if ! get_bucket_acl "$1" "$2"; then
log 2 "error retrieving second ACL"
return 1
fi
@@ -74,7 +74,7 @@ get_check_acl_after_second_put() {
log 2 "'get_check_acl_after_second_put' requires client, bucket"
return 1
fi
- if ! get_bucket_acl "$1" "$BUCKET_ONE_NAME"; then
+ if ! get_bucket_acl "$1" "$2"; then
log 2 "error retrieving third ACL"
return 1
fi
@@ -100,14 +100,3 @@ get_check_acl_after_second_put() {
fi
return 0
}
-
-check_direct_display_name() {
- if ! display_name=$(echo "$owner" | xmllint --xpath '//*[local-name()="DisplayName"]/text()' - 2>&1); then
- log 2 "error getting display name: $display_name"
- return 1
- fi
- if [ "$display_name" != "$DIRECT_DISPLAY_NAME" ]; then
- log 2 "display name mismatch (expected '$DIRECT_DISPLAY_NAME', actual '$display_name')"
- return 1
- fi
-}
diff --git a/tests/drivers/get_bucket_acl/get_bucket_acl_rest.sh b/tests/drivers/get_bucket_acl/get_bucket_acl_rest.sh
index d6b3977..a0222ad 100644
--- a/tests/drivers/get_bucket_acl/get_bucket_acl_rest.sh
+++ b/tests/drivers/get_bucket_acl/get_bucket_acl_rest.sh
@@ -116,3 +116,14 @@ get_and_check_acl_rest() {
fi
return 0
}
+
+check_direct_display_name() {
+ if ! display_name=$(echo "$owner" | xmllint --xpath '//*[local-name()="DisplayName"]/text()' - 2>&1); then
+ log 2 "error getting display name: $display_name"
+ return 1
+ fi
+ if [ "$display_name" != "$DIRECT_DISPLAY_NAME" ]; then
+ log 2 "display name mismatch (expected '$DIRECT_DISPLAY_NAME', actual '$display_name')"
+ return 1
+ fi
+}
diff --git a/tests/util/util_attributes.sh b/tests/drivers/get_object_attributes/get_object_attributes_rest.sh
similarity index 65%
rename from tests/util/util_attributes.sh
rename to tests/drivers/get_object_attributes/get_object_attributes_rest.sh
index 6005327..6b2f1d2 100644
--- a/tests/util/util_attributes.sh
+++ b/tests/drivers/get_object_attributes/get_object_attributes_rest.sh
@@ -1,23 +1,37 @@
#!/usr/bin/env bash
+# Copyright 2024 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.
+
upload_and_check_attributes() {
- if [ $# -ne 2 ]; then
- log 2 "'upload_and_check_attributes' requires test file, file size"
+ if ! check_param_count_v2 "bucket, test file, file size" 3 $#; then
return 1
fi
- if ! perform_multipart_upload_rest "$BUCKET_ONE_NAME" "$1" "$TEST_FILE_FOLDER/$1-0" "$TEST_FILE_FOLDER/$1-1" \
- "$TEST_FILE_FOLDER/$1-2" "$TEST_FILE_FOLDER/$1-3"; then
+ 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
log 2 "error uploading and checking parts"
return 1
fi
- if ! result=$(COMMAND_LOG="$COMMAND_LOG" BUCKET_NAME="$BUCKET_ONE_NAME" OBJECT_KEY="$1" ATTRIBUTES="ETag,StorageClass,ObjectParts,ObjectSize" OUTPUT_FILE="$TEST_FILE_FOLDER/attributes.txt" ./tests/rest_scripts/get_object_attributes.sh); then
+ 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
log 2 "error listing object attributes: $result"
return 1
fi
- if ! check_attributes_after_upload "$2"; then
+ if ! check_attributes_after_upload "$3"; then
log 2 "error checking attributes after upload"
return 1
fi
+ return 0
}
check_attributes_after_upload() {
@@ -59,11 +73,10 @@ check_attributes_after_upload() {
}
check_attributes_invalid_param() {
- if [ $# -ne 1 ]; then
- log 2 "'check_attributes_invalid_param' requires test file"
+ if ! check_param_count_v2 "bucket name, test file" 2 $#; then
return 1
fi
- if ! result=$(COMMAND_LOG="$COMMAND_LOG" BUCKET_NAME="$BUCKET_ONE_NAME" OBJECT_KEY="$1" ATTRIBUTES="ETags" OUTPUT_FILE="$TEST_FILE_FOLDER/attributes.txt" ./tests/rest_scripts/get_object_attributes.sh); then
+ if ! result=$(COMMAND_LOG="$COMMAND_LOG" BUCKET_NAME="$1" OBJECT_KEY="$2" ATTRIBUTES="ETags" OUTPUT_FILE="$TEST_FILE_FOLDER/attributes.txt" ./tests/rest_scripts/get_object_attributes.sh); then
log 2 "error listing object attributes: $result"
return 1
fi
@@ -83,24 +96,23 @@ check_attributes_invalid_param() {
}
add_and_check_checksum() {
- if [ $# -ne 2 ]; then
- log 2 "'add_and_check_checksum' requires data file, key"
+ if ! check_param_count_v2 "data file, bucket, key" 3 $#; then
return 1
fi
- if ! result=$(COMMAND_LOG="$COMMAND_LOG" DATA_FILE="$1" BUCKET_NAME="$BUCKET_ONE_NAME" OBJECT_KEY="$2" CHECKSUM_TYPE="sha256" OUTPUT_FILE="$TEST_FILE_FOLDER/result.txt" ./tests/rest_scripts/put_object.sh); then
+ if ! result=$(COMMAND_LOG="$COMMAND_LOG" DATA_FILE="$1" BUCKET_NAME="$2" OBJECT_KEY="$3" CHECKSUM_TYPE="sha256" OUTPUT_FILE="$TEST_FILE_FOLDER/result.txt" ./tests/rest_scripts/put_object.sh); then
log 2 "error sending object file: $result"
return 1
fi
if [ "$result" != "200" ]; then
- log 2 "expected response code of '200', was '$result' (output: $(cat "$TEST_FILE_FOLDER/result.txt")"
+ log 2 "expected response code of '200', was '$result' (output: $(cat "$TEST_FILE_FOLDER/result.txt"))"
return 1
fi
- if ! result=$(COMMAND_LOG="$COMMAND_LOG" BUCKET_NAME="$BUCKET_ONE_NAME" OBJECT_KEY="$2" ATTRIBUTES="Checksum" OUTPUT_FILE="$TEST_FILE_FOLDER/attributes.txt" ./tests/rest_scripts/get_object_attributes.sh); then
+ if ! result=$(COMMAND_LOG="$COMMAND_LOG" BUCKET_NAME="$2" OBJECT_KEY="$3" ATTRIBUTES="Checksum" OUTPUT_FILE="$TEST_FILE_FOLDER/attributes.txt" ./tests/rest_scripts/get_object_attributes.sh); then
log 2 "error listing object attributes: $result (output: $(cat "$TEST_FILE_FOLDER/attributes.txt")"
return 1
fi
if [ "$result" != "200" ]; then
- log 2 "expected response code of '200', was '$result'"
+ log 2 "expected response code of '200', was '$result' ($(cat "$TEST_FILE_FOLDER/attributes.txt"))"
return 1
fi
log 5 "attributes: $(cat "$TEST_FILE_FOLDER/attributes.txt")"
@@ -129,4 +141,4 @@ get_etag_attribute_rest() {
return 1
fi
return 0
-}
\ No newline at end of file
+}
diff --git a/tests/drivers/put_object/put_object_rest.sh b/tests/drivers/put_object/put_object_rest.sh
index 03f8a6f..b5c35c6 100644
--- a/tests/drivers/put_object/put_object_rest.sh
+++ b/tests/drivers/put_object/put_object_rest.sh
@@ -40,7 +40,7 @@ setup_bucket_and_add_file() {
if ! check_param_count_v2 "bucket, filename" 2 $#; then
return 1
fi
- if ! setup_bucket "$1"; then
+ if ! setup_bucket_v2 "$1"; then
log 2 "error setting up bucket"
return 1
fi
@@ -53,4 +53,4 @@ setup_bucket_and_add_file() {
return 1
fi
return 0
-}
\ No newline at end of file
+}
diff --git a/tests/drivers/upload_part/upload_part_rest.sh b/tests/drivers/upload_part/upload_part_rest.sh
index 1815a5f..1b38513 100644
--- a/tests/drivers/upload_part/upload_part_rest.sh
+++ b/tests/drivers/upload_part/upload_part_rest.sh
@@ -78,16 +78,20 @@ perform_full_multipart_upload_with_checksum_before_completion() {
if ! check_param_count_v2 "bucket, filename, checksum type, algorithm" 4 $#; then
return 1
fi
- if ! setup_bucket_and_large_file "$1" "$2"; then
+ if ! bucket_name=$(get_bucket_name "$1" 2>&1); then
+ log 2 "error getting bucket name: $bucket_name"
+ return 1
+ fi
+ if ! setup_bucket_and_large_file_v2 "$bucket_name" "$2"; then
log 2 "error setting up bucket and large file"
return 1
fi
- if ! create_multipart_upload_rest "$1" "$2" "CHECKSUM_TYPE=$3 CHECKSUM_ALGORITHM=$4" "parse_upload_id"; then
+ if ! create_multipart_upload_rest "$bucket_name" "$2" "CHECKSUM_TYPE=$3 CHECKSUM_ALGORITHM=$4" "parse_upload_id"; then
log 2 "error creating multipart upload"
return 1
fi
lowercase_checksum_algorithm=$(echo -n "$4" | tr '[:upper:]' '[:lower:]')
- if ! upload_parts_rest_with_checksum_before_completion "$1" "$2" "$TEST_FILE_FOLDER/$2" "$upload_id" 2 "$lowercase_checksum_algorithm"; then
+ if ! upload_parts_rest_with_checksum_before_completion "$bucket_name" "$2" "$TEST_FILE_FOLDER/$2" "$upload_id" 2 "$lowercase_checksum_algorithm"; then
log 2 "error uploading parts"
return 1
fi
diff --git a/tests/drivers/user.sh b/tests/drivers/user.sh
index a931a73..c99ffc4 100644
--- a/tests/drivers/user.sh
+++ b/tests/drivers/user.sh
@@ -14,6 +14,7 @@
# specific language governing permissions and limitations
# under the License.
+source ./tests/drivers/file.sh
source ./tests/util/util_users.sh
create_versitygw_acl_user_or_get_direct_user() {
@@ -49,10 +50,10 @@ create_versitygw_acl_user_or_get_direct_user() {
}
setup_bucket_and_user() {
- if ! check_param_count "setup_bucket_and_user" "bucket, username, password, user type" 4 $#; then
+ if ! check_param_count_v2 "bucket or prefix, username, password, user type" 4 $#; then
return 1
fi
- if ! setup_bucket "$1"; then
+ if ! setup_bucket_v2 "$1"; then
log 2 "error setting up bucket"
return 1
fi
@@ -64,11 +65,11 @@ setup_bucket_and_user() {
return 0
}
-setup_bucket_and_user_v2() {
+setup_bucket_and_acl_user() {
if ! check_param_count_v2 "bucket, username, password" 3 $#; then
return 1
fi
- if ! setup_bucket "$1"; then
+ if ! setup_bucket_v2 "$1"; then
log 2 "error setting up bucket"
return 1
fi
@@ -79,3 +80,35 @@ setup_bucket_and_user_v2() {
echo "$result"
return 0
}
+
+setup_bucket_file_and_user() {
+ if ! check_param_count "setup_bucket_file_and_user" "bucket, file, username, password, user type" 5 $#; then
+ return 1
+ fi
+ if ! setup_bucket_and_files "$1" "$2"; then
+ log 2 "error setting up bucket and file"
+ return 1
+ fi
+ if ! result=$(setup_user_versitygw_or_direct "$3" "$4" "$5" "$1"); then
+ log 2 "error setting up user"
+ return 1
+ fi
+ echo "$result"
+ return 0
+}
+
+setup_bucket_file_and_user_v2() {
+ if ! check_param_count_v2 "bucket name or prefix, file, username, password, user type" 5 $#; then
+ return 1
+ fi
+ if ! setup_bucket_and_files_v2 "$1" "$2"; then
+ log 2 "error setting up bucket and file"
+ return 1
+ fi
+ if ! result=$(setup_user_versitygw_or_direct "$3" "$4" "$5" "$1"); then
+ log 2 "error setting up user"
+ return 1
+ fi
+ echo "$result"
+ return 0
+}
diff --git a/tests/drivers/xml.sh b/tests/drivers/xml.sh
index 7a0183f..07b32e3 100644
--- a/tests/drivers/xml.sh
+++ b/tests/drivers/xml.sh
@@ -141,8 +141,12 @@ get_xml_data() {
xml_start=$(grep -n "]*>" "$1" | head -n 1 | cut -d: -f1)
+ if [ -z "$xml_start" ]; then
+ log 2 "No XML declaration found."
+ return 1
+ fi
fi
log 5 "xml start: $xml_start"
diff --git a/tests/test_common.sh b/tests/test_common.sh
index 79f24ee..64e8b3a 100644
--- a/tests/test_common.sh
+++ b/tests/test_common.sh
@@ -15,13 +15,6 @@
# under the License.
source ./tests/setup.sh
-source ./tests/util/util_bucket_location.sh
-source ./tests/util/util_file.sh
-source ./tests/util/util_list_buckets.sh
-source ./tests/util/util_object.sh
-source ./tests/util/util_policy.sh
-source ./tests/util/util_presigned_url.sh
-source ./tests/util/util_setup.sh
source ./tests/commands/copy_object.sh
source ./tests/commands/delete_bucket_tagging.sh
source ./tests/commands/delete_object_tagging.sh
@@ -36,7 +29,14 @@ source ./tests/commands/put_bucket_tagging.sh
source ./tests/commands/put_object_tagging.sh
source ./tests/commands/put_object.sh
source ./tests/commands/put_public_access_block.sh
+source ./tests/drivers/file.sh
source ./tests/drivers/params.sh
+source ./tests/util/util_bucket_location.sh
+source ./tests/util/util_file.sh
+source ./tests/util/util_list_buckets.sh
+source ./tests/util/util_object.sh
+source ./tests/util/util_policy.sh
+source ./tests/util/util_presigned_url.sh
# param: command type
# fail on test failure
diff --git a/tests/test_common_acl.sh b/tests/test_common_acl.sh
index 8a3cdc1..05e1b44 100644
--- a/tests/test_common_acl.sh
+++ b/tests/test_common_acl.sh
@@ -14,6 +14,8 @@
# specific language governing permissions and limitations
# under the License.
+source ./tests/drivers/create_bucket/create_bucket_rest.sh
+
if [ "$SKIP_ACL_TESTING" == "true" ] || [ "$SKIP_USERS_TESTS" == "true" ]; then
skip "Skipping ACL tests"
exit 0
@@ -62,15 +64,20 @@ test_common_put_bucket_acl() {
run check_param_count "test_common_put_bucket_acl" "client type" 1 "$#"
assert_success
- run setup_bucket_and_user "$BUCKET_ONE_NAME" "$USERNAME_ONE" "$PASSWORD_ONE" "user"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ # shellcheck disable=SC2154
+ bucket_name="$output"
+
+ run setup_bucket_and_user "$bucket_name" "$USERNAME_ONE" "$PASSWORD_ONE" "user"
assert_success
# shellcheck disable=SC2154
username="${lines[${#lines[@]}-2]}"
- run put_bucket_ownership_controls "$BUCKET_ONE_NAME" "BucketOwnerPreferred"
+ run put_bucket_ownership_controls "$bucket_name" "BucketOwnerPreferred"
assert_success
- run get_check_acl_id "$1" "$BUCKET_ONE_NAME"
+ run get_check_acl_id "$1" "$bucket_name"
assert_success
acl_file="test-acl"
@@ -82,18 +89,18 @@ test_common_put_bucket_acl() {
assert_success
log 5 "acl: $(cat "$TEST_FILE_FOLDER/$acl_file")"
- run put_bucket_acl_s3api "$BUCKET_ONE_NAME" "$TEST_FILE_FOLDER"/"$acl_file"
+ run put_bucket_acl_s3api "$bucket_name" "$TEST_FILE_FOLDER"/"$acl_file"
assert_success
- run get_check_acl_after_first_put "$1" "$BUCKET_ONE_NAME"
+ run get_check_acl_after_first_put "$1" "$bucket_name"
assert_success
run setup_acl_json "$TEST_FILE_FOLDER/$acl_file" "CanonicalUser" "$username" "FULL_CONTROL" "$AWS_ACCESS_KEY_ID"
assert_success
- run put_bucket_acl_s3api "$BUCKET_ONE_NAME" "$TEST_FILE_FOLDER"/"$acl_file"
+ run put_bucket_acl_s3api "$bucket_name" "$TEST_FILE_FOLDER"/"$acl_file"
assert_success
- run get_check_acl_after_second_put "$1" "$BUCKET_ONE_NAME"
+ run get_check_acl_after_second_put "$1" "$bucket_name"
assert_success
}
\ No newline at end of file
diff --git a/tests/test_mc.sh b/tests/test_mc.sh
index 9213942..9151d15 100755
--- a/tests/test_mc.sh
+++ b/tests/test_mc.sh
@@ -17,14 +17,15 @@
load ./bats-support/load
load ./bats-assert/load
-source ./tests/test_common.sh
source ./tests/setup.sh
-source ./tests/util/util_create_bucket.sh
-source ./tests/util/util_head_bucket.sh
-source ./tests/util/util_tags.sh
+source ./tests/test_common.sh
source ./tests/commands/delete_bucket_policy.sh
source ./tests/commands/get_bucket_policy.sh
source ./tests/commands/put_bucket_policy.sh
+source ./tests/drivers/create_bucket/create_bucket_rest.sh
+source ./tests/util/util_create_bucket.sh
+source ./tests/util/util_head_bucket.sh
+source ./tests/util/util_tags.sh
export RUN_MC=true
diff --git a/tests/test_rest.sh b/tests/test_rest.sh
index 2f3bb42..fe3fe6b 100755
--- a/tests/test_rest.sh
+++ b/tests/test_rest.sh
@@ -31,12 +31,13 @@ source ./tests/commands/put_object_retention.sh
source ./tests/commands/put_object_tagging.sh
source ./tests/drivers/create_bucket/create_bucket_rest.sh
source ./tests/drivers/copy_object/copy_object_rest.sh
+source ./tests/drivers/get_object_attributes/get_object_attributes_rest.sh
source ./tests/drivers/get_bucket_ownership_controls/get_bucket_ownership_controls_rest.sh
source ./tests/drivers/head_object/head_object_rest.sh
+source ./tests/drivers/file.sh
source ./tests/drivers/xml.sh
source ./tests/logger.sh
source ./tests/setup.sh
-source ./tests/util/util_attributes.sh
source ./tests/util/util_chunked_upload.sh
source ./tests/util/util_delete_object.sh
source ./tests/util/util_legal_hold.sh
@@ -49,7 +50,6 @@ source ./tests/util/util_object.sh
source ./tests/util/util_policy.sh
source ./tests/util/util_public_access_block.sh
source ./tests/util/util_rest.sh
-source ./tests/util/util_setup.sh
source ./tests/util/util_tags.sh
source ./tests/util/util_time.sh
source ./tests/util/util_versioning.sh
@@ -58,30 +58,38 @@ export RUN_USERS=true
test_file="test_file"
@test "test_rest_list_objects" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run list_check_objects_rest "$BUCKET_ONE_NAME"
+ run list_check_objects_rest "$bucket_name"
assert_success
}
@test "test_rest_delete_object" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
+ run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
assert_success
- run delete_object "rest" "$BUCKET_ONE_NAME" "$test_file"
+ run delete_object "rest" "$bucket_name" "$test_file"
assert_success
- run get_object "rest" "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
+ run get_object "rest" "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
assert_failure
}
@@ -89,22 +97,26 @@ test_file="test_file"
test_key="TestKey"
test_value="TestValue"
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run put_object_tagging "rest" "$BUCKET_ONE_NAME" "$test_file" "$test_key" "$test_value"
+ run put_object_tagging "rest" "$bucket_name" "$test_file" "$test_key" "$test_value"
assert_success
- run check_verify_object_tags "rest" "$BUCKET_ONE_NAME" "$test_file" "$test_key" "$test_value"
+ run check_verify_object_tags "rest" "$bucket_name" "$test_file" "$test_key" "$test_value"
assert_success
- run delete_object_tagging "rest" "$BUCKET_ONE_NAME" "$test_file"
+ run delete_object_tagging "rest" "$bucket_name" "$test_file"
assert_success
- run verify_no_object_tags "rest" "$BUCKET_ONE_NAME" "$test_file"
+ run verify_no_object_tags "rest" "$bucket_name" "$test_file"
assert_success
}
@@ -112,13 +124,17 @@ test_file="test_file"
test_key="TestKey"
test_value="TestValue"
- run setup_bucket_object_lock_enabled "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_object_lock_enabled_v2 "$bucket_name"
assert_success
run create_test_files "$test_file"
assert_success
- run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
if ! five_seconds_later=$(get_time_seconds_in_future 5 "%z"); then
@@ -126,7 +142,7 @@ test_file="test_file"
return 1
fi
log 5 "later: $five_seconds_later"
- run put_object_retention_rest "$BUCKET_ONE_NAME" "$test_file" "GOVERNANCE" "$five_seconds_later"
+ run put_object_retention_rest "$bucket_name" "$test_file" "GOVERNANCE" "$five_seconds_later"
assert_success
}
@@ -134,27 +150,35 @@ test_file="test_file"
if [ "$RECREATE_BUCKETS" == "false" ]; then
skip "test requires object lock not to be enabled"
fi
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run check_legal_hold_without_lock_enabled "$BUCKET_ONE_NAME" "$test_file" "InvalidRequest"
+ run check_legal_hold_without_lock_enabled "$bucket_name" "$test_file" "InvalidRequest"
assert_success
}
@test "REST - legal hold, object lock enabled w/o specific object lock set" {
- run setup_bucket_object_lock_enabled "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_object_lock_enabled_v2 "$bucket_name"
assert_success
run create_test_file "$test_file"
assert_success
- run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run check_legal_hold_without_lock_enabled "$BUCKET_ONE_NAME" "$test_file" "NoSuchObjectLockConfiguration"
+ run check_legal_hold_without_lock_enabled "$bucket_name" "$test_file" "NoSuchObjectLockConfiguration"
assert_success
}
@@ -162,7 +186,11 @@ test_file="test_file"
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1001"
fi
- run setup_bucket_and_large_file "$BUCKET_ONE_NAME" "$test_file"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_and_large_file_v2 "$bucket_name" "$test_file"
assert_success
# shellcheck disable=SC2034
@@ -171,7 +199,7 @@ test_file="test_file"
run split_file "$TEST_FILE_FOLDER/$test_file" 4
assert_success
- run upload_and_check_attributes "$test_file" "$file_size"
+ run upload_and_check_attributes "$bucket_name" "$test_file" "$file_size"
assert_success
}
@@ -179,21 +207,29 @@ test_file="test_file"
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1001"
fi
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run check_attributes_invalid_param "$test_file"
+ run check_attributes_invalid_param "$bucket_name" "$test_file"
assert_success
}
@test "REST - attributes - checksum" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 add_and_check_checksum "$TEST_FILE_FOLDER/$test_file" "$test_file"
+ run add_and_check_checksum "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
}
@@ -201,26 +237,30 @@ test_file="test_file"
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/993"
fi
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
test_file_two="test_file_2"
test_file_three="test_file_3"
- run setup_bucket_and_files "$BUCKET_ONE_NAME" "$test_file" "$test_file_two" "$test_file_three"
+ run setup_bucket_and_files_v2 "$bucket_name" "$test_file" "$test_file_two" "$test_file_three"
assert_success
- run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run put_object "rest" "$TEST_FILE_FOLDER/$test_file_two" "$BUCKET_ONE_NAME" "$test_file_two"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file_two" "$bucket_name" "$test_file_two"
assert_success
- run put_object "rest" "$TEST_FILE_FOLDER/$test_file_three" "$BUCKET_ONE_NAME" "$test_file_three"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file_three" "$bucket_name" "$test_file_three"
assert_success
- run list_objects_check_params_get_token "$BUCKET_ONE_NAME" "$test_file" "$test_file_two" "TRUE"
+ run list_objects_check_params_get_token "$bucket_name" "$test_file" "$test_file_two" "TRUE"
assert_success
continuation_token=$output
# interestingly, AWS appears to accept continuation tokens that are a few characters off, so have to remove three chars
- run list_objects_check_continuation_error "$BUCKET_ONE_NAME" "${continuation_token:0:${#continuation_token}-3}"
+ run list_objects_check_continuation_error "$bucket_name" "${continuation_token:0:${#continuation_token}-3}"
assert_success
}
@@ -228,32 +268,40 @@ test_file="test_file"
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/999"
fi
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
test_file_two="test_file_2"
- run setup_bucket_and_files "$BUCKET_ONE_NAME" "$test_file" "$test_file_two"
+ run setup_bucket_and_files_v2 "$bucket_name" "$test_file" "$test_file_two"
assert_success
- run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run put_object "rest" "$TEST_FILE_FOLDER/$test_file_two" "$BUCKET_ONE_NAME" "$test_file_two"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file_two" "$bucket_name" "$test_file_two"
assert_success
- run list_objects_v1_check_nextmarker_empty "$BUCKET_ONE_NAME"
+ run list_objects_v1_check_nextmarker_empty "$bucket_name"
assert_success
}
@test "REST - head object" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run get_etag_rest "$BUCKET_ONE_NAME" "$test_file"
+ run get_etag_rest "$bucket_name" "$test_file"
assert_success
expected_etag=$output
- run get_etag_attribute_rest "$BUCKET_ONE_NAME" "$test_file" "$expected_etag"
+ run get_etag_attribute_rest "$bucket_name" "$test_file" "$expected_etag"
assert_success
}
@@ -261,51 +309,63 @@ test_file="test_file"
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1040"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run delete_objects_no_content_md5_header "$BUCKET_ONE_NAME"
+ run delete_objects_no_content_md5_header "$bucket_name"
assert_success
}
@test "REST - delete objects command" {
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
test_file_two="test_file_two"
- run setup_bucket_and_files "$BUCKET_ONE_NAME" "$test_file" "$test_file_two"
+ run setup_bucket_and_files_v2 "$bucket_name" "$test_file" "$test_file_two"
assert_success
- run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run put_object "rest" "$TEST_FILE_FOLDER/$test_file_two" "$BUCKET_ONE_NAME" "$test_file_two"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file_two" "$bucket_name" "$test_file_two"
assert_success
- run verify_object_exists "$BUCKET_ONE_NAME" "$test_file"
+ run verify_object_exists "$bucket_name" "$test_file"
assert_success
- run verify_object_exists "$BUCKET_ONE_NAME" "$test_file_two"
+ run verify_object_exists "$bucket_name" "$test_file_two"
assert_success
- run delete_objects_verify_success "$BUCKET_ONE_NAME" "$test_file" "$test_file_two"
+ run delete_objects_verify_success "$bucket_name" "$test_file" "$test_file_two"
assert_success
- run verify_object_not_found "$BUCKET_ONE_NAME" "$test_file"
+ run verify_object_not_found "$bucket_name" "$test_file"
assert_success
- run verify_object_not_found "$BUCKET_ONE_NAME" "$test_file_two"
+ run verify_object_not_found "$bucket_name" "$test_file_two"
assert_success
}
@test "REST - PutObjectRetention - w/o request body" {
- run setup_bucket_object_lock_enabled "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_object_lock_enabled_v2 "$bucket_name"
assert_success
run create_test_file "$test_file"
assert_success
- run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run retention_rest_without_request_body "$BUCKET_ONE_NAME" "$test_file"
+ run retention_rest_without_request_body "$bucket_name" "$test_file"
assert_success
}
@@ -313,55 +373,71 @@ test_file="test_file"
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1311"
fi
- run setup_bucket_object_lock_enabled "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_object_lock_enabled_v2 "$bucket_name"
assert_success
run create_test_file "$test_file"
assert_success
- run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run check_legal_hold_without_content_md5 "$BUCKET_ONE_NAME" "$test_file"
+ run check_legal_hold_without_content_md5 "$bucket_name" "$test_file"
assert_success
}
@test "REST - PutObjectLegalHold w/o payload" {
- run setup_bucket_object_lock_enabled "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_object_lock_enabled_v2 "$bucket_name"
assert_success
run create_test_file "$test_file"
assert_success
- run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run check_legal_hold_without_payload "$BUCKET_ONE_NAME" "$test_file"
+ run check_legal_hold_without_payload "$bucket_name" "$test_file"
assert_success
}
@test "REST - PutObjectLegalHold - success" {
- run setup_bucket_object_lock_enabled "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_object_lock_enabled_v2 "$bucket_name"
assert_success
run create_test_file "$test_file"
assert_success
- run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run rest_check_legal_hold "$BUCKET_ONE_NAME" "$test_file"
+ run rest_check_legal_hold "$bucket_name" "$test_file"
assert_success
}
@test "REST - copy object w/invalid copy source" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run copy_object_invalid_copy_source "$BUCKET_ONE_NAME"
+ run copy_object_invalid_copy_source "$bucket_name"
assert_success
}
@@ -369,52 +445,68 @@ test_file="test_file"
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1242"
fi
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run copy_object_copy_source_and_payload "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file"
+ run copy_object_copy_source_and_payload "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file"
assert_success
}
@test "REST - range download and compare" {
- run setup_bucket_and_large_file "$BUCKET_ONE_NAME" "$test_file"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_and_large_file_v2 "$bucket_name" "$test_file"
assert_success
- run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy" 2000000
+ run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy" 2000000
assert_success
}
@test "REST - put, get object, encoded name" {
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
file_name=" \"<>\\^\`{}|+&?%"
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$file_name"
+ run setup_bucket_and_file_v2 "$bucket_name" "$file_name"
assert_success
- run put_object_rest_special_chars "$TEST_FILE_FOLDER/$file_name" "$BUCKET_ONE_NAME" "$file_name/$file_name"
+ run put_object_rest_special_chars "$TEST_FILE_FOLDER/$file_name" "$bucket_name" "$file_name/$file_name"
assert_success
- run list_check_single_object "$BUCKET_ONE_NAME" "$file_name/$file_name"
+ run list_check_single_object "$bucket_name" "$file_name/$file_name"
assert_success
- run get_object_rest_special_chars "$BUCKET_ONE_NAME" "$file_name/$file_name" "$TEST_FILE_FOLDER/${file_name}-copy"
+ run get_object_rest_special_chars "$bucket_name" "$file_name/$file_name" "$TEST_FILE_FOLDER/${file_name}-copy"
assert_success
run compare_files "$TEST_FILE_FOLDER/$file_name" "$TEST_FILE_FOLDER/${file_name}-copy"
assert_success
- run delete_object_rest "$BUCKET_ONE_NAME" "$file_name/$file_name"
+ run delete_object_rest "$bucket_name" "$file_name/$file_name"
assert_success
}
@test "REST - GetObject w/STREAMING-AWS4-HMAC-SHA256-PAYLOAD type" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 get_object_rest_with_invalid_streaming_type "$BUCKET_ONE_NAME" "$test_file"
+ run get_object_rest_with_invalid_streaming_type "$bucket_name" "$test_file"
assert_success
}
diff --git a/tests/test_rest_acl.sh b/tests/test_rest_acl.sh
index 4753a4a..511768b 100755
--- a/tests/test_rest_acl.sh
+++ b/tests/test_rest_acl.sh
@@ -18,13 +18,13 @@ load ./bats-support/load
load ./bats-assert/load
source ./tests/commands/put_object.sh
+source ./tests/drivers/file.sh
source ./tests/drivers/create_bucket/create_bucket_rest.sh
source ./tests/drivers/get_bucket_acl/get_bucket_acl_rest.sh
source ./tests/logger.sh
source ./tests/setup.sh
source ./tests/util/util_object.sh
source ./tests/util/util_public_access_block.sh
-source ./tests/util/util_setup.sh
export RUN_USERS=true
@@ -34,22 +34,30 @@ if [ "$SKIP_ACL_TESTING" == "true" ] || [ "$SKIP_USERS_TESTS" == "true" ]; then
fi
@test "REST - get ACL" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run get_and_check_acl_rest "$BUCKET_ONE_NAME"
+ run get_and_check_acl_rest "$bucket_name"
assert_success
}
@test "REST - put ACL" {
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
test_file="test_file"
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ run setup_bucket_and_file_v2 "$bucket_name" "$test_file"
assert_success
- run put_bucket_ownership_controls "$BUCKET_ONE_NAME" "BucketOwnerPreferred"
+ run put_bucket_ownership_controls "$bucket_name" "BucketOwnerPreferred"
assert_success
- run put_object "s3api" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "s3api" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
run create_versitygw_acl_user_or_get_direct_user "$USERNAME_ONE" "$PASSWORD_ONE"
@@ -62,29 +70,33 @@ fi
run setup_acl "$TEST_FILE_FOLDER/acl-file.txt" "CanonicalUser" "$user_canonical_id" "READ" "$canonical_id"
assert_success
- run list_objects_with_user_rest_verify_access_denied "$BUCKET_ONE_NAME" "$username" "$password"
+ run list_objects_with_user_rest_verify_access_denied "$bucket_name" "$username" "$password"
assert_success
- run put_bucket_acl_rest "$BUCKET_ONE_NAME" "$TEST_FILE_FOLDER/acl-file.txt"
+ run put_bucket_acl_rest "$bucket_name" "$TEST_FILE_FOLDER/acl-file.txt"
assert_success
if [ "$DIRECT" == "true" ]; then
sleep 5
fi
- run list_objects_with_user_rest_verify_success "$BUCKET_ONE_NAME" "$username" "$password" "$test_file"
+ run list_objects_with_user_rest_verify_success "$bucket_name" "$username" "$password" "$test_file"
assert_success
}
@test "REST - put public-read canned acl" {
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
test_file="test_file"
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ run setup_bucket_and_file_v2 "$bucket_name" "$test_file"
assert_success
- run put_bucket_ownership_controls "$BUCKET_ONE_NAME" "BucketOwnerPreferred"
+ run put_bucket_ownership_controls "$bucket_name" "BucketOwnerPreferred"
assert_success
- run put_object "s3api" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "s3api" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
run create_versitygw_acl_user_or_get_direct_user "$USERNAME_ONE" "$PASSWORD_ONE"
@@ -94,25 +106,29 @@ fi
username=${lines[2]}
password=${lines[3]}
- run list_objects_with_user_rest_verify_access_denied "$BUCKET_ONE_NAME" "$username" "$password"
+ run list_objects_with_user_rest_verify_access_denied "$bucket_name" "$username" "$password"
assert_success
if [ "$DIRECT" == "true" ]; then
- run allow_public_access "$BUCKET_ONE_NAME"
+ run allow_public_access "$bucket_name"
assert_success
fi
- run put_canned_acl_rest "$BUCKET_ONE_NAME" "public-read"
+ run put_canned_acl_rest "$bucket_name" "public-read"
assert_success
- run list_objects_with_user_rest_verify_success "$BUCKET_ONE_NAME" "$username" "$password" "$test_file"
+ run list_objects_with_user_rest_verify_success "$bucket_name" "$username" "$password" "$test_file"
assert_success
}
@test "REST - put invalid ACL" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run put_bucket_ownership_controls "$BUCKET_ONE_NAME" "BucketOwnerPreferred"
+ run put_bucket_ownership_controls "$bucket_name" "BucketOwnerPreferred"
assert_success
run create_versitygw_acl_user_or_get_direct_user "$USERNAME_ONE" "$PASSWORD_ONE"
@@ -126,19 +142,23 @@ fi
assert_success
if [ "$DIRECT" == "true" ]; then
- run allow_public_access "$BUCKET_ONE_NAME"
+ run allow_public_access "$bucket_name"
assert_success
fi
- run put_invalid_acl_rest_verify_failure "$BUCKET_ONE_NAME" "$TEST_FILE_FOLDER/acl-file.txt"
+ run put_invalid_acl_rest_verify_failure "$bucket_name" "$TEST_FILE_FOLDER/acl-file.txt"
assert_success
}
@test "REST - put public-read-write canned acl" {
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
test_file="test_file"
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ run setup_bucket_and_file_v2 "$bucket_name" "$test_file"
assert_success
- run put_bucket_ownership_controls "$BUCKET_ONE_NAME" "BucketOwnerPreferred"
+ run put_bucket_ownership_controls "$bucket_name" "BucketOwnerPreferred"
assert_success
run create_versitygw_acl_user_or_get_direct_user "$USERNAME_ONE" "$PASSWORD_ONE"
@@ -148,17 +168,17 @@ fi
username=${lines[2]}
password=${lines[3]}
- run put_object_with_user "s3api" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$username" "$password"
+ run put_object_with_user "s3api" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$username" "$password"
assert_failure
if [ "$DIRECT" == "true" ]; then
- run allow_public_access "$BUCKET_ONE_NAME"
+ run allow_public_access "$bucket_name"
assert_success
fi
- run put_canned_acl_rest "$BUCKET_ONE_NAME" "public-read-write"
+ run put_canned_acl_rest "$bucket_name" "public-read-write"
assert_success
- run put_object_with_user "s3api" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$username" "$password"
+ run put_object_with_user "s3api" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$username" "$password"
assert_success
}
@@ -166,14 +186,18 @@ fi
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"
+
test_file="test_file"
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ run setup_bucket_and_file_v2 "$bucket_name" "$test_file"
assert_success
- run put_bucket_ownership_controls "$BUCKET_ONE_NAME" "BucketOwnerPreferred"
+ run put_bucket_ownership_controls "$bucket_name" "BucketOwnerPreferred"
assert_success
- run put_bucket_acl_rest_canned_invalid "$BUCKET_ONE_NAME" "privatee"
+ run put_bucket_acl_rest_canned_invalid "$bucket_name" "privatee"
assert_success
}
@@ -181,6 +205,10 @@ fi
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1407"
fi
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
run create_versitygw_acl_user_or_get_direct_user "$USERNAME_ONE" "$PASSWORD_ONE"
assert_success
canonical_id=${lines[0]}
@@ -188,7 +216,7 @@ fi
username=${lines[2]}
password=${lines[3]}
- run bucket_cleanup_if_bucket_exists "$BUCKET_ONE_NAME"
+ run bucket_cleanup_if_bucket_exists "$bucket_name"
assert_success
if [ "$DIRECT" == "true" ]; then
id="id=$user_canonical_id"
@@ -197,9 +225,9 @@ fi
fi
envs="GRANT_READ_ACP=$id OBJECT_OWNERSHIP=BucketOwnerPreferred"
- run create_bucket_rest_expect_success "$BUCKET_ONE_NAME" "$envs"
+ run create_bucket_rest_expect_success "$bucket_name" "$envs"
assert_success
- run get_bucket_acl_rest "$BUCKET_ONE_NAME" "" "check_that_acl_xml_does_not_have_owner_permission"
+ run get_bucket_acl_rest "$bucket_name" "" "check_that_acl_xml_does_not_have_owner_permission"
assert_success
}
diff --git a/tests/test_rest_bucket.sh b/tests/test_rest_bucket.sh
index 3957f99..858394d 100755
--- a/tests/test_rest_bucket.sh
+++ b/tests/test_rest_bucket.sh
@@ -49,15 +49,19 @@ export RUN_USERS=true
}
@test "REST - HeadBucket - doesn't exist" {
- run head_bucket_rest "$BUCKET_ONE_NAME"
+ run head_bucket_rest "$BUCKET_ONE_NAME-$(uuidgen)"
assert_failure 1
}
@test "REST - bucket tagging - no tags" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run verify_no_bucket_tags_rest "$BUCKET_ONE_NAME"
+ run verify_no_bucket_tags_rest "$bucket_name"
assert_success
}
@@ -65,44 +69,57 @@ export RUN_USERS=true
test_key="testKey"
test_value="testValue"
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run add_verify_bucket_tags_rest "$BUCKET_ONE_NAME" "$test_key" "$test_value"
+ run add_verify_bucket_tags_rest "$bucket_name" "$test_key" "$test_value"
assert_success
}
@test "REST - get, put bucket ownership controls" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run get_and_check_ownership_controls "$BUCKET_ONE_NAME" "BucketOwnerEnforced"
+ run get_and_check_ownership_controls "$bucket_name" "BucketOwnerEnforced"
assert_success
- run put_bucket_ownership_controls_rest "$BUCKET_ONE_NAME" "BucketOwnerPreferred"
+ run put_bucket_ownership_controls_rest "$bucket_name" "BucketOwnerPreferred"
assert_success
- run get_and_check_ownership_controls "$BUCKET_ONE_NAME" "BucketOwnerPreferred"
+ run get_and_check_ownership_controls "$bucket_name" "BucketOwnerPreferred"
assert_success
}
@test "test_rest_set_get_lock_config" {
- run setup_bucket "$BUCKET_ONE_NAME"
- assert_success
-
- run check_no_object_lock_config_rest "$BUCKET_ONE_NAME"
- assert_success
-
- run bucket_cleanup_if_bucket_exists "$BUCKET_ONE_NAME"
- assert_success
-
- # in static bucket config, bucket will still exist
- if ! bucket_exists "$BUCKET_ONE_NAME"; then
- run create_bucket_object_lock_enabled "$BUCKET_ONE_NAME"
- assert_success
+ if [ "$RECREATE_BUCKETS" == "false" ]; then
+ skip "test not valid for static buckets"
fi
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
- run check_object_lock_config_enabled_rest "$BUCKET_ONE_NAME"
+ run setup_bucket_v2 "$bucket_name"
+ assert_success
+
+ run check_no_object_lock_config_rest "$bucket_name"
+ assert_success
+
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_two_name="$output"
+
+ run setup_bucket_object_lock_enabled_v2 "$bucket_two_name"
+ assert_success
+
+ run check_object_lock_config_enabled_rest "$bucket_two_name"
assert_success
}
@@ -110,14 +127,18 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1300"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run put_bucket_versioning_rest "$BUCKET_ONE_NAME" "Enabled"
+ run put_bucket_versioning_rest "$bucket_name" "Enabled"
assert_success
# this enables object lock without a specific retention policy
- run remove_retention_policy_rest "$BUCKET_ONE_NAME"
+ run remove_retention_policy_rest "$bucket_name"
assert_success
}
@@ -125,21 +146,15 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1301"
fi
- run bucket_cleanup_if_bucket_exists "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_object_lock_enabled_v2 "$bucket_name"
assert_success
- # in static bucket config, bucket will still exist
- if ! bucket_exists "$BUCKET_ONE_NAME"; then
- run create_bucket_object_lock_enabled "$BUCKET_ONE_NAME"
- assert_success
- fi
-
- if [ "$DIRECT" == "true" ]; then
- sleep 5
- fi
-
# this enables object lock without a specific retention policy
- run put_object_lock_config_without_content_md5 "$BUCKET_ONE_NAME"
+ run put_object_lock_config_without_content_md5 "$bucket_name"
assert_success
}
@@ -147,11 +162,14 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/959"
fi
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
- run setup_bucket "$BUCKET_ONE_NAME"
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run get_and_check_no_policy_error "$BUCKET_ONE_NAME"
+ run get_and_check_no_policy_error "$bucket_name"
assert_success
}
@@ -159,20 +177,24 @@ export RUN_USERS=true
if [ "$SKIP_USERS_TESTS" == "true" ]; then
skip
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run setup_user_versitygw_or_direct "$USERNAME_ONE" "$PASSWORD_ONE" "user" "$BUCKET_ONE_NAME"
+ run setup_user_versitygw_or_direct "$USERNAME_ONE" "$PASSWORD_ONE" "user" "$bucket_name"
assert_success
log 5 "username: ${lines[1]}"
log 5 "password: ${lines[2]}"
sleep 5
- run setup_policy_with_single_statement "$TEST_FILE_FOLDER/policy_file.txt" "2012-10-17" "Allow" "$USERNAME_ONE" "s3:PutBucketTagging" "arn:aws:s3:::$BUCKET_ONE_NAME"
+ run setup_policy_with_single_statement "$TEST_FILE_FOLDER/policy_file.txt" "2012-10-17" "Allow" "$USERNAME_ONE" "s3:PutBucketTagging" "arn:aws:s3:::$bucket_name"
assert_success
- run put_and_check_policy_rest "$BUCKET_ONE_NAME" "$TEST_FILE_FOLDER/policy_file.txt" "Allow" "$USERNAME_ONE" "s3:PutBucketTagging" "arn:aws:s3:::$BUCKET_ONE_NAME"
+ run put_and_check_policy_rest "$bucket_name" "$TEST_FILE_FOLDER/policy_file.txt" "Allow" "$USERNAME_ONE" "s3:PutBucketTagging" "arn:aws:s3:::$bucket_name"
assert_success
}
@@ -188,18 +210,26 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1521"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run send_rest_go_command_expect_error "400" "InvalidRequest" "Missing required header" "-bucketName" "$BUCKET_ONE_NAME" "-query" "tagging=" "-method" "PUT"
+ run send_rest_go_command_expect_error "400" "InvalidRequest" "Missing required header" "-bucketName" "$bucket_name" "-query" "tagging=" "-method" "PUT"
assert_success
}
@test "REST - PutBucketTagging - invalid Content-MD5" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run send_rest_go_command_expect_error "400" "InvalidDigest" "you specified" "-bucketName" "$BUCKET_ONE_NAME" "-query" "tagging=" "-method" "PUT" "-signedParams" "Content-MD5:dummy" \
+ run send_rest_go_command_expect_error "400" "InvalidDigest" "you specified" "-bucketName" "$bucket_name" "-query" "tagging=" "-method" "PUT" "-signedParams" "Content-MD5:dummy" \
"-payload" "keyvalue"
assert_success
}
@@ -208,10 +238,14 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1526"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket "$bucket_name"
assert_success
- run send_put_bucket_tagging_command_check_invalid_content_md5 "$BUCKET_ONE_NAME"
+ run send_put_bucket_tagging_command_check_invalid_content_md5 "$bucket_name"
assert_success
}
@@ -219,10 +253,14 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1525"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket "$bucket_name"
assert_success
- run send_rest_go_command_expect_error "400" "BadDigest" "did not match" "-bucketName" "$BUCKET_ONE_NAME" "-query" "tagging=" "-method" "PUT" "-incorrectContentMD5" \
+ run send_rest_go_command_expect_error "400" "BadDigest" "did not match" "-bucketName" "$bucket_name" "-query" "tagging=" "-method" "PUT" "-incorrectContentMD5" \
"-payload" "keyvalue"
assert_success
}
diff --git a/tests/test_rest_checksum.sh b/tests/test_rest_checksum.sh
index 6691f83..ca4a868 100755
--- a/tests/test_rest_checksum.sh
+++ b/tests/test_rest_checksum.sh
@@ -17,17 +17,22 @@
load ./bats-support/load
load ./bats-assert/load
+source ./tests/drivers/file.sh
+source ./tests/drivers/create_bucket/create_bucket_rest.sh
source ./tests/setup.sh
-source ./tests/util/util_setup.sh
export RUN_USERS=true
test_file="test_file"
@test "REST - invalid checksum type" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 check_invalid_checksum_type "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run check_invalid_checksum_type "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
}
@@ -47,13 +52,17 @@ test_file="test_file"
}
@test "REST - HeadObject returns x-amz-checksum-sha256" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object_rest_checksum "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "sha256"
+ run put_object_rest_checksum "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "sha256"
assert_success
- run check_checksum_rest_sha256 "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file"
+ run check_checksum_rest_sha256 "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file"
assert_success
}
@@ -73,13 +82,17 @@ test_file="test_file"
}
@test "REST - crc32 checksum - HeadObject" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object_rest_checksum "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "crc32"
+ run put_object_rest_checksum "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "crc32"
assert_success
- run check_checksum_rest_crc32 "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file"
+ run check_checksum_rest_crc32 "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file"
assert_success
}
@@ -129,23 +142,31 @@ test_file="test_file"
}
@test "REST - attempt to get checksum without checksum mode" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 add_correct_checksum "sha256"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run head_object_without_and_with_checksum "$BUCKET_ONE_NAME" "$test_file"
+ run head_object_without_and_with_checksum "$bucket_name" "$test_file"
assert_success
}
@test "REST - HeadObject - default crc64nvme checksum" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run check_default_checksum "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file"
+ run check_default_checksum "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file"
assert_success
}
diff --git a/tests/test_rest_chunked.sh b/tests/test_rest_chunked.sh
index 0c1f6bf..5fba1b0 100755
--- a/tests/test_rest_chunked.sh
+++ b/tests/test_rest_chunked.sh
@@ -19,101 +19,130 @@ load ./bats-assert/load
source ./tests/logger.sh
source ./tests/setup.sh
+source ./tests/drivers/file.sh
+source ./tests/drivers/create_bucket/create_bucket_rest.sh
source ./tests/util/util_bucket.sh
source ./tests/util/util_chunked_upload.sh
source ./tests/util/util_file.sh
-source ./tests/util/util_setup.sh
@test "REST - chunked upload, no content length" {
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
test_file="test-file"
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ run setup_bucket_and_file_v2 "$bucket_name" "$test_file"
assert_success
- run attempt_seed_signature_without_content_length "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run attempt_seed_signature_without_content_length "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
}
@test "REST - chunked upload, signature error" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
test_file="test-file"
run create_test_file "$test_file" 8192
assert_success
- run attempt_chunked_upload_with_bad_first_signature "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run attempt_chunked_upload_with_bad_first_signature "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
}
@test "REST - chunked upload, final signature error" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
test_file="test-file"
run create_test_file "$test_file" 0
assert_success
- run attempt_chunked_upload_with_bad_final_signature "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run attempt_chunked_upload_with_bad_final_signature "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
}
@test "REST - chunked upload, success (file with just a's)" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
test_file="test-file"
run create_file_single_char "$test_file" 8192 'a'
assert_success
- run chunked_upload_success "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run chunked_upload_success "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
+ run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
assert_success
}
@test "REST - chunked upload, success (null bytes)" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
test_file="test-file"
run create_file_single_char "$test_file" 8192 '\0'
assert_success
- run chunked_upload_success "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run chunked_upload_success "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
+ run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
assert_success
}
@test "REST - chunked upload, success (random bytes)" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
test_file="test-file"
run create_test_file "$test_file" 10000
assert_success
- run chunked_upload_success "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run chunked_upload_success "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
+ run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
assert_success
}
@test "REST - chunked upload, success (zero-byte file)" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
test_file="test-file"
run create_test_file "$test_file" 0
assert_success
- run chunked_upload_success "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run chunked_upload_success "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
+ run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
assert_success
}
@@ -143,11 +172,15 @@ source ./tests/util/util_setup.sh
}
@test "test - REST chunked upload - invalid trailer" {
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
test_file="test-file"
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ run setup_bucket_and_file "$bucket_name" "$test_file"
assert_success
- run put_chunked_upload_trailer_invalid "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_chunked_upload_trailer_invalid "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
}
@@ -202,16 +235,20 @@ source ./tests/util/util_setup.sh
}
@test "REST chunked upload - smaller chunk size" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket "$bucket_name"
assert_success
test_file="test-file"
run create_test_file "$test_file" 200000
assert_success
- run chunked_upload_trailer_different_chunk_size "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "sha256"
+ run chunked_upload_trailer_different_chunk_size "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "sha256"
assert_success
- run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
+ run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
assert_success
}
diff --git a/tests/test_rest_create_bucket.sh b/tests/test_rest_create_bucket.sh
index 70bed40..42da752 100755
--- a/tests/test_rest_create_bucket.sh
+++ b/tests/test_rest_create_bucket.sh
@@ -28,13 +28,14 @@ export RUN_USERS=true
if [ "$RECREATE_BUCKETS" == "false" ]; then
skip "skip bucket create tests for static buckets"
fi
- run bucket_cleanup_if_bucket_exists "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run create_bucket_rest "$BUCKET_ONE_NAME"
- assert_success
-
- run list_check_buckets_rest "$BUCKET_ONE_NAME"
+ run list_check_buckets_rest "$bucket_name"
assert_success
}
@@ -45,11 +46,15 @@ export RUN_USERS=true
if [ "$RECREATE_BUCKETS" == "false" ]; then
skip "skip bucket create tests for static buckets"
fi
- run bucket_cleanup_if_bucket_exists "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run bucket_cleanup_if_bucket_exists_v2 "$BUCKET_ONE_NAME"
assert_success
envs="ACL=public-reads OBJECT_OWNERSHIP=BucketOwnerPreferred"
- run create_bucket_rest_expect_error "$BUCKET_ONE_NAME" "$envs" "400" "InvalidArgument" ""
+ run create_bucket_rest_expect_error "$bucket_name" "$envs" "400" "InvalidArgument" ""
assert_success
}
@@ -77,7 +82,7 @@ export RUN_USERS=true
if [ "$RECREATE_BUCKETS" == "false" ]; then
skip "skip bucket create tests for static buckets"
fi
- run bucket_cleanup_if_bucket_exists "$BUCKET_ONE_NAME"
+ run bucket_cleanup_if_bucket_exists_v2 "$BUCKET_ONE_NAME"
assert_success
if [ "$DIRECT" == "true" ]; then
@@ -86,7 +91,12 @@ export RUN_USERS=true
id="$AWS_ACCESS_KEY_ID"
fi
envs="GRANT_FULL_CONTROL=$id"
- run create_bucket_rest_expect_error "$BUCKET_ONE_NAME" "$envs" "400" "InvalidBucketAclWithObjectOwnership" "Bucket cannot have ACLs set"
+
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run create_bucket_rest_expect_error "$bucket_name" "$envs" "400" "InvalidBucketAclWithObjectOwnership" "Bucket cannot have ACLs set"
assert_success
}
diff --git a/tests/test_rest_delete_bucket.sh b/tests/test_rest_delete_bucket.sh
index c5c072f..ceadab3 100755
--- a/tests/test_rest_delete_bucket.sh
+++ b/tests/test_rest_delete_bucket.sh
@@ -18,54 +18,67 @@ load ./bats-support/load
load ./bats-assert/load
source ./tests/setup.sh
+source ./tests/drivers/create_bucket/create_bucket_rest.sh
source ./tests/drivers/delete_object/delete_object_rest.sh
source ./tests/drivers/put_object/put_object_rest.sh
@test "REST - DeleteBucket - can delete with partial multipart upload" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run create_multipart_upload_rest "$BUCKET_ONE_NAME" "test_file" ""
+ run create_multipart_upload_rest "$bucket_name" "test_file" "" ""
assert_success
- run delete_bucket_rest "$BUCKET_ONE_NAME"
+ run delete_bucket_rest "$bucket_name"
assert_success
}
@test "REST - DeleteBucket - file - non-versioning" {
- run setup_bucket_and_add_file "$BUCKET_ONE_NAME" "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 delete_bucket_rest_expect_error "$BUCKET_ONE_NAME" "" "409" "BucketNotEmpty" "is not empty"
+ run delete_bucket_rest_expect_error "$bucket_name" "" "409" "BucketNotEmpty" "is not empty"
assert_success
- run delete_object_rest "$BUCKET_ONE_NAME" "test_file"
+ run delete_object_rest "$bucket_name" "test_file"
assert_success
- run delete_bucket_rest "$BUCKET_ONE_NAME"
+ run delete_bucket_rest "$bucket_name"
assert_success
}
@test "REST - DeleteBucket - file - versioning" {
- run setup_bucket_and_add_file "$BUCKET_ONE_NAME" "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_ONE_NAME" "Enabled"
+ run put_bucket_versioning_rest "$bucket_name" "Enabled"
assert_success
- run delete_bucket_rest_expect_error "$BUCKET_ONE_NAME" "" "409" "BucketNotEmpty" "is not empty"
+ run delete_bucket_rest_expect_error "$bucket_name" "" "409" "BucketNotEmpty" "is not empty"
assert_success
- run delete_object_rest "$BUCKET_ONE_NAME" "test_file"
+ run delete_object_rest "$bucket_name" "test_file"
assert_success
- run delete_bucket_rest_expect_error "$BUCKET_ONE_NAME" "" "409" "BucketNotEmpty" "is not empty"
+ run delete_bucket_rest_expect_error "$bucket_name" "" "409" "BucketNotEmpty" "is not empty"
assert_success
- run delete_old_versions "$BUCKET_ONE_NAME"
+ run delete_old_versions_base64 "$bucket_name"
assert_success
- run delete_bucket_rest "$BUCKET_ONE_NAME"
+ run delete_bucket_rest "$bucket_name"
assert_success
}
@@ -73,10 +86,14 @@ source ./tests/drivers/put_object/put_object_rest.sh
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1428"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket "$bucket_name"
assert_success
- run send_rest_go_command_expect_error "400" "InvalidBucketOwnerAWSAccountID" "value of the expected bucket owner" "-method" "DELETE" "-bucketName" "$BUCKET_ONE_NAME" "-signedParams" "x-amz-expected-bucket-owner:01234567890"
+ run send_rest_go_command_expect_error "400" "InvalidBucketOwnerAWSAccountID" "value of the expected bucket owner" "-method" "DELETE" "-bucketName" "$bucket_name" "-signedParams" "x-amz-expected-bucket-owner:01234567890"
assert_success
}
@@ -84,17 +101,25 @@ source ./tests/drivers/put_object/put_object_rest.sh
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1428"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket "$bucket_name"
assert_success
- run send_rest_go_command_expect_error "403" "AccessDenied" "Access Denied" "-method" "DELETE" "-bucketName" "$BUCKET_ONE_NAME" "-signedParams" "x-amz-expected-bucket-owner:012345678901"
+ run send_rest_go_command_expect_error "403" "AccessDenied" "Access Denied" "-method" "DELETE" "-bucketName" "$bucket_name" "-signedParams" "x-amz-expected-bucket-owner:012345678901"
assert_success
}
@test "REST - DeleteBucket - correct x-amz-expected-bucket-owner" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket "$bucket_name"
assert_success
- run send_rest_go_command "204" "-method" "DELETE" "-bucketName" "$BUCKET_ONE_NAME" "-signedParams" "x-amz-expected-bucket-owner:$AWS_USER_ID"
+ run send_rest_go_command "204" "-method" "DELETE" "-bucketName" "$bucket_name" "-signedParams" "x-amz-expected-bucket-owner:$AWS_USER_ID"
assert_success
}
diff --git a/tests/test_rest_delete_bucket_ownership_controls.sh b/tests/test_rest_delete_bucket_ownership_controls.sh
index 2b6f19a..c6b1381 100755
--- a/tests/test_rest_delete_bucket_ownership_controls.sh
+++ b/tests/test_rest_delete_bucket_ownership_controls.sh
@@ -17,6 +17,7 @@
load ./bats-support/load
load ./bats-assert/load
+source ./tests/drivers/create_bucket/create_bucket_rest.sh
source ./tests/drivers/get_bucket_ownership_controls/get_bucket_ownership_controls_rest.sh
source ./tests/drivers/user.sh
source ./tests/setup.sh
@@ -27,7 +28,11 @@ export RUN_USERS=true
if [ "$SKIP_USERS_TESTS" == "true" ]; then
skip
fi
- run setup_bucket_and_user_v2 "$BUCKET_ONE_NAME" "$USERNAME_ONE" "$PASSWORD_ONE"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_and_acl_user "$bucket_name" "$USERNAME_ONE" "$PASSWORD_ONE"
assert_success
username=${lines[${#lines[@]}-2]}
password=${lines[${#lines[@]}-1]}
@@ -35,7 +40,7 @@ export RUN_USERS=true
log 5 "username: $username, password: $password"
run send_rest_go_command_expect_error "403" "AccessDenied" "Access Denied" "-awsAccessKeyId" "$username" "-awsSecretAccessKey" "$password" \
- "-method" "DELETE" "-bucketName" "$BUCKET_ONE_NAME" "-query" "ownershipControls="
+ "-method" "DELETE" "-bucketName" "$bucket_name" "-query" "ownershipControls="
assert_success
}
@@ -43,33 +48,41 @@ export RUN_USERS=true
if [ "$SKIP_USERS_TESTS" == "true" ]; then
skip
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
username="invalid with spaces"
password="dummy"
run send_rest_go_command_expect_error "403" "InvalidAccessKeyId" "does not exist in our records" "-awsAccessKeyId" "$username" "-awsSecretAccessKey" "$password" \
- "-method" "DELETE" "-bucketName" "$BUCKET_ONE_NAME" "-query" "ownershipControls="
+ "-method" "DELETE" "-bucketName" "$bucket_name" "-query" "ownershipControls="
assert_success
}
@test "REST - DeleteBucketOwnershipControls - success" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run put_bucket_ownership_controls_rest "$BUCKET_ONE_NAME" "BucketOwnerPreferred"
+ run put_bucket_ownership_controls_rest "$bucket_name" "BucketOwnerPreferred"
assert_success
- run get_bucket_ownership_controls_rest "$BUCKET_ONE_NAME"
+ run get_bucket_ownership_controls_rest "$bucket_name"
assert_success
rule=${output[${#output[@]}-1]}
assert_equal "$rule" "BucketOwnerPreferred"
- run send_rest_go_command "204" "-method" "DELETE" "-bucketName" "$BUCKET_ONE_NAME" "-query" "ownershipControls="
+ run send_rest_go_command "204" "-method" "DELETE" "-bucketName" "$bucket_name" "-query" "ownershipControls="
assert_success
- run get_bucket_ownership_controls_rest "$BUCKET_ONE_NAME"
+ run get_bucket_ownership_controls_rest "$bucket_name"
assert_success
rule=${output[${#output[@]}-1]}
assert_equal "$rule" ""
@@ -79,15 +92,19 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1493"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket "$bucket_name"
assert_success
if ! send_rest_go_command "204" \
- "-method" "DELETE" "-bucketName" "$BUCKET_ONE_NAME" "-query" "ownershipControls="; then
+ "-method" "DELETE" "-bucketName" "$bucket_name" "-query" "ownershipControls="; then
log 2 "error deleting ownership controls"
return 1
fi
- run get_bucket_ownership_controls_check_error_after_deletion "$BUCKET_ONE_NAME"
+ run get_bucket_ownership_controls_check_error_after_deletion "$bucket_name"
assert_success
}
diff --git a/tests/test_rest_delete_bucket_tagging.sh b/tests/test_rest_delete_bucket_tagging.sh
index 5d14386..77f5a01 100755
--- a/tests/test_rest_delete_bucket_tagging.sh
+++ b/tests/test_rest_delete_bucket_tagging.sh
@@ -17,9 +17,9 @@
load ./bats-support/load
load ./bats-assert/load
-source ./tests/drivers/user.sh
source ./tests/setup.sh
source ./tests/drivers/user.sh
+source ./tests/drivers/create_bucket/create_bucket_rest.sh
export RUN_USERS=true
@@ -27,12 +27,16 @@ export RUN_USERS=true
if [ "$SKIP_USERS_TESTS" == "true" ]; then
skip
fi
- run setup_bucket_and_user_v2 "$BUCKET_ONE_NAME" "$USERNAME_ONE" "$PASSWORD_ONE"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_and_acl_user "$bucket_name" "$USERNAME_ONE" "$PASSWORD_ONE"
assert_success
username=${lines[${#lines[@]}-2]}
password=${lines[${#lines[@]}-1]}
run send_rest_go_command_expect_error "403" "AccessDenied" "Access Denied" "-awsAccessKeyId" "$username" "-awsSecretAccessKey" "$password" \
- "-method" "DELETE" "-bucketName" "$BUCKET_ONE_NAME" "-query" "tagging="
+ "-method" "DELETE" "-bucketName" "$bucket_name" "-query" "tagging="
assert_success
}
diff --git a/tests/test_rest_head_bucket.sh b/tests/test_rest_head_bucket.sh
index 4dc56ae..5a29689 100755
--- a/tests/test_rest_head_bucket.sh
+++ b/tests/test_rest_head_bucket.sh
@@ -18,33 +18,47 @@ load ./bats-support/load
load ./bats-assert/load
source ./tests/setup.sh
+source ./tests/drivers/create_bucket/create_bucket_rest.sh
@test "REST - HeadBucket - mismatched owner" {
if [ "$DIRECT" != "true" ]; then
- skip "https://github.com/versity/versitygw/issues/1428"
- fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ skip "https://github.com/versity/versitygw/issues/1428"
+ fi
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket "$bucket_name"
assert_success
- run head_bucket_rest_expect_error "$BUCKET_ONE_NAME" "EXPECTED_OWNER=012345678901" "403" "Forbidden"
+ run head_bucket_rest_expect_error "$bucket_name" "EXPECTED_OWNER=012345678901" "403" "Forbidden"
assert_success
}
@test "REST - HeadBucket - invalid owner" {
if [ "$DIRECT" != "true" ]; then
- skip "https://github.com/versity/versitygw/issues/1428"
- fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ skip "https://github.com/versity/versitygw/issues/1428"
+ fi
+
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket "$bucket_name"
assert_success
- run head_bucket_rest_expect_error "$BUCKET_ONE_NAME" "EXPECTED_OWNER=01234567890" "400" "Bad Request"
+ run head_bucket_rest_expect_error "$bucket_name" "EXPECTED_OWNER=01234567890" "400" "Bad Request"
assert_success
}
@test "REST - HeadBucket - expected owner success" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket "$bucket_name"
assert_success
- run head_bucket_rest_expect_success "$BUCKET_ONE_NAME" "EXPECTED_OWNER=$AWS_USER_ID"
+ run head_bucket_rest_expect_success "$bucket_name" "EXPECTED_OWNER=$AWS_USER_ID"
assert_success
}
diff --git a/tests/test_rest_list_buckets.sh b/tests/test_rest_list_buckets.sh
index b401e2f..aba5738 100755
--- a/tests/test_rest_list_buckets.sh
+++ b/tests/test_rest_list_buckets.sh
@@ -18,9 +18,9 @@ load ./bats-support/load
load ./bats-assert/load
source ./tests/commands/list_buckets.sh
+source ./tests/drivers/create_bucket/create_bucket_rest.sh
source ./tests/drivers/list_buckets/list_buckets_rest.sh
source ./tests/drivers/user.sh
-source ./tests/util/util_setup.sh
source ./tests/logger.sh
source ./tests/setup.sh
@@ -31,7 +31,11 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1249"
fi
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_and_file_v2 "$bucket_name" "$test_file"
assert_success
echo -en "\r\n" > "$TEST_FILE_FOLDER/empty.txt"
@@ -117,10 +121,14 @@ export RUN_USERS=true
}
@test "test_rest_list_buckets" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket "$bucket_name"
assert_success
- run list_check_buckets_rest "$BUCKET_ONE_NAME"
+ run list_check_buckets_rest "$bucket_name"
assert_success
}
@@ -128,7 +136,15 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1399"
fi
- run setup_buckets "$BUCKET_ONE_NAME" "$BUCKET_TWO_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run get_bucket_name "$BUCKET_TWO_NAME"
+ assert_success
+ bucket_two_name="$output"
+
+ run setup_buckets_v2 "$bucket_name" "$bucket_two_name"
assert_success
run check_continuation_token
@@ -136,24 +152,40 @@ export RUN_USERS=true
}
@test "REST - list buckets - success (multiple pages)" {
- run setup_buckets "$BUCKET_ONE_NAME" "$BUCKET_TWO_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run get_bucket_name "$BUCKET_TWO_NAME"
+ assert_success
+ bucket_two_name="$output"
+
+ run setup_buckets_v2 "$bucket_name" "$bucket_two_name"
assert_success
- run check_for_buckets_with_multiple_pages "$BUCKET_ONE_NAME" "$BUCKET_TWO_NAME"
+ run check_for_buckets_with_multiple_pages "$bucket_name" "$bucket_two_name"
assert_success
}
@test "REST - list buckets w/prefix" {
- run setup_buckets "$BUCKET_ONE_NAME" "$BUCKET_TWO_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run get_bucket_name "$BUCKET_TWO_NAME"
+ assert_success
+ bucket_two_name="$output"
+
+ run setup_buckets_v2 "$bucket_name" "$bucket_two_name"
assert_success
- run list_check_buckets_rest "$BUCKET_ONE_NAME" "$BUCKET_TWO_NAME"
+ run list_check_buckets_rest "$bucket_name" "$bucket_two_name"
assert_success
- run list_check_buckets_rest_with_prefix "$BUCKET_ONE_NAME"
+ run list_check_buckets_rest_with_prefix "$bucket_name"
assert_success
- run list_check_buckets_rest_with_prefix "$BUCKET_TWO_NAME"
+ run list_check_buckets_rest_with_prefix "$bucket_two_name"
assert_success
}
@@ -164,18 +196,26 @@ export RUN_USERS=true
if [ "$DIRECT" == "true" ]; then
skip
fi
- run setup_bucket_and_user "$BUCKET_ONE_NAME" "$USERNAME_ONE" "$PASSWORD_ONE" "user"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_and_user "$bucket_name" "$USERNAME_ONE" "$PASSWORD_ONE" "user"
assert_success
username=${lines[${#lines[@]}-2]}
password=${lines[${#lines[@]}-1]}
- run setup_bucket "$BUCKET_TWO_NAME"
+ run get_bucket_name "$BUCKET_TWO_NAME"
+ assert_success
+ bucket_two_name="$output"
+
+ run setup_bucket "$bucket_two_name"
assert_success
- run change_bucket_owner "$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY" "$BUCKET_TWO_NAME" "$username"
+ run change_bucket_owner "$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY" "$bucket_two_name" "$username"
assert_success
log 5 "username: $username, password: $password"
- run list_check_buckets_user "$username" "$password" "$BUCKET_TWO_NAME"
+ run list_check_buckets_user "$username" "$password" "$bucket_two_name"
assert_success
}
diff --git a/tests/test_rest_multipart.sh b/tests/test_rest_multipart.sh
index 7b7e664..32111cc 100755
--- a/tests/test_rest_multipart.sh
+++ b/tests/test_rest_multipart.sh
@@ -18,36 +18,45 @@ load ./bats-support/load
load ./bats-assert/load
source ./tests/setup.sh
+source ./tests/drivers/file.sh
source ./tests/drivers/rest.sh
+source ./tests/drivers/create_bucket/create_bucket_rest.sh
source ./tests/drivers/complete_multipart_upload/complete_multipart_upload_rest.sh
source ./tests/drivers/list_buckets/list_buckets_rest.sh
source ./tests/drivers/upload_part/upload_part_rest.sh
source ./tests/util/util_file.sh
source ./tests/util/util_list_parts.sh
-source ./tests/util/util_setup.sh
test_file="test_file"
@test "REST - multipart upload create then abort" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket "$bucket_name"
assert_success
- run create_abort_multipart_upload_rest "$BUCKET_ONE_NAME" "$test_file"
+ run create_abort_multipart_upload_rest "$bucket_name" "$test_file"
assert_success
}
@test "REST - multipart upload create, list parts" {
- run setup_bucket_and_large_file "$BUCKET_ONE_NAME" "$test_file"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_and_large_file_v2 "$bucket_name" "$test_file"
assert_success
run split_file "$TEST_FILE_FOLDER/$test_file" 4
assert_success
- run upload_check_parts "$BUCKET_ONE_NAME" "$test_file" \
+ run upload_check_parts "$bucket_name" "$test_file" \
"$TEST_FILE_FOLDER/$test_file-0" "$TEST_FILE_FOLDER/$test_file-1" "$TEST_FILE_FOLDER/$test_file-2" "$TEST_FILE_FOLDER/$test_file-3"
assert_success
- run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
+ run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
assert_success
}
@@ -55,102 +64,139 @@ test_file="test_file"
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1008"
fi
- run setup_bucket_and_large_file "$BUCKET_ONE_NAME" "$test_file"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_and_large_file_v2 "$bucket_name" "$test_file"
assert_success
- run create_upload_finish_wrong_etag "$BUCKET_ONE_NAME" "$test_file"
+ run create_upload_finish_wrong_etag "$bucket_name" "$test_file"
assert_success
}
@test "REST - upload part copy (UploadPartCopy)" {
- run setup_bucket_and_large_file "$BUCKET_ONE_NAME" "$test_file"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_and_large_file_v2 "$bucket_name" "$test_file"
assert_success
- run create_upload_part_copy_rest "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file"
+ run create_upload_part_copy_rest "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file"
assert_success
- run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
+ run download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"
assert_success
}
@test "REST - UploadPartCopy w/o upload ID" {
- run upload_part_copy_without_upload_id_or_part_number "$BUCKET_ONE_NAME" "$test_file" "1" "" \
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run upload_part_copy_without_upload_id_or_part_number "$bucket_name" "$test_file" "1" "" \
400 "InvalidArgument" "This operation does not accept partNumber without uploadId"
assert_success
}
@test "REST - UploadPartCopy w/o part number" {
- run upload_part_copy_without_upload_id_or_part_number "$BUCKET_ONE_NAME" "$test_file" "" "dummy" \
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run upload_part_copy_without_upload_id_or_part_number "$bucket_name" "$test_file" "" "dummy" \
405 "MethodNotAllowed" "The specified method is not allowed against this resource"
assert_success
}
@test "REST - UploadPartCopy - ETag is quoted" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object "rest" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
- run upload_part_copy_check_etag_header "$BUCKET_ONE_NAME" "$test_file"-mp "$BUCKET_ONE_NAME/$test_file"
+ run upload_part_copy_check_etag_header "$bucket_name" "$test_file"-mp "$bucket_name/$test_file"
assert_success
}
@test "REST - UploadPart - ETag is quoted" {
- run setup_bucket_and_large_file "$BUCKET_ONE_NAME" "$test_file"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_and_large_file_v2 "$bucket_name" "$test_file"
assert_success
run split_file "$TEST_FILE_FOLDER/$test_file" 4
assert_success
- run create_multipart_upload_rest "$BUCKET_ONE_NAME" "$test_file" "" "parse_upload_id"
+ run create_multipart_upload_rest "$bucket_name" "$test_file" "" "parse_upload_id"
assert_success
# shellcheck disable=SC2030
upload_id=$output
- run upload_part_check_etag_header "$BUCKET_ONE_NAME" "$test_file" "$upload_id" "1" "$TEST_FILE_FOLDER/${test_file}-0"
+ run upload_part_check_etag_header "$bucket_name" "$test_file" "$upload_id" "1" "$TEST_FILE_FOLDER/${test_file}-0"
assert_success
}
@test "REST - UploadPart w/o part number" {
- run setup_bucket_and_large_file "$BUCKET_ONE_NAME" "$test_file"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_and_large_file_v2 "$bucket_name" "$test_file"
assert_success
run split_file "$TEST_FILE_FOLDER/$test_file" 4
assert_success
- run upload_part_rest_without_part_number "$BUCKET_ONE_NAME" "$test_file"
+ run upload_part_rest_without_part_number "$bucket_name" "$test_file"
assert_success
}
@test "REST - UploadPart w/o upload ID" {
- if [ "$DIRECT" != "true" ]; then
- skip "https://github.com/versity/versitygw/issues/1237"
- fi
- run setup_bucket_and_large_file "$BUCKET_ONE_NAME" "$test_file"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_and_large_file_v2 "$bucket_name" "$test_file"
assert_success
run split_file "$TEST_FILE_FOLDER/$test_file" 4
assert_success
- run upload_part_rest_without_upload_id "$BUCKET_ONE_NAME" "$test_file"
+ run upload_part_rest_without_upload_id "$bucket_name" "$test_file"
assert_success
}
@test "REST - multipart w/invalid checksum type" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run create_multipart_upload_rest_with_checksum_type_and_algorithm_error "$BUCKET_ONE_NAME" "$test_file" "FULL_OBJECTS" "" \
+ run create_multipart_upload_rest_with_checksum_type_and_algorithm_error "$bucket_name" "$test_file" "FULL_OBJECTS" "" \
check_rest_expected_error "400" "InvalidRequest" "Value for x-amz-checksum-type header is invalid"
assert_success
}
@test "REST - multipart w/invalid checksum algorithm" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run create_multipart_upload_rest_with_checksum_type_and_algorithm_error "$BUCKET_ONE_NAME" "$test_file" "" "crc64nvm" \
+ run create_multipart_upload_rest_with_checksum_type_and_algorithm_error "$bucket_name" "$test_file" "" "crc64nvm" \
check_rest_expected_error "400" "InvalidRequest" "Checksum algorithm provided is unsupported."
assert_success
}
@@ -159,10 +205,14 @@ test_file="test_file"
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1329"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run create_multipart_upload_rest_with_checksum_type_and_algorithm_error "$BUCKET_ONE_NAME" "$test_file" "COMPOSITE" "crc64nvme" \
+ run create_multipart_upload_rest_with_checksum_type_and_algorithm_error "$bucket_name" "$test_file" "COMPOSITE" "crc64nvme" \
check_rest_expected_error "400" "InvalidRequest" "The COMPOSITE checksum type cannot be used with the crc64nvme checksum algorithm."
assert_success
}
@@ -171,10 +221,14 @@ test_file="test_file"
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1329"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run create_multipart_upload_rest_with_checksum_type_and_algorithm_error "$BUCKET_ONE_NAME" "$test_file" "FULL_OBJECT" "sha1" \
+ run create_multipart_upload_rest_with_checksum_type_and_algorithm_error "$bucket_name" "$test_file" "FULL_OBJECT" "sha1" \
check_rest_expected_error "400" "InvalidRequest" "The FULL_OBJECT checksum type cannot be used with the sha1 checksum algorithm."
assert_success
}
@@ -183,7 +237,11 @@ test_file="test_file"
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1329"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$BUCKET_ONE_NAME"
assert_success
run create_multipart_upload_rest_with_checksum_type_and_algorithm_error "$BUCKET_ONE_NAME" "$test_file" "FULL_OBJECT" "sha256" \
@@ -192,26 +250,34 @@ test_file="test_file"
}
@test "REST - multipart - lowercase checksum type and algorithm" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket "$bucket_name"
assert_success
- run create_multipart_upload_rest "$BUCKET_ONE_NAME" "$test_file" "CHECKSUM_TYPE=full_object CHECKSUM_ALGORITHM=crc64nvme" "parse_upload_id"
+ run create_multipart_upload_rest "$bucket_name" "$test_file" "CHECKSUM_TYPE=full_object CHECKSUM_ALGORITHM=crc64nvme" "parse_upload_id"
assert_success
}
@test "REST - multipart - full object checksum type doesn't require UploadPart checksums" {
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket "$bucket_name"
assert_success
run create_test_file "$test_file" $((5*1024*1024))
assert_success
- run create_multipart_upload_rest "$BUCKET_ONE_NAME" "$test_file" "CHECKSUM_TYPE=FULL_OBJECT CHECKSUM_ALGORITHM=CRC32" "parse_upload_id"
+ run create_multipart_upload_rest "$bucket_name" "$test_file" "CHECKSUM_TYPE=FULL_OBJECT CHECKSUM_ALGORITHM=CRC32" "parse_upload_id"
assert_success
upload_id=$output
log 5 "upload ID: $upload_id"
- run upload_part_rest "$BUCKET_ONE_NAME" "$test_file" "$upload_id" 1 "$TEST_FILE_FOLDER/$test_file"
+ run upload_part_rest "$bucket_name" "$test_file" "$upload_id" 1 "$TEST_FILE_FOLDER/$test_file"
assert_success
}
diff --git a/tests/test_rest_put_object.sh b/tests/test_rest_put_object.sh
index 852e4fd..cf3a699 100755
--- a/tests/test_rest_put_object.sh
+++ b/tests/test_rest_put_object.sh
@@ -17,27 +17,36 @@
load ./bats-support/load
load ./bats-assert/load
+source ./tests/setup.sh
+source ./tests/drivers/file.sh
+source ./tests/drivers/create_bucket/create_bucket_rest.sh
source ./tests/drivers/head_object/head_object_rest.sh
source ./tests/drivers/put_object/put_object_rest.sh
-source ./tests/setup.sh
-source ./tests/util/util_setup.sh
test_file="test_file"
export RUN_USERS=true
@test "REST - put object w/STREAMING-AWS4-HMAC-SHA256-PAYLOAD without content length" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object_rest_chunked_payload_type_without_content_length "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object_rest_chunked_payload_type_without_content_length "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
}
@test "REST - PutObject - invalid 'Expires' parameter" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object_rest_check_expires_header "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object_rest_check_expires_header "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
}
@@ -45,13 +54,17 @@ export RUN_USERS=true
if [ "$SKIP_USERS_TEST" == "true" ]; then
skip "skipping versity-specific users tests"
fi
- run setup_bucket_file_and_user "$BUCKET_ONE_NAME" "$test_file" "$USERNAME_ONE" "$PASSWORD_ONE" "admin"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_file_and_user_v2 "$bucket_name" "$test_file" "$USERNAME_ONE" "$PASSWORD_ONE" "admin"
assert_success
username="${lines[${#lines[@]}-2]}"
password="${lines[${#lines[@]}-1]}"
log 5 "username: $username, password: $password"
- run put_object_rest_with_user "$username" "$password" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object_rest_with_user "$username" "$password" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
}
@@ -59,12 +72,16 @@ export RUN_USERS=true
if [ "$SKIP_USERS_TEST" == "true" ]; then
skip "skipping versity-specific users tests"
fi
- run setup_bucket_file_and_user "$BUCKET_ONE_NAME" "$test_file" "$USERNAME_ONE" "$PASSWORD_ONE" "user"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_file_and_user_v2 "$bucket_name" "$test_file" "$USERNAME_ONE" "$PASSWORD_ONE" "user"
assert_success
username="${lines[${#lines[@]}-2]}"
password="${lines[${#lines[@]}-1]}"
- run put_object_rest_with_user_and_code "$username" "$password" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "403"
+ run put_object_rest_with_user_and_code "$username" "$password" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "403"
assert_success
}
@@ -72,18 +89,26 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1321"
fi
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object_without_content_length "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file"
+ run put_object_without_content_length "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file"
assert_success
}
@test "REST - PutObject w/x-amz-checksum-algorithm" {
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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 put_object_rest_with_unneeded_algorithm_param "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "crc32c"
+ run put_object_rest_with_unneeded_algorithm_param "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "crc32c"
assert_success
}
@@ -91,10 +116,14 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/821"
fi
- run setup_bucket_and_add_file "$BUCKET_ONE_NAME" "$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 "501" "NotImplemented" "not implemented" "-bucketName" "$BUCKET_ONE_NAME" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
+ run send_rest_go_command_expect_error "501" "NotImplemented" "not implemented" "-bucketName" "$bucket_name" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
"-signedParams" "if-none-match:true"
assert_success
}
@@ -103,10 +132,14 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/821"
fi
- run setup_bucket_and_add_file "$BUCKET_ONE_NAME" "$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 "412" "PreconditionFailed" "did not hold" "-bucketName" "$BUCKET_ONE_NAME" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
+ run send_rest_go_command_expect_error "412" "PreconditionFailed" "did not hold" "-bucketName" "$bucket_name" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
"-signedParams" "if-none-match:*"
assert_success
}
@@ -115,13 +148,14 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/821"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ 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 create_test_files "$test_file"
- assert_success
-
- run send_rest_go_command "200" "-bucketName" "$BUCKET_ONE_NAME" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
+ run send_rest_go_command "200" "-bucketName" "$bucket_name" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
"-signedParams" "if-none-match:*"
assert_success
}
@@ -130,10 +164,14 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/821"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_v2 "$bucket_name"
assert_success
- run send_rest_go_command_expect_error "404" "NoSuchKey" "key does not exist" "-bucketName" "$BUCKET_ONE_NAME" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
+ run send_rest_go_command_expect_error "404" "NoSuchKey" "key does not exist" "-bucketName" "$bucket_name" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
"-signedParams" "if-match:abc"
assert_success
}
@@ -142,16 +180,14 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/821"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ 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 create_test_files "$test_file"
- assert_success
-
- run put_object_rest "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
- assert_success
-
- run send_rest_go_command_expect_error "412" "PreconditionFailed" "did not hold" "-bucketName" "$BUCKET_ONE_NAME" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
+ run send_rest_go_command_expect_error "412" "PreconditionFailed" "did not hold" "-bucketName" "$bucket_name" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
"-signedParams" "if-match:abc"
assert_success
}
@@ -160,21 +196,19 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/821"
fi
- run setup_bucket "$BUCKET_ONE_NAME"
+ 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 create_test_files "$test_file"
- assert_success
-
- run put_object_rest "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
- assert_success
-
- run get_etag_rest "$BUCKET_ONE_NAME" "$test_file"
+ run get_etag_rest "$bucket_name" "$test_file"
assert_success
etag=${lines[${#lines[@]}-1]}
log 5 "etag: $etag"
- run send_rest_go_command "200" "-bucketName" "$BUCKET_ONE_NAME" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
+ run send_rest_go_command "200" "-bucketName" "$bucket_name" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
"-signedParams" "if-match:$etag"
assert_success
}
@@ -186,17 +220,18 @@ export RUN_USERS=true
uppercase_key="CAPITAL"
uppercase_value="DUMMY"
- run setup_bucket "$BUCKET_ONE_NAME"
+ 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 create_test_files "$test_file"
- assert_success
-
- run send_rest_go_command "200" "-bucketName" "$BUCKET_ONE_NAME" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
+ run send_rest_go_command "200" "-bucketName" "$bucket_name" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
"-signedParams" "x-amz-meta-$uppercase_key:$uppercase_value"
assert_success
- run check_metadata_key_case "$BUCKET_ONE_NAME" "$test_file" "$uppercase_key" "$uppercase_value"
+ run check_metadata_key_case "$bucket_name" "$test_file" "$uppercase_key" "$uppercase_value"
assert_success
}
@@ -204,12 +239,16 @@ export RUN_USERS=true
if [ "$SKIP_USERS_TESTS" == "true" ]; then
skip
fi
- run setup_bucket_file_and_user "$BUCKET_ONE_NAME" "$test_file" "$USERNAME_ONE" "$PASSWORD_ONE" "admin"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_file_and_user_v2 "$bucket_name" "$test_file" "$USERNAME_ONE" "$PASSWORD_ONE" "admin"
assert_success
username="${lines[${#lines[@]}-2]}"
password="${lines[${#lines[@]}-1]}"
- run put_object_rest_user_bad_signature "$username" "$password" "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file"
+ run put_object_rest_user_bad_signature "$username" "$password" "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file"
assert_success
}
@@ -217,10 +256,14 @@ export RUN_USERS=true
if [ "$DIRECT" != "true" ]; then
skip "https://github.com/versity/versitygw/issues/1517"
fi
- run setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"
+ 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_ONE_NAME" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
+ run send_rest_go_command "200" "-bucketName" "$bucket_name" "-objectKey" "$test_file" "-method" "PUT" "-payloadFile" "$TEST_FILE_FOLDER/$test_file" \
"-signedParams" "Expect:100-continue"
assert_success
}
diff --git a/tests/test_rest_versioning.sh b/tests/test_rest_versioning.sh
index 4566451..1870715 100755
--- a/tests/test_rest_versioning.sh
+++ b/tests/test_rest_versioning.sh
@@ -23,11 +23,13 @@ source ./tests/commands/put_object.sh
source ./tests/drivers/create_bucket/create_bucket_rest.sh
source ./tests/drivers/list_buckets/list_buckets_rest.sh
source ./tests/util/util_rest.sh
-source ./tests/util/util_setup.sh
test_file="test_file"
@test "REST - check, enable, suspend versioning" {
+ 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"
@@ -52,6 +54,9 @@ test_file="test_file"
}
@test "test_rest_versioning" {
+ 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"
@@ -79,6 +84,9 @@ test_file="test_file"
}
@test "versioning - add version, then delete and check for marker" {
+ 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"
diff --git a/tests/test_s3api_bucket.sh b/tests/test_s3api_bucket.sh
index b81e25e..1681322 100755
--- a/tests/test_s3api_bucket.sh
+++ b/tests/test_s3api_bucket.sh
@@ -18,15 +18,9 @@ load ./bats-support/load
load ./bats-assert/load
source ./tests/setup.sh
-source ./tests/util/util_create_bucket.sh
-source ./tests/util/util_file.sh
-source ./tests/util/util_head_bucket.sh
-source ./tests/util/util_lock_config.sh
-source ./tests/util/util_object.sh
-source ./tests/util/util_tags.sh
-source ./tests/test_s3api_root_inner.sh
source ./tests/test_common.sh
source ./tests/test_common_acl.sh
+source ./tests/test_s3api_root_inner.sh
source ./tests/commands/copy_object.sh
source ./tests/commands/delete_bucket_policy.sh
source ./tests/commands/delete_object_tagging.sh
@@ -49,8 +43,15 @@ source ./tests/commands/put_object_lock_configuration.sh
source ./tests/commands/put_object_retention.sh
source ./tests/commands/put_public_access_block.sh
source ./tests/commands/select_object_content.sh
-source ./tests/drivers/get_bucket_acl/get_bucket_acl.sh
+source ./tests/drivers/file.sh
source ./tests/drivers/user.sh
+source ./tests/drivers/get_bucket_acl/get_bucket_acl.sh
+source ./tests/util/util_create_bucket.sh
+source ./tests/util/util_file.sh
+source ./tests/util/util_head_bucket.sh
+source ./tests/util/util_lock_config.sh
+source ./tests/util/util_object.sh
+source ./tests/util/util_tags.sh
export RUN_USERS=true
diff --git a/tests/test_s3api_multipart.sh b/tests/test_s3api_multipart.sh
index 9a233ab..8f9e40d 100755
--- a/tests/test_s3api_multipart.sh
+++ b/tests/test_s3api_multipart.sh
@@ -19,16 +19,17 @@ load ./bats-assert/load
source ./tests/setup.sh
source ./tests/test_s3api_root_inner.sh
+source ./tests/commands/get_object.sh
+source ./tests/commands/list_multipart_uploads.sh
+source ./tests/commands/put_object.sh
+source ./tests/drivers/file.sh
+source ./tests/drivers/head_object/head_object_s3api.sh
+source ./tests/drivers/create_bucket/create_bucket_rest.sh
source ./tests/util/util_file.sh
source ./tests/util/util_multipart.sh
source ./tests/util/util_multipart_abort.sh
source ./tests/util/util_multipart_before_completion.sh
-source ./tests/util/util_setup.sh
source ./tests/util/util_tags.sh
-source ./tests/commands/get_object.sh
-source ./tests/commands/put_object.sh
-source ./tests/commands/list_multipart_uploads.sh
-source ./tests/drivers/head_object/head_object_s3api.sh
export RUN_USERS=true
diff --git a/tests/test_s3api_object.sh b/tests/test_s3api_object.sh
index 175718d..04eb01c 100755
--- a/tests/test_s3api_object.sh
+++ b/tests/test_s3api_object.sh
@@ -22,7 +22,6 @@ source ./tests/util/util_create_bucket.sh
source ./tests/util/util_file.sh
source ./tests/util/util_lock_config.sh
source ./tests/util/util_object.sh
-source ./tests/util/util_setup.sh
source ./tests/util/util_tags.sh
source ./tests/test_s3api_root_inner.sh
source ./tests/test_common.sh
diff --git a/tests/test_s3api_policy_bucket.sh b/tests/test_s3api_policy_bucket.sh
index 8a08bf3..ba46619 100644
--- a/tests/test_s3api_policy_bucket.sh
+++ b/tests/test_s3api_policy_bucket.sh
@@ -15,6 +15,7 @@
# under the License.
source ./tests/commands/put_public_access_block.sh
+source ./tests/drivers/file.sh
test_s3api_policy_delete_bucket_policy() {
policy_file="policy_file"
diff --git a/tests/test_s3api_policy_multipart.sh b/tests/test_s3api_policy_multipart.sh
index bff2add..acd33e8 100644
--- a/tests/test_s3api_policy_multipart.sh
+++ b/tests/test_s3api_policy_multipart.sh
@@ -14,8 +14,8 @@
# specific language governing permissions and limitations
# under the License.
+source ./tests/drivers/file.sh
source ./tests/util/util_multipart_abort.sh
-source ./tests/util/util_setup.sh
test_s3api_policy_abort_multipart_upload() {
policy_file="policy_file"
diff --git a/tests/test_s3api_policy_object.sh b/tests/test_s3api_policy_object.sh
index 70763a2..8e29b0e 100644
--- a/tests/test_s3api_policy_object.sh
+++ b/tests/test_s3api_policy_object.sh
@@ -15,7 +15,6 @@
# under the License.
source ./tests/util/util_delete_object.sh
-source ./tests/util/util_setup.sh
test_s3api_policy_allow_deny() {
policy_file="policy_file"
diff --git a/tests/test_s3api_root_inner.sh b/tests/test_s3api_root_inner.sh
index 1f51e7e..3ca022a 100755
--- a/tests/test_s3api_root_inner.sh
+++ b/tests/test_s3api_root_inner.sh
@@ -22,7 +22,6 @@ source ./tests/util/util_get_object_attributes.sh
source ./tests/util/util_get_object_retention.sh
source ./tests/util/util_legal_hold.sh
source ./tests/util/util_list_objects.sh
-source ./tests/util/util_setup.sh
test_delete_objects_s3api_root() {
local object_one="test-file-one"
diff --git a/tests/test_user_aws.sh b/tests/test_user_aws.sh
index 7909db7..effd816 100755
--- a/tests/test_user_aws.sh
+++ b/tests/test_user_aws.sh
@@ -18,9 +18,9 @@ load ./bats-support/load
load ./bats-assert/load
source ./tests/test_user_common.sh
-source ./tests/util/util_setup.sh
source ./tests/commands/get_object.sh
source ./tests/commands/put_object.sh
+source ./tests/drivers/file.sh
source ./tests/drivers/user.sh
export RUN_USERS=true
diff --git a/tests/test_user_common.sh b/tests/test_user_common.sh
index 54935e0..e164fbe 100755
--- a/tests/test_user_common.sh
+++ b/tests/test_user_common.sh
@@ -15,10 +15,10 @@
# under the License.
source ./tests/setup.sh
+source ./tests/drivers/create_bucket/create_bucket_rest.sh
source ./tests/util/util_create_bucket.sh
source ./tests/util/util_list_buckets.sh
source ./tests/util/util_object.sh
-source ./tests/util/util_setup.sh
source ./tests/util/util_users.sh
source ./tests/commands/list_buckets.sh
@@ -121,7 +121,11 @@ test_userplus_operation() {
username="$USERNAME_ONE"
password="$PASSWORD_ONE"
- run setup_bucket_and_user "$BUCKET_ONE_NAME" "$username" "$password" "userplus"
+ run get_bucket_name "$BUCKET_ONE_NAME"
+ assert_success
+ bucket_name="$output"
+
+ run setup_bucket_and_user "$bucket_name" "$username" "$password" "userplus"
assert_success
if [ "$RECREATE_BUCKETS" == "true" ]; then
@@ -134,7 +138,7 @@ test_userplus_operation() {
assert_success
fi
- run list_and_check_buckets_omit_without_permission "$username" "$password" "$BUCKET_ONE_NAME" "$BUCKET_TWO_NAME"
+ run list_and_check_buckets_omit_without_permission "$username" "$password" "$bucket_name" "$BUCKET_TWO_NAME"
assert_success
run change_bucket_owner "$username" "$password" "$BUCKET_TWO_NAME" "admin"
diff --git a/tests/util/util_bucket.sh b/tests/util/util_bucket.sh
index b464dc4..54e0cc4 100644
--- a/tests/util/util_bucket.sh
+++ b/tests/util/util_bucket.sh
@@ -58,32 +58,12 @@ reset_bucket() {
return 1
fi
- if [ "$RUN_USERS" == "true" ] && ! change_bucket_owner "$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY" "$1" "$AWS_ACCESS_KEY_ID"; then
+ if [ "$RUN_USERS" == "true" ] && [ "$DIRECT" != "true" ] && ! change_bucket_owner "$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY" "$1" "$AWS_ACCESS_KEY_ID"; then
log 2 "error changing bucket owner back to root"
return 1
fi
}
-# params: bucket name
-# return 0 if able to delete recursively, 1 if not
-delete_bucket_recursive() {
- log 6 "delete_bucket_recursive '$1'"
- if ! check_param_count "delete_bucket_recursive_s3api" "bucket" 1 $#; then
- return 1
- fi
-
- if ! reset_bucket "$1"; then
- log 2 "error clearing bucket (s3api)"
- return 1
- fi
-
- if ! delete_bucket_rest "$1"; then
- log 2 "error deleting bucket"
- return 1
- fi
- return 0
-}
-
# check if bucket exists
# param: bucket name
# return 0 for true, 1 for false, 2 for error
@@ -144,10 +124,6 @@ setup_bucket() {
log 5 "util.setup_bucket: bucket name: $1"
if [[ $RECREATE_BUCKETS == "true" ]]; then
- if [ "$DIRECT" == "true" ]; then
- log 2 "bucket not successfully deleted"
- return 1
- fi
if ! create_bucket "s3api" "$1"; then
log 2 "error creating bucket"
return 1
@@ -156,12 +132,6 @@ setup_bucket() {
log 5 "skipping bucket re-creation"
fi
- # bucket creation and resets take longer to propagate in direct mode
- if [ "$DIRECT" == "true" ]; then
- log 2 "bucket not found after creation"
- return 1
- fi
-
if [[ $1 == "s3cmd" ]]; then
log 5 "putting bucket ownership controls"
if bucket_exists "$1" && ! put_bucket_ownership_controls "$1" "BucketOwnerPreferred"; then
diff --git a/tests/util/util_chunked_upload.sh b/tests/util/util_chunked_upload.sh
index 3a17c40..d759b5b 100644
--- a/tests/util/util_chunked_upload.sh
+++ b/tests/util/util_chunked_upload.sh
@@ -44,28 +44,22 @@ attempt_chunked_upload_with_bad_first_signature() {
log 2 "error sending command via openssl"
return 1
fi
- response_code="$(echo "$result" | grep "HTTP" | awk '{print $2}')"
- log 5 "response code: $response_code"
- if [ "$response_code" != "403" ]; then
- log 2 "expected code '403', was '$response_code'"
+ log 5 "result: $result"
+ echo -n "$result" > "$TEST_FILE_FOLDER/result.txt"
+ if ! get_xml_data "$TEST_FILE_FOLDER/result.txt" "$TEST_FILE_FOLDER/error_data.txt"; then
+ log 2 "error parsing XML data from result"
return 1
fi
- log 5 "result: $result"
- response_data="$(echo "$result" | grep "")"
- response_data="${response_data/---/}"
- log 5 "response data: $response_data"
- log 5 "END"
- echo -n "$response_data" > "$TEST_FILE_FOLDER/response_data.txt"
- if ! check_xml_element "$TEST_FILE_FOLDER/response_data.txt" "SignatureDoesNotMatch" "Error" "Code"; then
- log 2 "error checking XML element"
+ response_code="$(echo "$result" | grep "HTTP" | awk '{print $2}')"
+ if ! check_rest_expected_error "$response_code" "$TEST_FILE_FOLDER/error_data.txt" "403" "SignatureDoesNotMatch" "does not match"; then
+ log 2 "error checking expected REST error"
return 1
fi
return 0
}
chunked_upload_success() {
- if [ $# -ne 3 ]; then
- log 2 "'chunked_upload_success_as' requires data file, bucket name, key"
+ if ! check_param_count_v2 "data file, bucket name, key" 3 $#; then
return 1
fi
if ! result=$(COMMAND_LOG="$COMMAND_LOG" \
@@ -191,7 +185,11 @@ chunked_upload_trailer_success() {
log 2 "'chunked_upload_trailer_success' requires checksum"
return 1
fi
- if ! setup_bucket "$BUCKET_ONE_NAME"; then
+ if ! bucket_name=$(get_bucket_name "$BUCKET_ONE_NAME" 2>&1); then
+ log 2 "error getting bucket name: $bucket_name"
+ return 1
+ fi
+ if ! setup_bucket "$bucket_name"; then
log 2 "error setting up bucket"
return 1
fi
@@ -200,11 +198,11 @@ chunked_upload_trailer_success() {
log 2 "error creating test file"
return 1
fi
- if ! put_object_chunked_trailer_success "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$1"; then
+ if ! put_object_chunked_trailer_success "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$1"; then
log 2 "error performing chunked upload w/trailer"
return 1
fi
- if ! download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"; then
+ if ! download_and_compare_file "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$TEST_FILE_FOLDER/$test_file-copy"; then
log 2 "error downloading and comparing file"
return 1
fi
@@ -216,7 +214,11 @@ chunked_upload_trailer_invalid_checksum() {
log 2 "'chunked_upload_trailer_invalid_checksum' requires checksum"
return 1
fi
- if ! setup_bucket "$BUCKET_ONE_NAME"; then
+ if ! bucket_name=$(get_bucket_name "$BUCKET_ONE_NAME" 2>&1); then
+ log 2 "error getting bucket name: $bucket_name"
+ return 1
+ fi
+ if ! setup_bucket "$bucket_name"; then
log 2 "error setting up bucket"
return 1
fi
@@ -231,7 +233,7 @@ chunked_upload_trailer_invalid_checksum() {
AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" \
AWS_ENDPOINT_URL="$AWS_ENDPOINT_URL" \
DATA_FILE="$TEST_FILE_FOLDER/$test_file" \
- BUCKET_NAME="$BUCKET_ONE_NAME" \
+ BUCKET_NAME="$bucket_name" \
OBJECT_KEY="$test_file" CHUNK_SIZE=8192 TEST_MODE=false TRAILER="x-amz-checksum-$1" CHECKSUM="a" TEST_FILE_FOLDER="$TEST_FILE_FOLDER" COMMAND_FILE="$TEST_FILE_FOLDER/command.txt" ./tests/rest_scripts/put_object_openssl_chunked_trailer_example.sh 2>&1); then
log 2 "error creating command: $result"
return 1
@@ -248,7 +250,11 @@ chunked_upload_trailer_incorrect_checksum() {
log 2 "'chunked_upload_trailer_invalid_checksum' requires checksum"
return 1
fi
- if ! setup_bucket "$BUCKET_ONE_NAME"; then
+ if ! bucket_name=$(get_bucket_name "$BUCKET_ONE_NAME" 2>&1); then
+ log 2 "error getting bucket name: $bucket_name"
+ return 1
+ fi
+ if ! setup_bucket "$bucket_name"; then
log 2 "error setting up bucket"
return 1
fi
@@ -267,7 +273,7 @@ chunked_upload_trailer_incorrect_checksum() {
AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" \
AWS_ENDPOINT_URL="$AWS_ENDPOINT_URL" \
DATA_FILE="$TEST_FILE_FOLDER/$test_file" \
- BUCKET_NAME="$BUCKET_ONE_NAME" \
+ BUCKET_NAME="$bucket_name" \
OBJECT_KEY="$test_file" CHUNK_SIZE=8192 TEST_MODE=false TRAILER="x-amz-checksum-$1" CHECKSUM="$checksum" TEST_FILE_FOLDER="$TEST_FILE_FOLDER" COMMAND_FILE="$TEST_FILE_FOLDER/command.txt" ./tests/rest_scripts/put_object_openssl_chunked_trailer_example.sh 2>&1); then
log 2 "error creating command: $result"
return 1
diff --git a/tests/util/util_multipart.sh b/tests/util/util_multipart.sh
index dc0bb32..7ec3783 100644
--- a/tests/util/util_multipart.sh
+++ b/tests/util/util_multipart.sh
@@ -272,11 +272,10 @@ create_upload_finish_wrong_etag() {
log 2 "complete multipart upload returned code $result: $(cat "$TEST_FILE_FOLDER/result.txt")"
return 1
fi
- if ! error=$(xmllint --xpath '//*[local-name()="Error"]' "$TEST_FILE_FOLDER/result.txt" 2>&1); then
- log 2 "error retrieving error info: $error"
+ if ! get_xml_data "$TEST_FILE_FOLDER/result.txt" "$TEST_FILE_FOLDER/error.txt"; then
+ log 2 "error getting XML data"
return 1
fi
- echo -n "$error" > "$TEST_FILE_FOLDER/error.txt"
if ! check_xml_element "$TEST_FILE_FOLDER/error.txt" "InvalidPart" "Code"; then
log 2 "code mismatch"
return 1
diff --git a/tests/util/util_object.sh b/tests/util/util_object.sh
index 858ebf6..10faffc 100644
--- a/tests/util/util_object.sh
+++ b/tests/util/util_object.sh
@@ -264,12 +264,18 @@ check_checksum_rest_invalid() {
if ! check_param_count "check_checksum_rest_invalid" "checksum type" 1 $#; then
return 1
fi
+
+ if ! bucket_name=$(get_bucket_name "$BUCKET_ONE_NAME" 2>&1); then
+ log 2 "error getting bucket name: $bucket_name"
+ return 1
+ fi
+
test_file="test_file"
- if ! setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"; then
+ if ! setup_bucket_and_file_v2 "$bucket_name" "$test_file"; then
log 2 "error setting up bucket and file"
return 1
fi
- if ! check_checksum_invalid_or_incorrect "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$1" "dummy" "Value for x-amz-checksum-$1 header is invalid."; then
+ if ! check_checksum_invalid_or_incorrect "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$1" "dummy" "Value for x-amz-checksum-$1 header is invalid."; then
log 2 "error checking checksum"
return 1
fi
@@ -280,8 +286,14 @@ check_checksum_rest_incorrect() {
if ! check_param_count "check_checksum_rest_incorrect" "checksum type" 1 $#; then
return 1
fi
+
+ if ! bucket_name=$(get_bucket_name "$BUCKET_ONE_NAME" 2>&1); then
+ log 2 "error getting bucket name: $bucket_name"
+ return 1
+ fi
+
test_file="test_file"
- if ! setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"; then
+ if ! setup_bucket_and_file "$bucket_name" "$test_file"; then
log 2 "error setting up bucket and file"
return 1
fi
@@ -291,7 +303,7 @@ check_checksum_rest_incorrect() {
log 2 "error calculating incorrect checksum"
return 1
fi
- if ! check_checksum_invalid_or_incorrect "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$1" "$incorrect_checksum" "$error_message"; then
+ if ! check_checksum_invalid_or_incorrect "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$1" "$incorrect_checksum" "$error_message"; then
log 2 "error checking checksum"
return 1
fi
@@ -302,6 +314,7 @@ calculate_incorrect_checksum() {
if ! check_param_count "calculate_incorrect_checksum" "checksum type, data file" 2 $#; then
return 1
fi
+
if ! checksum=$(DATA_FILE="$2" CHECKSUM_TYPE="$1" TEST_FILE_FOLDER="$TEST_FILE_FOLDER" ./tests/rest_scripts/calculate_checksum.sh 2>&1); then
log 2 "error calculating checksum: $checksum"
return 1
@@ -334,13 +347,18 @@ add_correct_checksum() {
if ! check_param_count "add_correct_checksum" "checksum type" 1 $#; then
return 1
fi
+ if ! bucket_name=$(get_bucket_name "$BUCKET_ONE_NAME" 2>&1); then
+ log 2 "error getting bucket name: $bucket_name"
+ return 1
+ fi
+
test_file="test_file"
- if ! setup_bucket_and_file "$BUCKET_ONE_NAME" "$test_file"; then
+ if ! setup_bucket_and_file "$bucket_name" "$test_file"; then
log 2 "error setting up bucket and file"
return 1
fi
- if ! put_object_rest_checksum "$TEST_FILE_FOLDER/$test_file" "$BUCKET_ONE_NAME" "$test_file" "$1"; then
+ if ! put_object_rest_checksum "$TEST_FILE_FOLDER/$test_file" "$bucket_name" "$test_file" "$1"; then
log 2 "error adding file with checksum to s3"
return 1
fi
@@ -371,7 +389,7 @@ put_object_rest_check_expires_header() {
log 2 "expected response code of '200', was '$result' ($(cat "$TEST_FILE_FOLDER/result.txt"))"
return 1
fi
- if ! result=$(COMMAND_LOG="$COMMAND_LOG" BUCKET_NAME="$BUCKET_ONE_NAME" OBJECT_KEY="$test_file" OUTPUT_FILE="$TEST_FILE_FOLDER/result.txt" ./tests/rest_scripts/head_object.sh 2>&1); then
+ if ! result=$(COMMAND_LOG="$COMMAND_LOG" BUCKET_NAME="$2" OBJECT_KEY="$3" OUTPUT_FILE="$TEST_FILE_FOLDER/result.txt" ./tests/rest_scripts/head_object.sh 2>&1); then
log 2 "error: $result"
return 1
fi
diff --git a/tests/util/util_tags.sh b/tests/util/util_tags.sh
index f77d7e5..13e95c6 100644
--- a/tests/util/util_tags.sh
+++ b/tests/util/util_tags.sh
@@ -283,7 +283,7 @@ add_verify_bucket_tags_rest() {
log 2 "expected response code of '204', was '$result' (error: $(cat "$TEST_FILE_FOLDER/result.txt"))"
return 1
fi
- if ! result=$(COMMAND_LOG="$COMMAND_LOG" BUCKET_NAME="$BUCKET_ONE_NAME" OUTPUT_FILE="$TEST_FILE_FOLDER/bucket_tagging.txt" ./tests/rest_scripts/get_bucket_tagging.sh); then
+ if ! result=$(COMMAND_LOG="$COMMAND_LOG" BUCKET_NAME="$1" OUTPUT_FILE="$TEST_FILE_FOLDER/bucket_tagging.txt" ./tests/rest_scripts/get_bucket_tagging.sh); then
log 2 "error listing bucket tags: $result"
return 1
fi
diff --git a/tests/util/util_users.sh b/tests/util/util_users.sh
index 1e143b3..647e9ec 100644
--- a/tests/util/util_users.sh
+++ b/tests/util/util_users.sh
@@ -391,15 +391,6 @@ delete_user() {
fi
}
-change_bucket_owner_direct() {
- log 6 "change_bucket_owner_direct"
- if [[ $# -ne 4 ]]; then
- log 2 "change bucket owner command requires ID, key, bucket name, and new owner"
- return 1
- fi
- # TODO add
-}
-
reset_bucket_owner() {
if [ $# -ne 1 ]; then
log 2 "'reset_bucket_owner' requires bucket name"
@@ -419,11 +410,7 @@ change_bucket_owner() {
return 1
fi
if [[ $DIRECT == "true" ]]; then
- if ! change_bucket_owner_direct "$1" "$2" "$3" "$4"; then
- log 2 "error changing bucket owner direct to s3"
- return 1
- fi
- return 0
+ skip "any direct commands requiring bucket ownership change not yet implemented"
fi
log 5 "changing owner for bucket $3, new owner: $4"
error=$(send_command "$VERSITY_EXE" admin --allow-insecure --access "$1" --secret "$2" --endpoint-url "$AWS_ENDPOINT_URL" change-bucket-owner --bucket "$3" --owner "$4" 2>&1) || local change_result=$?