Skip to content

Commit

Permalink
fix some tests and skip (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
folkzb authored Dec 11, 2024
1 parent 5908029 commit f1862ed
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 21 deletions.
6 changes: 5 additions & 1 deletion spec/041_set-the-versioning-for-a-bucket-with-acl_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ Describe 'Set the versioning for a bucket with ACL:' category:"ObjectVersioning"
test_bucket_name="$bucket_name-$client-$profile"
printf "\n$test_bucket_name" >> ./report/buckets_to_delete.txt
id=$(aws s3api --profile $profile-second list-buckets | jq -r '.Owner.ID')
Skip if "No such a "$profile-second" user" is_variable_null "$id"
#Skip if "No such a "$profile-second" user" is_variable_null "$id"
if [ "$id" = "" ]; then
Skip "No such a "$profile-second" user"
return 0
fi
aws --profile $profile s3 mb s3://$test_bucket_name > /dev/null
aws s3api --profile $profile put-bucket-acl --bucket $test_bucket_name --grant-write id=$id --grant-read id=$id > /dev/null
case "$client" in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ Describe 'Upload object to versioning in the private acl bucket:' category:"Obje
test_bucket_name="$bucket_name-$client-$profile"
printf "\n$test_bucket_name" >> ./report/buckets_to_delete.txt
id=$(aws s3api --profile $profile-second list-buckets | jq -r '.Owner.ID')
Skip if "No such a "$profile-second" user" is_variable_null "$id"
#Skip if "No such a "$profile-second" user" is_variable_null "$id"
if [ "$id" = "" ]; then
Skip "No such a "$profile-second" user"
return 0
fi
aws --profile $profile s3 mb s3://$test_bucket_name > /dev/null
aws s3api --profile $profile put-bucket-acl --bucket $test_bucket_name --grant-write id=$id --grant-read id=$id > /dev/null
aws s3api --profile $profile put-bucket-versioning --bucket $test_bucket_name --versioning-configuration Status=Enabled > /dev/null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ Describe 'Download object to versioning in the public bucket:' category:"ObjectV
profile=$1
client=$2
test_bucket_name="$bucket_name-$client-$profile"
id=$(aws s3api --profile $profile-second list-buckets | jq -r '.Owner.ID')
if [ "$id" = "" ]; then
Skip "No such a "$profile-second" user"
return 0
fi
printf "\n$test_bucket_name" >> ./report/buckets_to_delete.txt
aws --profile $profile s3api create-bucket --bucket $test_bucket_name --acl public-read > /dev/null
aws s3api --profile $profile put-bucket-versioning --bucket $test_bucket_name --versioning-configuration Status=Enabled > /dev/null
Expand All @@ -32,11 +37,9 @@ Describe 'Download object to versioning in the public bucket:' category:"ObjectV
;;
"mgc")
mgc workspace set $profile-second > /dev/null
When run bash ./spec/retry_command.sh "mgc object-storage objects download --src $test_bucket_name/$file1_name --obj-version $version --dst ./$file1_name-2 --raw"
# When run mgc object-storage objects download --src $test_bucket_name/$file1_name --obj-version $version --dst ./$file1_name-2 --raw
When run mgc object-storage objects download --src $test_bucket_name/$file1_name --obj-version $version --dst ./$file1_name-2 --raw
The status should be failure
#The stderr should include "403"
The output should include "403"
The stderr should include "403"
;;
esac
aws --profile $profile s3api delete-objects --bucket $test_bucket_name --delete "$(aws --profile $profile s3api list-object-versions --bucket $test_bucket_name| jq '{Objects: [.Versions[] | {Key:.Key, VersionId : .VersionId}], Quiet: false}')" > /dev/null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Describe 'Download object to versioning in the private ACL bucket:' category:"Ob
test_bucket_name="$bucket_name-$client-$profile"
printf "\n$test_bucket_name" >> ./report/buckets_to_delete.txt
id=$(aws s3api --profile $profile-second list-buckets | jq -r '.Owner.ID')
Skip if "No such a "$profile-second" user" is_variable_null "$id"
if [ "$id" = "" ]; then
Skip "No such a "$profile-second" user"
return 0
fi
aws --profile $profile s3api create-bucket --bucket $test_bucket_name > /dev/null
aws s3api --profile $profile put-bucket-acl --bucket $test_bucket_name --grant-write id=$id --grant-read id=$id > /dev/null
aws s3api --profile $profile put-bucket-versioning --bucket $test_bucket_name --versioning-configuration Status=Enabled > /dev/null
Expand All @@ -40,11 +43,9 @@ Describe 'Download object to versioning in the private ACL bucket:' category:"Ob
;;
"mgc")
mgc workspace set $profile-second > /dev/null
When run bash ./spec/retry_command.sh "mgc object-storage objects download --src $test_bucket_name/$file1_name --obj-version $version --dst ./$file1_name-2 --raw"
# When run mgc object-storage objects download --src $test_bucket_name/$file1_name --obj-version $version --dst ./$file1_name-2 --raw
When run mgc object-storage objects download --src $test_bucket_name/$file1_name --obj-version $version --dst ./$file1_name-2 --raw
The status should be failure
#The stderr should include "403"
The output should include "403"
The stderr should include "403"
;;
esac
aws --profile $profile s3api delete-objects --bucket $test_bucket_name --delete "$(aws --profile $profile s3api list-object-versions --bucket $test_bucket_name| jq '{Objects: [.Versions[] | {Key:.Key, VersionId : .VersionId}], Quiet: false}')" > /dev/null
Expand Down
2 changes: 1 addition & 1 deletion spec/049_delete-object-with-versions_spec.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Describe 'Delete object with versions:' category:"ObjectVersioning"
Describe 'Delete object with versions:' category:"Skip"
setup(){
bucket_name="test-049-$(date +%s)"
file1_name="LICENSE"
Expand Down
2 changes: 1 addition & 1 deletion spec/050_delete-bucket-with-objects-with-versions_spec.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Describe 'Delete bucket with objects with versions:' category:"ObjectVersioning"
Describe 'Delete bucket with objects with versions:' category:"Skip"
setup(){
bucket_name="test-050-$(date +%s)"
file1_name="LICENSE"
Expand Down
6 changes: 3 additions & 3 deletions spec/053_upload-files_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Describe 'List Objects' category:"ObjectManagement" id:"061"
;;
"mgc")
mgc workspace set $profile > /dev/null
When run bash ./spec/retry_command.sh "mgc object-storage objects list --dst="$BUCKET_NAME" --raw"
When run bash ./spec/retry_command.sh "mgc object-storage objects list --dst="$BUCKET_NAME" --output json"
# When run mgc object-storage objects list --dst="$BUCKET_NAME" --raw
The status should be success
for file in $FILES;do
Expand Down Expand Up @@ -251,7 +251,7 @@ Describe 'Delete' category:"ObjectManagement"
When run rclone delete "$profile:$BUCKET_NAME" --include "{$rclone_objects}" --dump headers
for object_key in $objects; do
The status should be success
The error should include "$object_key: Deleted"
The error should include "200 OK"
done
;;
"mgc")
Expand All @@ -263,7 +263,7 @@ Describe 'Delete' category:"ObjectManagement"
mgc_objects+='"}'
done
mgc_objects+="]"
When run bash ./spec/retry_command.sh "mgc object-storage objects delete-all "$BUCKET_NAME" --no-confirm --filter="$mgc_objects" --raw"
When run mgc object-storage objects delete-all "$BUCKET_NAME" --no-confirm --filter="$mgc_objects" --raw
# When run mgc object-storage objects delete-all "$BUCKET_NAME" --no-confirm --filter="$mgc_objects" --raw
The status should be success
The output should be blank
Expand Down
10 changes: 5 additions & 5 deletions spec/064_delete-versioned-object_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ get_test_bucket_name(){
get_uploaded_key(){
echo "test--$profile--$client--$1--$UNIQUE_SUFIX"
}
Describe "setup 064" category:"ObjectManagement" id:"064"
Describe "setup 064" category:"Skip" id:"064"
Parameters:matrix
$PROFILES
$FILTERED_CLIENTS
Expand Down Expand Up @@ -68,7 +68,7 @@ Describe "setup 064" category:"ObjectManagement" id:"064"
End
End

Describe "Delete versioned object" category:"ObjectManagement" id:"064"
Describe "Delete versioned object" category:"Skip" id:"064"
Parameters:matrix
$PROFILES
$FILTERED_CLIENTS
Expand All @@ -95,8 +95,8 @@ Describe "Delete versioned object" category:"ObjectManagement" id:"064"
When run bash ./spec/retry_command.sh "mgc --debug object-storage objects delete --dst="$bucket_name/$key" --no-confirm --raw"
# When run mgc --debug object-storage objects delete --dst="$bucket_name/$key" --no-confirm --raw
The status should be success
The error should include "$bucket_name?delete="
The error should include "200 OK"
The stdout should include "$bucket_name?delete="
The stdout should include "<Deleted><Key>$key</Key></Deleted>"
;;
esac
End
Expand Down Expand Up @@ -129,7 +129,7 @@ Describe "Delete versioned object" category:"ObjectManagement" id:"064"
End
End

Describe "teardown 064" category:"ObjectManagement" id:"064"
Describe "teardown 064" category:"Skip" id:"064"
Parameters:matrix
$PROFILES
$FILTERED_CLIENTS
Expand Down

0 comments on commit f1862ed

Please sign in to comment.