mirror of
https://github.com/versity/versitygw.git
synced 2026-08-18 13:16:31 +00:00
Merge pull request #1872 from versity/test/remove_old_recording
test: remove obsolete recording code
This commit is contained in:
@@ -20,7 +20,6 @@ USERS_FOLDER=$PWD/iam
|
||||
IAM_TYPE=folder
|
||||
DIRECT=false
|
||||
#DIRECT_DISPLAY_NAME=
|
||||
#COVERAGE_DB=coverage.sql
|
||||
USERNAME_ONE=ABCDEFG
|
||||
PASSWORD_ONE=HIJKLMN
|
||||
USERNAME_TWO=HIJKLMN
|
||||
|
||||
@@ -18,7 +18,6 @@ USERS_FOLDER=$PWD/iam
|
||||
IAM_TYPE=folder
|
||||
DIRECT=false
|
||||
#DIRECT_DISPLAY_NAME=
|
||||
#COVERAGE_DB=coverage.sql
|
||||
USERNAME_ONE=ABCDEFG
|
||||
PASSWORD_ONE=HIJKLMN
|
||||
USERNAME_TWO=HIJKLMN
|
||||
|
||||
+2
-2
@@ -155,8 +155,6 @@ A single instance can be run with `docker-compose -f docker-compose-bats.yml up
|
||||
|
||||
**DIRECT_AWS_USER_ID**: AWS policy 12-digit user ID if **DIRECT** is set to **true**.
|
||||
|
||||
**COVERAGE_DB**: database to store client command coverage info and usage counts, if using.
|
||||
|
||||
**USERNAME_ONE**, **PASSWORD_ONE**, **USERNAME_TWO**, **PASSWORD_TWO**: setup_user (v1), credentials for users created and tested for non-root user **versitygw** operations (non-setup_user_v2).
|
||||
|
||||
**TEST_FILE_FOLDER**: where to put temporary test files.
|
||||
@@ -189,6 +187,8 @@ A single instance can be run with `docker-compose -f docker-compose-bats.yml up
|
||||
|
||||
**MAX_OPENSSL_COMMAND_LOG_BYTES**: number of OpenSSL command bytes to display in command log, can prevent the display of too many chars in the case of large payload commands, -1 means display whole command
|
||||
|
||||
**COVERAGE_LOG**: if set, where to write test or test suite coverage data
|
||||
|
||||
## REST Scripts
|
||||
|
||||
REST scripts are included for calls to S3's REST API in the `./tests/rest_scripts/` folder. To call a script, the following parameters are needed:
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
abort_multipart_upload() {
|
||||
record_command "abort-multipart-upload" "client:s3api"
|
||||
if [ $# -ne 3 ]; then
|
||||
log 2 "'abort multipart upload' command requires bucket, key, upload ID"
|
||||
return 1
|
||||
@@ -47,7 +46,6 @@ abort_multipart_upload_with_user() {
|
||||
log 2 "'abort multipart upload' command requires bucket, key, upload ID, username, password"
|
||||
return 1
|
||||
fi
|
||||
record_command "abort-multipart-upload" "client:s3api"
|
||||
if ! abort_multipart_upload_error=$(AWS_ACCESS_KEY_ID="$4" AWS_SECRET_ACCESS_KEY="$5" send_command aws --no-verify-ssl s3api abort-multipart-upload --bucket "$1" --key "$2" --upload-id "$3" 2>&1); then
|
||||
log 2 "Error aborting upload: $abort_multipart_upload_error"
|
||||
export abort_multipart_upload_error
|
||||
|
||||
@@ -20,7 +20,6 @@ complete_multipart_upload() {
|
||||
return 1
|
||||
fi
|
||||
log 5 "complete multipart upload id: $3, parts: $4"
|
||||
record_command "complete-multipart-upload" "client:s3api"
|
||||
error=$(send_command aws --no-verify-ssl s3api complete-multipart-upload --bucket "$1" --key "$2" --upload-id "$3" --multipart-upload '{"Parts": '"$4"'}' 2>&1) || local completed=$?
|
||||
if [[ $completed -ne 0 ]]; then
|
||||
log 2 "error completing multipart upload: $error"
|
||||
|
||||
@@ -21,7 +21,6 @@ copy_object() {
|
||||
fi
|
||||
local exit_code=0
|
||||
local error
|
||||
record_command "copy-object" "client:$1"
|
||||
if [[ $1 == 's3' ]]; then
|
||||
error=$(send_command aws --no-verify-ssl s3 cp "$2" s3://"$3/$4" 2>&1) || exit_code=$?
|
||||
elif [[ $1 == 's3api' ]]; then
|
||||
@@ -44,7 +43,6 @@ copy_object() {
|
||||
}
|
||||
|
||||
copy_object_empty() {
|
||||
record_command "copy-object" "client:s3api"
|
||||
error=$(send_command aws --no-verify-ssl s3api copy-object 2>&1) || local result=$?
|
||||
if [[ $result -eq 0 ]]; then
|
||||
log 2 "copy object with empty parameters returned no error"
|
||||
|
||||
@@ -25,7 +25,6 @@ create_bucket() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
record_command "create-bucket" "client:$1"
|
||||
local exit_code=0
|
||||
local error
|
||||
if [[ $1 == 's3' ]]; then
|
||||
@@ -98,7 +97,6 @@ create_bucket_with_user() {
|
||||
|
||||
create_bucket_object_lock_enabled() {
|
||||
log 6 "create_bucket_object_lock_enabled"
|
||||
record_command "create-bucket" "client:s3api"
|
||||
if ! check_param_count "create_bucket_object_lock_enabled" "bucket" 1 $#; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -41,7 +41,6 @@ create_multipart_upload_rest_with_checksum_type_and_algorithm_error() {
|
||||
}
|
||||
|
||||
create_multipart_upload_s3api() {
|
||||
record_command "create-multipart-upload" "client:s3api"
|
||||
if ! check_param_count_v2 "bucket, key" 2 $#; then
|
||||
return 1
|
||||
fi
|
||||
@@ -83,7 +82,6 @@ create_multipart_upload_s3api_custom() {
|
||||
}
|
||||
|
||||
create_multipart_upload_s3api_params() {
|
||||
record_command "create-multipart-upload" "client:s3api"
|
||||
if ! check_param_count_v2 "bucket, key, content type, metadata, object lock legal hold status, \
|
||||
object lock mode, object lock retain until date, and tagging" 8 $#; then
|
||||
return 1
|
||||
@@ -108,7 +106,6 @@ create_multipart_upload_s3api_params() {
|
||||
}
|
||||
|
||||
create_multipart_upload_s3api_with_user() {
|
||||
record_command "create-multipart-upload" "client:s3api"
|
||||
if ! check_param_count_v2 "bucket, key, username, password" 4 $#; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
# fail if params are bad, or bucket exists and user is unable to delete bucket
|
||||
delete_bucket() {
|
||||
log 6 "delete_bucket"
|
||||
record_command "delete-bucket" "client:$1"
|
||||
if [ $# -ne 2 ]; then
|
||||
log 2 "'delete_bucket' command requires client, bucket"
|
||||
return 1
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
delete_bucket_policy() {
|
||||
record_command "delete-bucket-policy" "client:$1"
|
||||
if [[ $# -ne 2 ]]; then
|
||||
log 2 "delete bucket policy command requires command type, bucket"
|
||||
return 1
|
||||
@@ -54,7 +53,6 @@ delete_bucket_policy_rest() {
|
||||
}
|
||||
|
||||
delete_bucket_policy_with_user() {
|
||||
record_command "delete-bucket-policy" "client:s3api"
|
||||
if [[ $# -ne 3 ]]; then
|
||||
log 2 "'delete bucket policy with user' command requires bucket, username, password"
|
||||
return 1
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
delete_bucket_tagging() {
|
||||
record_command "delete-bucket-tagging" "client:$1"
|
||||
if [ $# -ne 2 ]; then
|
||||
log 2 "delete bucket tagging command missing command type, bucket name"
|
||||
return 1
|
||||
@@ -38,7 +37,6 @@ delete_bucket_tagging() {
|
||||
|
||||
delete_bucket_tagging_with_user() {
|
||||
log 6 "delete_bucket_tagging_with_user"
|
||||
record_command "delete-bucket-tagging" "client:s3api"
|
||||
if [ $# -ne 3 ]; then
|
||||
log 2 "delete bucket tagging command missing username, password, bucket name"
|
||||
return 1
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# params: client, bucket, key
|
||||
delete_object() {
|
||||
log 6 "delete_object"
|
||||
record_command "delete-object" "client:$1"
|
||||
if ! check_param_count "delete_object" "command type, bucket, key" 3 $#; then
|
||||
return 1
|
||||
fi
|
||||
@@ -124,7 +123,6 @@ delete_object_version_rest_bypass_retention() {
|
||||
}
|
||||
|
||||
delete_object_with_user() {
|
||||
record_command "delete-object" "client:$1"
|
||||
if ! check_param_count "delete_object_version_bypass_retention" "command type, bucket, key, access ID, secret key" 5 $#; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
delete_object_tagging() {
|
||||
record_command "delete-object-tagging" "client:$1"
|
||||
if [[ $# -ne 3 ]]; then
|
||||
log 2 "delete object tagging command missing command type, bucket, key"
|
||||
return 1
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
delete_objects() {
|
||||
record_command "delete-objects" "client:s3api"
|
||||
if [[ $# -ne 3 ]]; then
|
||||
log 2 "'delete-objects' command requires bucket name, two object keys"
|
||||
return 1
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
get_bucket_acl() {
|
||||
record_command "get-bucket-acl" "client:$1"
|
||||
if [ $# -ne 2 ]; then
|
||||
log 2 "bucket ACL command missing command type, bucket name"
|
||||
return 1
|
||||
@@ -37,7 +36,6 @@ get_bucket_acl() {
|
||||
}
|
||||
|
||||
get_bucket_acl_with_user() {
|
||||
record_command "get-bucket-acl" "client:s3api"
|
||||
if [ $# -ne 3 ]; then
|
||||
log 2 "'get bucket ACL with user' command requires bucket name, username, password"
|
||||
return 1
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
get_bucket_location() {
|
||||
record_command "get-bucket-location" "client:$1"
|
||||
if [[ $# -ne 2 ]]; then
|
||||
log 2 "get bucket location command requires command type, bucket name"
|
||||
return 1
|
||||
@@ -42,7 +41,6 @@ get_bucket_location() {
|
||||
}
|
||||
|
||||
get_bucket_location_aws() {
|
||||
record_command "get-bucket-location" "client:s3api"
|
||||
if [[ $# -ne 1 ]]; then
|
||||
log 2 "get bucket location (aws) requires bucket name"
|
||||
return 1
|
||||
@@ -57,7 +55,6 @@ get_bucket_location_aws() {
|
||||
}
|
||||
|
||||
get_bucket_location_s3cmd() {
|
||||
record_command "get-bucket-location" "client:s3cmd"
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "get bucket location (s3cmd) requires bucket name"
|
||||
return 1
|
||||
@@ -73,7 +70,6 @@ get_bucket_location_s3cmd() {
|
||||
}
|
||||
|
||||
get_bucket_location_mc() {
|
||||
record_command "get-bucket-location" "client:mc"
|
||||
if ! check_param_count_v2 "bucket name" 1 $#; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -20,7 +20,6 @@ get_bucket_ownership_controls() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
record_command "get-bucket-ownership-controls" "client:s3api"
|
||||
if [[ $# -ne 1 ]]; then
|
||||
log 2 "'get bucket ownership controls' command requires bucket name"
|
||||
return 1
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
get_bucket_policy() {
|
||||
log 6 "get_bucket_policy '$1' '$2'"
|
||||
record_command "get-bucket-policy" "client:$1"
|
||||
if ! check_param_count "get_bucket_policy" "command type, bucket" 2 $#; then
|
||||
return 1
|
||||
fi
|
||||
@@ -42,7 +41,6 @@ get_bucket_policy() {
|
||||
|
||||
get_bucket_policy_s3api() {
|
||||
log 6 "get_bucket_policy_s3api '$1'"
|
||||
record_command "get-bucket-policy" "client:s3api"
|
||||
if ! check_param_count "get_bucket_policy_s3api" "bucket" 1 $#; then
|
||||
return 1
|
||||
fi
|
||||
@@ -63,7 +61,6 @@ get_bucket_policy_s3api() {
|
||||
}
|
||||
|
||||
get_bucket_policy_with_user() {
|
||||
record_command "get-bucket-policy" "client:s3api"
|
||||
if ! check_param_count "get_bucket_policy_with_user" "bucket, username, password" 3 $#; then
|
||||
return 1
|
||||
fi
|
||||
@@ -82,7 +79,6 @@ get_bucket_policy_with_user() {
|
||||
}
|
||||
|
||||
get_bucket_policy_s3cmd() {
|
||||
record_command "get-bucket-policy" "client:s3cmd"
|
||||
if ! check_param_count "get_bucket_policy_s3cmd" "bucket" 1 $#; then
|
||||
return 1
|
||||
fi
|
||||
@@ -167,7 +163,6 @@ search_for_first_policy_line_or_full_policy() {
|
||||
}
|
||||
|
||||
get_bucket_policy_mc() {
|
||||
record_command "get-bucket-policy" "client:mc"
|
||||
if ! check_param_count "get_bucket_policy_mc" "bucket" 1 $#; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
get_bucket_tagging() {
|
||||
log 6 "get_bucket_tagging"
|
||||
assert [ $# -eq 2 ]
|
||||
record_command "get-bucket-tagging" "client:$1"
|
||||
local result
|
||||
if [[ $1 == 's3api' ]]; then
|
||||
tags=$(send_command aws --no-verify-ssl s3api get-bucket-tagging --bucket "$2" 2>&1) || result=$?
|
||||
@@ -47,7 +46,6 @@ get_bucket_tagging_with_user() {
|
||||
log 2 "'get_bucket_tagging_with_user' command requires ID, key, bucket"
|
||||
return 1
|
||||
fi
|
||||
record_command "get-bucket-tagging" "client:s3api"
|
||||
local result
|
||||
if ! tags=$(AWS_ACCESS_KEY_ID="$1" AWS_SECRET_ACCESS_KEY="$2" send_command aws --no-verify-ssl s3api get-bucket-tagging --bucket "$3" 2>&1); then
|
||||
log 5 "tags error: $tags"
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
get_bucket_versioning() {
|
||||
record_command "get-bucket-versioning" "client:s3api"
|
||||
if [[ $# -ne 2 ]]; then
|
||||
log 2 "get bucket versioning command requires command type, bucket name"
|
||||
return 1
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
get_object() {
|
||||
log 6 "get_object"
|
||||
record_command "get-object" "client:$1"
|
||||
if [ $# -ne 4 ]; then
|
||||
log 2 "get object command requires command type, bucket, key, destination"
|
||||
return 1
|
||||
@@ -45,7 +44,6 @@ get_object() {
|
||||
}
|
||||
|
||||
get_object_with_range() {
|
||||
record_command "get-object" "client:s3api"
|
||||
if [[ $# -ne 4 ]]; then
|
||||
log 2 "'get object with range' requires bucket, key, range, outfile"
|
||||
return 1
|
||||
@@ -59,7 +57,6 @@ get_object_with_range() {
|
||||
|
||||
get_object_with_user() {
|
||||
log 6 "get_object_with_user"
|
||||
record_command "get-object" "client:$1"
|
||||
if [ $# -ne 6 ]; then
|
||||
log 2 "'get object with user' command requires command type, bucket, key, save location, aws ID, aws secret key"
|
||||
return 1
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
get_object_attributes() {
|
||||
record_command "get-object-attributes" "client:s3api"
|
||||
if [[ $# -ne 2 ]]; then
|
||||
log 2 "'get object attributes' command requires bucket, key"
|
||||
return 1
|
||||
|
||||
@@ -19,7 +19,6 @@ get_object_legal_hold() {
|
||||
log 2 "'get object legal hold' command requires bucket, key"
|
||||
return 1
|
||||
fi
|
||||
record_command "get-object-legal-hold" "client:s3api"
|
||||
legal_hold=$(send_command aws --no-verify-ssl s3api get-object-legal-hold --bucket "$1" --key "$2" 2>&1) || local get_result=$?
|
||||
if [[ $get_result -ne 0 ]]; then
|
||||
log 2 "error getting object legal hold: $legal_hold"
|
||||
@@ -49,7 +48,6 @@ get_object_legal_hold_version_id() {
|
||||
log 2 "'get_object_legal_hold_version_id' command requires bucket, key, version id"
|
||||
return 1
|
||||
fi
|
||||
record_command "get-object-legal-hold" "client:s3api"
|
||||
if ! legal_hold=$(send_command aws --no-verify-ssl s3api get-object-legal-hold --bucket "$1" --key "$2" --version-id "$3" 2>&1); then
|
||||
log 2 "error getting object legal hold w/version id: $legal_hold"
|
||||
return 1
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
source ./tests/drivers/params.sh
|
||||
|
||||
get_object_lock_configuration() {
|
||||
record_command "get-object-lock-configuration" "client:s3api"
|
||||
if ! check_param_count "get_object_lock_configuration" "client, bucket name" 2 $#; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
get_object_retention() {
|
||||
record_command "get-object-retention" "client:s3api"
|
||||
if [[ $# -ne 2 ]]; then
|
||||
log 2 "'get object retention' command requires bucket, key"
|
||||
return 1
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
get_object_tagging() {
|
||||
record_command "get-object-tagging" "client:$1"
|
||||
if [ $# -ne 3 ]; then
|
||||
log 2 "get object tag command missing command type, bucket, and/or key"
|
||||
return 1
|
||||
|
||||
@@ -23,7 +23,6 @@ source ./tests/report.sh
|
||||
# 2 - misc error
|
||||
head_bucket() {
|
||||
log 6 "head_bucket '$1' '$2'"
|
||||
record_command "head-bucket" "client:$1"
|
||||
if ! check_param_count "head_bucket" "client, bucket name" 2 $#; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
head_object() {
|
||||
record_command "head-object" "client:$1"
|
||||
if [ $# -ne 3 ]; then
|
||||
log 2 "head-object missing command, bucket name, object name"
|
||||
return 2
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
list_buckets() {
|
||||
log 6 "list_buckets"
|
||||
record_command "list-buckets" "client:$1"
|
||||
if [ $# -ne 1 ]; then
|
||||
log 2 "list buckets command missing command type"
|
||||
return 1
|
||||
@@ -55,7 +54,6 @@ list_buckets() {
|
||||
}
|
||||
|
||||
list_buckets_with_user() {
|
||||
record_command "list-buckets" "client:$1"
|
||||
if [ $# -ne 3 ]; then
|
||||
log 2 "'list buckets as user' command missing command type, username, password"
|
||||
return 1
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
list_multipart_uploads() {
|
||||
record_command "list-multipart-uploads" "client:s3api"
|
||||
if [[ $# -ne 1 ]]; then
|
||||
log 2 "'list multipart uploads' command requires bucket name"
|
||||
return 1
|
||||
@@ -27,7 +26,6 @@ list_multipart_uploads() {
|
||||
}
|
||||
|
||||
list_multipart_uploads_rest() {
|
||||
record_command "list_multipart_uploads_rest" "client:rest"
|
||||
if ! check_param_count "list_multipart_upload_rest" "bucket" 1 $#; then
|
||||
return 1
|
||||
fi
|
||||
@@ -44,7 +42,6 @@ list_multipart_uploads_rest() {
|
||||
}
|
||||
|
||||
list_multipart_uploads_with_user() {
|
||||
record_command "list-multipart-uploads" "client:s3api"
|
||||
if [[ $# -ne 3 ]]; then
|
||||
log 2 "'list multipart uploads' command requires bucket name, username, password"
|
||||
return 1
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
list_object_versions() {
|
||||
record_command "list-object-versions" "client:s3api"
|
||||
if ! check_param_count "list_object_versions" "client, bucket name" 2 $#; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -21,7 +21,6 @@ source ./tests/commands/command.sh
|
||||
# return 0 if able to list, 1 if not
|
||||
list_objects() {
|
||||
log 6 "list_objects"
|
||||
record_command "list-objects" "client:$1"
|
||||
if ! check_param_count "list_object" "client, bucket" 2 $#; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -22,7 +22,6 @@ list_objects_v2() {
|
||||
log 2 "list objects command missing bucket and/or path"
|
||||
return 1
|
||||
fi
|
||||
record_command "list-objects-v2 client:s3api"
|
||||
objects=$(send_command aws --no-verify-ssl s3api list-objects-v2 --bucket "$1") || local result=$?
|
||||
if [[ $result -ne 0 ]]; then
|
||||
log 2 "error listing objects: $objects"
|
||||
|
||||
@@ -31,7 +31,6 @@ list_parts_with_user() {
|
||||
log 2 "'list_parts_with_user' requires username, password, bucket, key, upload ID"
|
||||
return 1
|
||||
fi
|
||||
record_command 'list-parts' 'client:s3api'
|
||||
if ! listed_parts=$(AWS_ACCESS_KEY_ID="$1" AWS_SECRET_ACCESS_KEY="$2" send_command aws --no-verify-ssl s3api list-parts --bucket "$3" --key "$4" --upload-id "$5" 2>&1); then
|
||||
log 2 "Error listing multipart upload parts: $listed_parts"
|
||||
return 1
|
||||
|
||||
@@ -21,7 +21,6 @@ source ./tests/drivers/rest.sh
|
||||
|
||||
put_bucket_acl_s3api() {
|
||||
log 6 "put_bucket_acl_s3api"
|
||||
record_command "put-bucket-acl" "client:s3api"
|
||||
if [[ $# -ne 2 ]]; then
|
||||
log 2 "put bucket acl command requires bucket name, acl file"
|
||||
return 1
|
||||
@@ -36,7 +35,6 @@ put_bucket_acl_s3api() {
|
||||
|
||||
put_bucket_acl_s3api_with_user() {
|
||||
log 6 "put_bucket_acl_s3api_with_user"
|
||||
record_command "put-bucket-acl" "client:s3api"
|
||||
if [[ $# -ne 4 ]]; then
|
||||
log 2 "put bucket acl command requires bucket name, acl file, username, password"
|
||||
return 1
|
||||
@@ -78,7 +76,6 @@ reset_bucket_acl() {
|
||||
}
|
||||
|
||||
put_bucket_canned_acl_s3cmd() {
|
||||
record_command "put-bucket-acl" "client:s3cmd"
|
||||
if [[ $# -ne 2 ]]; then
|
||||
log 2 "put bucket acl command requires bucket name, permission"
|
||||
return 1
|
||||
@@ -95,7 +92,6 @@ put_bucket_canned_acl() {
|
||||
log 2 "'put bucket canned acl' command requires bucket name, canned ACL"
|
||||
return 1
|
||||
fi
|
||||
record_command "put-bucket-acl" "client:s3api"
|
||||
if ! error=$(send_command aws --no-verify-ssl s3api put-bucket-acl --bucket "$1" --acl "$2" 2>&1); then
|
||||
log 2 "error re-setting bucket acls: $error"
|
||||
return 1
|
||||
@@ -108,7 +104,6 @@ put_bucket_canned_acl_with_user() {
|
||||
log 2 "'put bucket canned acl with user' command requires bucket name, canned ACL, username, password"
|
||||
return 1
|
||||
fi
|
||||
record_command "put-bucket-acl" "client:s3api"
|
||||
if ! error=$(AWS_ACCESS_KEY_ID="$3" AWS_SECRET_ACCESS_KEY="$4" send_command aws --no-verify-ssl s3api put-bucket-acl --bucket "$1" --acl "$2" 2>&1); then
|
||||
log 2 "error re-setting bucket acls: $error"
|
||||
return 1
|
||||
|
||||
@@ -26,7 +26,6 @@ put_bucket_ownership_controls() {
|
||||
log 2 "'put_bucket_ownership_controls' requires bucket name, rule"
|
||||
return 1
|
||||
fi
|
||||
record_command "put-bucket-ownership-controls" "client:s3api"
|
||||
if ! error=$(send_command aws --no-verify-ssl s3api put-bucket-ownership-controls --bucket "$1" --ownership-controls="Rules=[{ObjectOwnership=$2}]" 2>&1); then
|
||||
log 2 "error putting bucket ownership controls: $error"
|
||||
return 1
|
||||
|
||||
@@ -18,7 +18,6 @@ source ./tests/drivers/params.sh
|
||||
|
||||
put_bucket_policy() {
|
||||
log 6 "put_bucket_policy '$1' '$2' '$3'"
|
||||
record_command "put-bucket-policy" "client:$1"
|
||||
if ! check_param_count "put_bucket_policy" "command type, bucket, policy file" 3 $#; then
|
||||
return 1
|
||||
fi
|
||||
@@ -50,7 +49,6 @@ put_bucket_policy() {
|
||||
}
|
||||
|
||||
put_bucket_policy_with_user() {
|
||||
record_command "put-bucket-policy" "client:s3api"
|
||||
if ! check_param_count "put_bucket_policy_with_user" "bucket, policy file, username, password" 4 $#; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -22,7 +22,6 @@ put_bucket_tagging() {
|
||||
fi
|
||||
local error
|
||||
local result=0
|
||||
record_command "put-bucket-tagging" "client:$1"
|
||||
if [[ $1 == 's3api' ]]; then
|
||||
error=$(send_command aws --no-verify-ssl s3api put-bucket-tagging --bucket "$2" --tagging "TagSet=[{Key=$3,Value=$4}]") || result=$?
|
||||
elif [[ $1 == 'mc' ]]; then
|
||||
@@ -41,7 +40,6 @@ put_bucket_tagging() {
|
||||
put_bucket_tagging_with_user() {
|
||||
log 6 "put_bucket_tagging_with_user"
|
||||
assert [ $# -eq 5 ]
|
||||
record_command "put-bucket-tagging" "client:$1"
|
||||
if ! error=$(AWS_ACCESS_KEY_ID="$4" AWS_SECRET_ACCESS_KEY="$5" send_command aws --no-verify-ssl s3api put-bucket-tagging --bucket "$1" --tagging "TagSet=[{Key=$2,Value=$3}]"); then
|
||||
log 2 "error putting bucket tagging: $error"
|
||||
return 1
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
put_bucket_versioning() {
|
||||
record_command "put-bucket-versioning" "client:s3api"
|
||||
if [[ $# -ne 3 ]]; then
|
||||
log 2 "put bucket versioning command requires command type, bucket name, 'Enabled' or 'Suspended'"
|
||||
return 1
|
||||
|
||||
@@ -18,7 +18,6 @@ source ./tests/report.sh
|
||||
|
||||
put_object() {
|
||||
log 6 "put_object"
|
||||
record_command "put-object" "client:$1"
|
||||
if [ $# -ne 4 ]; then
|
||||
log 2 "put object command requires command type, source, destination bucket, destination key"
|
||||
return 1
|
||||
@@ -48,7 +47,6 @@ put_object() {
|
||||
}
|
||||
|
||||
put_object_with_user() {
|
||||
record_command "put-object" "client:$1"
|
||||
if [ $# -ne 6 ]; then
|
||||
log 2 "put object command requires command type, source, destination bucket, destination key, aws ID, aws secret key"
|
||||
return 1
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
put_object_legal_hold() {
|
||||
record_command "put-object-legal-hold" "client:s3api"
|
||||
if ! check_param_count "put_object_legal_hold" "client, bucket, key, hold status ('ON' or 'OFF')" 4 $#; then
|
||||
return 1
|
||||
fi
|
||||
@@ -49,7 +48,6 @@ put_object_legal_hold_rest() {
|
||||
}
|
||||
|
||||
put_object_legal_hold_version_id() {
|
||||
record_command "put-object-legal-hold" "client:s3api"
|
||||
if ! check_param_count "put_object_legal_hold_version_id" "bucket, key, version ID, hold status ('ON' or 'OFF')" 4 $#; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
put_object_retention() {
|
||||
record_command "put-object-retention" "client:s3api"
|
||||
if [[ $# -ne 4 ]]; then
|
||||
log 2 "'put object retention' command requires bucket, key, retention mode, retention date"
|
||||
return 1
|
||||
|
||||
@@ -22,7 +22,6 @@ put_object_tagging() {
|
||||
fi
|
||||
local error
|
||||
local result
|
||||
record_command "put-object-tagging" "client:$1"
|
||||
if [[ $1 == 's3api' ]]; then
|
||||
error=$(send_command aws --no-verify-ssl s3api put-object-tagging --bucket "$2" --key "$3" --tagging "TagSet=[{Key=$4,Value=$5}]" 2>&1) || result=$?
|
||||
elif [[ $1 == 'mc' ]]; then
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
select_object_content() {
|
||||
record_command "select-object-content" "client:s3api"
|
||||
if [[ $# -ne 7 ]]; then
|
||||
log 2 "'select object content' command requires bucket, key, expression, expression type, input serialization, output serialization, outfile"
|
||||
return 1
|
||||
|
||||
@@ -32,7 +32,6 @@ upload_part_with_user() {
|
||||
return 1
|
||||
fi
|
||||
local etag_json
|
||||
record_command "upload-part" "client:s3api"
|
||||
if ! etag_json=$(AWS_ACCESS_KEY_ID="$6" AWS_SECRET_ACCESS_KEY="$7" send_command aws --no-verify-ssl s3api upload-part --bucket "$1" --key "$2" --upload-id "$3" --part-number "$5" --body "$4-$(($5-1))" 2>&1); then
|
||||
log 2 "Error uploading part $5: $etag_json"
|
||||
return 1
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
upload_part_copy() {
|
||||
record_command "upload-part-copy" "client:s3api"
|
||||
if [ $# -ne 5 ]; then
|
||||
log 2 "upload multipart part copy function must have bucket, key, upload ID, file name, part number"
|
||||
return 1
|
||||
@@ -32,7 +31,6 @@ upload_part_copy() {
|
||||
}
|
||||
|
||||
upload_part_copy_with_range() {
|
||||
record_command "upload-part-copy" "client:s3api"
|
||||
if [ $# -ne 6 ]; then
|
||||
log 2 "upload multipart part copy function must have bucket, key, upload ID, file name, part number, range"
|
||||
return 1
|
||||
|
||||
@@ -259,7 +259,6 @@ get_go_params() {
|
||||
if [[ "$param" == "--" ]]; then
|
||||
return 1
|
||||
fi
|
||||
log 5 "param: $param"
|
||||
echo "$param"
|
||||
done
|
||||
return 0
|
||||
|
||||
@@ -16,101 +16,6 @@
|
||||
|
||||
source ./tests/drivers/params.sh
|
||||
|
||||
check_and_create_database() {
|
||||
# Define SQL commands to create a table
|
||||
SQL_CREATE_TABLE="CREATE TABLE IF NOT EXISTS entries (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
command TEXT NOT NULL,
|
||||
client TEXT NOT NULL,
|
||||
count INTEGER DEFAULT 1,
|
||||
UNIQUE(command, client)
|
||||
);"
|
||||
|
||||
# Execute the SQL commands to create the database and table
|
||||
sqlite3 "$COVERAGE_DB" <<EOF
|
||||
$SQL_CREATE_TABLE
|
||||
.exit
|
||||
EOF
|
||||
log 5 "Database '$COVERAGE_DB' and table 'entries' created successfully."
|
||||
}
|
||||
|
||||
record_command() {
|
||||
if [ -z "$COVERAGE_DB" ]; then
|
||||
log 5 "no coverage db set, not recording"
|
||||
return 0
|
||||
fi
|
||||
if [[ $# -lt 1 ]]; then
|
||||
log 2 "'record command' requires at least command name"
|
||||
return 1
|
||||
fi
|
||||
check_and_create_database
|
||||
log 5 "command to record: $1"
|
||||
client=""
|
||||
#role="root"
|
||||
for arg in "${@:2}"; do
|
||||
log 5 "Argument: $arg"
|
||||
if [[ $arg != *":"* ]]; then
|
||||
log 3 "'$arg' must contain colon to record client"
|
||||
continue
|
||||
fi
|
||||
header=$(echo "$arg" | awk -F: '{print $1}')
|
||||
case $header in
|
||||
"client")
|
||||
client=$(echo "$arg" | awk -F: '{print $2}')
|
||||
;;
|
||||
*)
|
||||
log 3 "unrecognized header: $client"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if ! error=$(sqlite3 "$COVERAGE_DB" "INSERT INTO entries (command, client, count) VALUES(\"$1\", \"$client\", 1) ON CONFLICT(command, client) DO UPDATE SET count = count + 1" 2>&1); then
|
||||
log 2 "error in sqlite statement: $error"
|
||||
fi
|
||||
}
|
||||
|
||||
record_result() {
|
||||
if [ -z "$COVERAGE_DB" ]; then
|
||||
log 5 "no coverage db set, not recording"
|
||||
return 0
|
||||
fi
|
||||
# Define SQL commands to create a table
|
||||
SQL_CREATE_TABLE="CREATE TABLE IF NOT EXISTS results (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
command TEXT NOT NULL,
|
||||
client TEXT,
|
||||
count INTEGER,
|
||||
pass INTEGER DEFAULT 1,
|
||||
UNIQUE(command, client)
|
||||
);"
|
||||
# Execute the SQL commands to create the database and table
|
||||
sqlite3 "$COVERAGE_DB" <<EOF
|
||||
$SQL_CREATE_TABLE
|
||||
.exit
|
||||
EOF
|
||||
|
||||
RESULT=$(sqlite3 "$COVERAGE_DB" "SELECT name FROM sqlite_master WHERE type='table' AND name='entries';")
|
||||
if [ -z "$RESULT" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Iterate over each command in the entries table
|
||||
while IFS="|" read -r command client count; do
|
||||
if [[ $BATS_TEST_STATUS -eq 0 ]]; then
|
||||
# Test passed
|
||||
sqlite3 "$COVERAGE_DB" "INSERT INTO results (command, client, count) VALUES ('$command', '$client', '$count')
|
||||
ON CONFLICT(command, client) DO UPDATE SET count = count + $count;"
|
||||
else
|
||||
# Test failed
|
||||
sqlite3 "$COVERAGE_DB" "INSERT INTO results (command, client, count, pass) VALUES ('$command', '$client', '$count', 0)
|
||||
ON CONFLICT(command, client) DO UPDATE SET count = count + $count;"
|
||||
fi
|
||||
done < <(sqlite3 "$COVERAGE_DB" "SELECT command, client, count FROM entries;")
|
||||
|
||||
sqlite3 "$COVERAGE_DB" "DROP TABLE entries;"
|
||||
|
||||
log 5 "Database '$COVERAGE_DB' and table 'entries' created successfully."
|
||||
}
|
||||
|
||||
get_curl_method() {
|
||||
if ! check_param_count_v2 "command string" 1 $#; then
|
||||
return 1
|
||||
|
||||
@@ -107,9 +107,6 @@ post_versity_cleanup() {
|
||||
echo "$BATS_TEST_NAME: ${total_time}s" >> "$TIME_LOG"
|
||||
fi
|
||||
fi
|
||||
if [[ -n "$COVERAGE_DB" ]]; then
|
||||
record_result
|
||||
fi
|
||||
if [[ "$BATS_TEST_COMPLETED" -ne 1 ]]; then
|
||||
if [[ -e "$COMMAND_LOG" ]]; then
|
||||
cat "$COMMAND_LOG"
|
||||
|
||||
Reference in New Issue
Block a user