mirror of
https://github.com/versity/versitygw.git
synced 2026-09-25 09:24:22 +00:00
test: allow versitygw command customization, website testing, s3 config fix
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
source ./tests/commands/create_bucket.sh
|
||||
source ./tests/drivers/delete_bucket/delete_bucket_rest.sh
|
||||
source ./tests/drivers/get_bucket_acl/get_bucket_acl_rest.sh
|
||||
source ./tests/drivers/get_object/get_object_rest.sh
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
source ./tests/commands/delete_bucket.sh
|
||||
source ./tests/commands/get_bucket_location.sh
|
||||
source ./tests/commands/list_buckets.sh
|
||||
source ./tests/drivers/get_bucket_location/get_bucket_location_rest.sh
|
||||
|
||||
@@ -14,10 +14,13 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
source ./tests/commands/list_object_versions.sh
|
||||
source ./tests/commands/list_objects.sh
|
||||
source ./tests/commands/list_objects_v2.sh
|
||||
source ./tests/drivers/list_object_versions/list_object_versions_rest.sh
|
||||
source ./tests/drivers/xml.sh
|
||||
source ./tests/drivers/get_object_legal_hold/get_object_legal_hold_rest.sh
|
||||
source ./tests/util/util_object.sh
|
||||
|
||||
list_and_delete_objects() {
|
||||
if ! check_param_count_v2 "bucket, lock config exists" 2 $#; then
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2026 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.
|
||||
|
||||
compare_website_suffixes() {
|
||||
if ! check_param_count_v2 "data file, expected suffix" 2 $#; then
|
||||
return 1
|
||||
fi
|
||||
local data_file="$1" expected_suffix="$2"
|
||||
|
||||
if ! check_xml_element "$data_file" "$expected_suffix" "WebsiteConfiguration" "IndexDocument" "Suffix"; then
|
||||
log 2 "error checking xml element"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
check_index_document_suffix() {
|
||||
if ! check_param_count_v2 "bucket name, expected suffix" 2 $#; then
|
||||
return 1
|
||||
fi
|
||||
local bucket_name="$1" expected_suffix="$2"
|
||||
|
||||
if ! send_rest_go_command_callback "200" "compare_website_suffixes" "-bucketName" "$bucket_name" "-query" "website" "--" "$expected_suffix"; then
|
||||
log 2 "error sending get website command or comparing suffix"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@@ -14,6 +14,8 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
source ./tests/commands/get_object_lock_configuration.sh
|
||||
|
||||
check_object_lock_config() {
|
||||
if ! check_param_count_v2 "bucket" 1 $#; then
|
||||
return 1
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
source ./tests/commands/get_bucket_ownership_controls.sh
|
||||
|
||||
put_bucket_acl_success_or_access_denied() {
|
||||
if ! check_param_count_v2 "bucket, acl file, username, password, expect success" 5 $#; then
|
||||
return 1
|
||||
|
||||
@@ -24,29 +24,17 @@ create_website_with_random_string() {
|
||||
local bucket_name="$1"
|
||||
local response file_name test_string
|
||||
|
||||
if ! response=$(get_file_name 2>&1); then
|
||||
log 2 "error getting file name: $response"
|
||||
return 1
|
||||
fi
|
||||
file_name="$response"
|
||||
|
||||
if ! response=$(generate_random_string 8 10 2>&1); then
|
||||
log 2 "error generating random string: $response"
|
||||
return 1
|
||||
fi
|
||||
test_string="$response"
|
||||
echo "$test_string" > "$TEST_FILE_FOLDER/$file_name"
|
||||
|
||||
if ! response=$(put_object_rest "$TEST_FILE_FOLDER/$file_name" "$bucket_name" "$file_name" 2>&1); then
|
||||
log 2 "error putting random string file: $response"
|
||||
if ! response=$(put_object_with_random_alnum_string "$bucket_name" 2>&1); then
|
||||
log 2 "error putting object with random alnum string: $response"
|
||||
return 1
|
||||
fi
|
||||
read -r file_name test_string <<< "$response"
|
||||
|
||||
if ! response=$(send_rest_go_command "200" "-commandType" "putBucketWebsiteConfiguration" "-bucketName" "$bucket_name" \
|
||||
"-websiteConfiguration" "{\"IndexDocument\":{\"Suffix\":\"$file_name\"}}" 2>&1); then
|
||||
log 2 "error putting website configuration: $response"
|
||||
return 1
|
||||
fi
|
||||
printf '%s\n' "$test_string"
|
||||
printf '%s\n' "$file_name $test_string"
|
||||
return 0
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
source ./tests/commands/put_object.sh
|
||||
source ./tests/drivers/rest.sh
|
||||
source ./tests/drivers/openssl.sh
|
||||
|
||||
@@ -525,3 +526,31 @@ put_objects() {
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
put_object_with_random_alnum_string() {
|
||||
if ! check_param_count_v2 "bucket name" 1 $#; then
|
||||
return 1
|
||||
fi
|
||||
local bucket_name="$1"
|
||||
local response file_name test_string
|
||||
|
||||
if ! response=$(get_file_name 2>&1); then
|
||||
log 2 "error getting file name: $response"
|
||||
return 1
|
||||
fi
|
||||
file_name="$response"
|
||||
|
||||
if ! response=$(generate_random_string 8 10 2>&1); then
|
||||
log 2 "error generating random string: $response"
|
||||
return 1
|
||||
fi
|
||||
test_string="$response"
|
||||
echo "$test_string" > "$TEST_FILE_FOLDER/$file_name"
|
||||
|
||||
if ! response=$(put_object_rest "$TEST_FILE_FOLDER/$file_name" "$bucket_name" "$file_name" 2>&1); then
|
||||
log 2 "error putting random string file: $response"
|
||||
return 1
|
||||
fi
|
||||
echo "$file_name" "$test_string"
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
source ./tests/commands/command.sh
|
||||
source ./tests/drivers/list_objects/list_objects_rest.sh
|
||||
source ./tests/drivers/xml.sh
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
source ./tests/commands/delete_bucket_policy.sh
|
||||
source ./tests/drivers/delete_object/delete_object_rest.sh
|
||||
source ./tests/drivers/get_object_lock_config/get_object_lock_config_rest.sh
|
||||
source ./tests/drivers/put_bucket_acl/put_bucket_acl_rest.sh
|
||||
|
||||
Reference in New Issue
Block a user