mirror of
https://github.com/versity/versitygw.git
synced 2026-08-17 20:56:21 +00:00
Merge pull request #1754 from versity/test/diff_region_handling
Test/diff region handling
This commit is contained in:
@@ -62,7 +62,7 @@ get_bucket_location_s3cmd() {
|
||||
echo "get bucket location (s3cmd) requires bucket name"
|
||||
return 1
|
||||
fi
|
||||
info=$(send_command s3cmd --no-check-certificate info "s3://$1") || results=$?
|
||||
info=$(send_command s3cmd "${S3CMD_OPTS[@]}" --no-check-certificate info "s3://$1") || results=$?
|
||||
if [[ $results -ne 0 ]]; then
|
||||
log 2 "error getting bucket location: $location"
|
||||
return 1
|
||||
|
||||
@@ -27,7 +27,7 @@ get_object() {
|
||||
elif [[ $1 == 's3api' ]]; then
|
||||
get_object_error=$(send_command aws --no-verify-ssl s3api get-object --bucket "$2" --key "$3" "$4" 2>&1) || exit_code=$?
|
||||
elif [[ $1 == 's3cmd' ]]; then
|
||||
get_object_error=$(send_command s3cmd "${S3CMD_OPTS[@]}" --no-check-certificate get "s3://$2/$3" "$4" 2>&1) || exit_code=$?
|
||||
get_object_error=$(send_command s3cmd "${S3CMD_OPTS[@]}" --no-check-certificate get --force "s3://$2/$3" "$4" 2>&1) || exit_code=$?
|
||||
elif [[ $1 == 'mc' ]]; then
|
||||
get_object_error=$(send_command mc --insecure get "$MC_ALIAS/$2/$3" "$4" 2>&1) || exit_code=$?
|
||||
elif [[ $1 == 'rest' ]]; then
|
||||
|
||||
@@ -31,7 +31,7 @@ head_bucket() {
|
||||
if [[ $1 == 's3api' ]] || [[ $1 == 's3' ]]; then
|
||||
bucket_info=$(send_command aws --no-verify-ssl s3api head-bucket --bucket "$2" 2>&1) || exit_code=$?
|
||||
elif [[ $1 == "s3cmd" ]]; then
|
||||
bucket_info=$(send_command s3cmd --no-check-certificate info "s3://$2" 2>&1) || exit_code=$?
|
||||
bucket_info=$(send_command s3cmd "${S3CMD_OPTS[@]}" --no-check-certificate info "s3://$2" 2>&1) || exit_code=$?
|
||||
elif [[ $1 == 'mc' ]]; then
|
||||
bucket_info=$(send_command mc --insecure stat "$MC_ALIAS"/"$2" 2>&1) || exit_code=$?
|
||||
elif [[ $1 == 'rest' ]]; then
|
||||
|
||||
@@ -44,8 +44,10 @@ list_objects() {
|
||||
fail "invalid command type $1"
|
||||
return 1
|
||||
fi
|
||||
# shellcheck disable=SC2154
|
||||
assert_success "error listing objects: $output"
|
||||
if [ "$list_objects_result" -ne 0 ]; then
|
||||
log 2 "error listing objects: $output"
|
||||
return 1
|
||||
fi
|
||||
|
||||
object_array=()
|
||||
while IFS= read -r line; do
|
||||
|
||||
@@ -22,7 +22,8 @@ send_not_implemented_expect_failure() {
|
||||
log 2 "'send_not_implemented_expect_failure' param count must be multiple of 2 (key/value pairs)"
|
||||
return 1
|
||||
fi
|
||||
if ! curl_command=$(go run ./tests/rest_scripts/generateCommand.go -awsAccessKeyId "$AWS_ACCESS_KEY_ID" -awsSecretAccessKey "$AWS_SECRET_ACCESS_KEY" -url "$AWS_ENDPOINT_URL" "$@" 2>&1); then
|
||||
if ! curl_command=$(go run ./tests/rest_scripts/generateCommand.go -awsAccessKeyId "$AWS_ACCESS_KEY_ID" \
|
||||
-awsSecretAccessKey "$AWS_SECRET_ACCESS_KEY" -awsRegion "$AWS_REGION" -url "$AWS_ENDPOINT_URL" "$@" 2>&1); then
|
||||
log 2 "error: $curl_command"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -36,7 +36,7 @@ check_for_and_load_test_file_and_params() {
|
||||
iam="folder"
|
||||
fi
|
||||
iam_types+=("$iam")
|
||||
if [ $(( idx % 10 )) -eq 0 ]; then
|
||||
if [ $(( idx % 4 )) -eq 0 ]; then
|
||||
region="us-west-1"
|
||||
else
|
||||
region="us-east-1"
|
||||
|
||||
@@ -86,6 +86,7 @@ setup() {
|
||||
S3CMD_OPTS+=(-c "$S3CMD_CONFIG")
|
||||
S3CMD_OPTS+=(--access_key="$AWS_ACCESS_KEY_ID")
|
||||
S3CMD_OPTS+=(--secret_key="$AWS_SECRET_ACCESS_KEY")
|
||||
S3CMD_OPTS+=(--region="$AWS_REGION")
|
||||
export S3CMD_CONFIG S3CMD_OPTS
|
||||
fi
|
||||
|
||||
|
||||
@@ -123,9 +123,6 @@ export RUN_USERS=true
|
||||
}
|
||||
|
||||
@test "REST - CreateBucket - empty location constraint" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1644"
|
||||
fi
|
||||
run send_curl_command_create_bucket_expect_error "400" "InvalidLocationConstraint" "The specified location-constraint is not valid" "-locationConstraint" ""
|
||||
assert_success
|
||||
}
|
||||
@@ -144,9 +141,6 @@ export RUN_USERS=true
|
||||
}
|
||||
|
||||
@test "REST - CreateBucket - fail - us-east-1 with 'us-east-1' location constraint" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1643"
|
||||
fi
|
||||
if [ "$AWS_REGION" != "us-east-1" ]; then
|
||||
skip "only valid for us-east-1 region"
|
||||
fi
|
||||
|
||||
@@ -34,9 +34,6 @@ source ./tests/setup.sh
|
||||
}
|
||||
|
||||
@test "REST - GetBucketLocation - us-east-1 is returned as null" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1643"
|
||||
fi
|
||||
log 5 "AWS_REGION: $AWS_REGION"
|
||||
if [ "$AWS_REGION" != "us-east-1" ]; then
|
||||
skip "test only valid for AWS_REGION of 'us-east-1'"
|
||||
|
||||
@@ -24,9 +24,6 @@ source ./tests/util/util_public_access_block.sh
|
||||
source ./tests/setup.sh
|
||||
|
||||
@test "REST - GetBucketPolicyStatus" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1712"
|
||||
fi
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
assert_success
|
||||
bucket_name="$output"
|
||||
@@ -42,9 +39,6 @@ source ./tests/setup.sh
|
||||
}
|
||||
|
||||
@test "REST - GetBucketPolicyStatus true" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1712"
|
||||
fi
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
assert_success
|
||||
bucket_name="$output"
|
||||
|
||||
@@ -23,9 +23,6 @@ source ./tests/drivers/get_object_tagging/get_object_tagging_rest.sh
|
||||
source ./tests/drivers/put_object/put_object_rest.sh
|
||||
|
||||
@test "REST - GetObjectTagging - no tags" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1686"
|
||||
fi
|
||||
test_file="test_file"
|
||||
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
@@ -40,9 +37,6 @@ source ./tests/drivers/put_object/put_object_rest.sh
|
||||
}
|
||||
|
||||
@test "REST - GetObjectTagging - older version returns version ID" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1693"
|
||||
fi
|
||||
test_file="test_file"
|
||||
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
|
||||
@@ -59,9 +59,6 @@ export RUN_USERS=true
|
||||
}
|
||||
|
||||
@test "REST - very invalid credential string" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1706"
|
||||
fi
|
||||
run send_rest_go_command_expect_error "400" "AuthorizationHeaderMalformed" "the Credential is mal-formed" "-incorrectCredential" "Credentials"
|
||||
assert_success
|
||||
}
|
||||
@@ -72,9 +69,6 @@ export RUN_USERS=true
|
||||
}
|
||||
|
||||
@test "REST - invalid year/month/day" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1706"
|
||||
fi
|
||||
run send_rest_go_command_expect_error "400" "AuthorizationHeaderMalformed" "incorrect date format" "-invalidYearMonthDay"
|
||||
assert_success
|
||||
}
|
||||
@@ -88,17 +82,11 @@ export RUN_USERS=true
|
||||
}
|
||||
|
||||
@test "REST - invalid region" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1706"
|
||||
fi
|
||||
run send_rest_go_command_expect_error "400" "AuthorizationHeaderMalformed" "the region 'us-eest-1' is wrong" "-awsRegion" "us-eest-1"
|
||||
run send_rest_go_command_expect_error "400" "AuthorizationHeaderMalformed" "us-eest-1" "-awsRegion" "us-eest-1"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "REST - invalid service name" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1706"
|
||||
fi
|
||||
run send_rest_go_command_expect_error "400" "AuthorizationHeaderMalformed" "incorrect service" "-serviceName" "s2"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@@ -23,9 +23,6 @@ source ./tests/drivers/list_object_versions/list_object_versions_rest.sh
|
||||
source ./tests/util/util_time.sh
|
||||
|
||||
@test "ListObjectVersions - accidental query of versions on object returns correct error" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1688"
|
||||
fi
|
||||
test_file="test_file"
|
||||
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
|
||||
@@ -22,9 +22,6 @@ source ./tests/drivers/put_bucket_policy/put_bucket_policy_rest.sh
|
||||
source ./tests/setup.sh
|
||||
|
||||
@test "PutBucketPolicy - success returns 204" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1712"
|
||||
fi
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
assert_success
|
||||
bucket_name="$output"
|
||||
|
||||
@@ -116,9 +116,6 @@ export RUN_USERS=true
|
||||
}
|
||||
|
||||
@test "REST - PutObject - If-None-Match - no asterisk" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1708"
|
||||
fi
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
assert_success
|
||||
bucket_name="$output"
|
||||
@@ -132,9 +129,6 @@ export RUN_USERS=true
|
||||
}
|
||||
|
||||
@test "REST - PutObject - If-None-Match - block copy" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1708"
|
||||
fi
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
assert_success
|
||||
bucket_name="$output"
|
||||
@@ -161,17 +155,14 @@ export RUN_USERS=true
|
||||
}
|
||||
|
||||
@test "REST - PutObject - If-Match - file doesn't exist on server" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1709"
|
||||
fi
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
assert_success
|
||||
bucket_name="$output"
|
||||
|
||||
run setup_bucket_v2 "$bucket_name"
|
||||
run setup_bucket_and_file_v2 "$bucket_name" "$test_file"
|
||||
assert_success
|
||||
|
||||
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" \
|
||||
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
|
||||
}
|
||||
@@ -190,9 +181,6 @@ export RUN_USERS=true
|
||||
}
|
||||
|
||||
@test "REST - PutObject - If-Match - correct etag" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1710"
|
||||
fi
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
assert_success
|
||||
bucket_name="$output"
|
||||
@@ -247,9 +235,6 @@ export RUN_USERS=true
|
||||
}
|
||||
|
||||
@test "REST - PutObject - expect continue - success" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1707"
|
||||
fi
|
||||
run get_bucket_name "$BUCKET_ONE_NAME"
|
||||
assert_success
|
||||
bucket_name="$output"
|
||||
|
||||
@@ -96,9 +96,6 @@ export RUN_USERS=true
|
||||
|
||||
# get-bucket-location
|
||||
@test "test_get_bucket_location" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1643"
|
||||
fi
|
||||
test_common_get_bucket_location "s3api"
|
||||
}
|
||||
|
||||
|
||||
@@ -74,9 +74,6 @@ export RUN_USERS=true
|
||||
|
||||
# get-bucket-location
|
||||
@test "test_get_bucket_location" {
|
||||
if [ "$DIRECT" != "true" ]; then
|
||||
skip "https://github.com/versity/versitygw/issues/1643"
|
||||
fi
|
||||
test_common_get_bucket_location "s3cmd"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user