From c0e6a08e1e75c0c21f1d905b854aab7c3521ada5 Mon Sep 17 00:00:00 2001 From: Luke McCrone Date: Tue, 13 Jan 2026 16:12:59 -0300 Subject: [PATCH] test: s3cmd - different regions, skips removal --- tests/commands/get_bucket_location.sh | 2 +- tests/commands/get_object.sh | 2 +- tests/commands/head_bucket.sh | 2 +- tests/commands/list_objects.sh | 6 ++++-- .../not_implemented/not_implemented_rest.sh | 3 ++- tests/generate_matrix.sh | 2 +- tests/setup.sh | 1 + tests/test_rest_create_bucket.sh | 6 ------ tests/test_rest_get_bucket_location.sh | 3 --- tests/test_rest_get_bucket_policy_status.sh | 6 ------ tests/test_rest_get_object_tagging.sh | 6 ------ tests/test_rest_list_buckets.sh | 14 +------------- tests/test_rest_list_object_versions.sh | 3 --- tests/test_rest_put_bucket_policy.sh | 3 --- tests/test_rest_put_object.sh | 19 ++----------------- tests/test_s3api_bucket.sh | 3 --- tests/test_s3cmd.sh | 3 --- 17 files changed, 14 insertions(+), 70 deletions(-) diff --git a/tests/commands/get_bucket_location.sh b/tests/commands/get_bucket_location.sh index 411d9fda..46bbc59b 100644 --- a/tests/commands/get_bucket_location.sh +++ b/tests/commands/get_bucket_location.sh @@ -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 diff --git a/tests/commands/get_object.sh b/tests/commands/get_object.sh index bae55096..36c70b44 100644 --- a/tests/commands/get_object.sh +++ b/tests/commands/get_object.sh @@ -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 diff --git a/tests/commands/head_bucket.sh b/tests/commands/head_bucket.sh index 7094e752..a42e5736 100644 --- a/tests/commands/head_bucket.sh +++ b/tests/commands/head_bucket.sh @@ -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 diff --git a/tests/commands/list_objects.sh b/tests/commands/list_objects.sh index 61b9bc5e..6c9e5862 100644 --- a/tests/commands/list_objects.sh +++ b/tests/commands/list_objects.sh @@ -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 diff --git a/tests/drivers/not_implemented/not_implemented_rest.sh b/tests/drivers/not_implemented/not_implemented_rest.sh index 1444d18f..b3938179 100644 --- a/tests/drivers/not_implemented/not_implemented_rest.sh +++ b/tests/drivers/not_implemented/not_implemented_rest.sh @@ -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 diff --git a/tests/generate_matrix.sh b/tests/generate_matrix.sh index 5e7b87f5..72ee9ab4 100755 --- a/tests/generate_matrix.sh +++ b/tests/generate_matrix.sh @@ -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" diff --git a/tests/setup.sh b/tests/setup.sh index c3cafafe..894e087b 100644 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -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 diff --git a/tests/test_rest_create_bucket.sh b/tests/test_rest_create_bucket.sh index f2362ccf..ae28027e 100755 --- a/tests/test_rest_create_bucket.sh +++ b/tests/test_rest_create_bucket.sh @@ -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 diff --git a/tests/test_rest_get_bucket_location.sh b/tests/test_rest_get_bucket_location.sh index 006a7d79..30e55015 100755 --- a/tests/test_rest_get_bucket_location.sh +++ b/tests/test_rest_get_bucket_location.sh @@ -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'" diff --git a/tests/test_rest_get_bucket_policy_status.sh b/tests/test_rest_get_bucket_policy_status.sh index 010f65a5..6a810446 100755 --- a/tests/test_rest_get_bucket_policy_status.sh +++ b/tests/test_rest_get_bucket_policy_status.sh @@ -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" diff --git a/tests/test_rest_get_object_tagging.sh b/tests/test_rest_get_object_tagging.sh index e2a98923..4443a009 100755 --- a/tests/test_rest_get_object_tagging.sh +++ b/tests/test_rest_get_object_tagging.sh @@ -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" diff --git a/tests/test_rest_list_buckets.sh b/tests/test_rest_list_buckets.sh index a7e00f96..cd708bf1 100755 --- a/tests/test_rest_list_buckets.sh +++ b/tests/test_rest_list_buckets.sh @@ -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 } diff --git a/tests/test_rest_list_object_versions.sh b/tests/test_rest_list_object_versions.sh index 9304741f..0d3de68d 100755 --- a/tests/test_rest_list_object_versions.sh +++ b/tests/test_rest_list_object_versions.sh @@ -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" diff --git a/tests/test_rest_put_bucket_policy.sh b/tests/test_rest_put_bucket_policy.sh index b7de9e75..7741c7ed 100755 --- a/tests/test_rest_put_bucket_policy.sh +++ b/tests/test_rest_put_bucket_policy.sh @@ -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" diff --git a/tests/test_rest_put_object.sh b/tests/test_rest_put_object.sh index 253e4875..e5ea42a5 100755 --- a/tests/test_rest_put_object.sh +++ b/tests/test_rest_put_object.sh @@ -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" diff --git a/tests/test_s3api_bucket.sh b/tests/test_s3api_bucket.sh index afb314fa..f65c727a 100755 --- a/tests/test_s3api_bucket.sh +++ b/tests/test_s3api_bucket.sh @@ -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" } diff --git a/tests/test_s3cmd.sh b/tests/test_s3cmd.sh index 8bac003b..a6b06b9a 100755 --- a/tests/test_s3cmd.sh +++ b/tests/test_s3cmd.sh @@ -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" }