Skip to content

Commit

Permalink
Folkzb fix versioning 6h (#246)
Browse files Browse the repository at this point in the history
* fix 64 outputs

* fix 49 add retry

* fix 64 outputs equals
  • Loading branch information
folkzb authored Dec 10, 2024
1 parent 1f077a3 commit c1db9e6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions spec/049_delete-object-with-versions_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Describe 'Delete object with versions:' category:"ObjectVersioning"
aws --profile $profile s3 cp $file1_name s3://$test_bucket_name > /dev/null
case "$client" in
"aws-s3api" | "aws" | "aws-s3")
When run aws --profile $profile s3 rm s3://$test_bucket_name/$file1_name
When run bash ./spec/retry_command.sh "aws --profile $profile s3 rm s3://$test_bucket_name/$file1_name"
The output should include "delete"
;;
"rclone")
When run rclone delete $profile:$test_bucket_name/$file1_name
When run bash ./spec/retry_command.sh "rclone delete $profile:$test_bucket_name/$file1_name"
The output should include ""
;;
"mgc")
Expand Down
12 changes: 5 additions & 7 deletions spec/064_delete-versioned-object_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ Describe "setup 064" category:"ObjectManagement" id:"064"
bucket_name=$(get_test_bucket_name)
When run create_bucket $profile $client $bucket_name
The status should be success
The output should include "$bucket_name"
The output should include "$(create_bucket_success_output $profile $client $bucket_name)"
End
Example "enable versioning on test bucket of profile $1 using $2"
profile=$1
client=$2
bucket_name=$(get_test_bucket_name)
When run enable_versioning $profile $client $bucket_name
The status should be success
The output should include "$bucket_name"
The output should include "$(enable_versioning_success_output $profile $client $bucket_name)"
End
Example "upload object on versioning-enabled bucket of profile $1 using $2"
profile=$1
Expand All @@ -45,8 +45,7 @@ Describe "setup 064" category:"ObjectManagement" id:"064"
key=$(get_uploaded_key "$local_file")
When run put_object $profile $client $bucket_name $local_file $key
The status should be success
The output should include "$bucket_name/$key"
The output should include "$local_file"
The output should include "$(put_object_success_output $profile $client $bucket_name $local_file $key)"
End
Example "overwrite object on versioning-enabled bucket of profile $1 using $2"
profile=$1
Expand All @@ -56,8 +55,7 @@ Describe "setup 064" category:"ObjectManagement" id:"064"
other_local_file="README.md"
When run put_object $profile $client $bucket_name $other_local_file $key
The status should be success
The output should include "$bucket_name/$key"
The output should include "$local_file"
The output should include "$(put_object_success_output $profile $client $bucket_name $local_file $key)"
End
Example "list versions of test bucket on profile $1 using $2 should have versions"
profile=$1
Expand Down Expand Up @@ -122,7 +120,7 @@ Describe "Delete versioned object" category:"ObjectManagement" id:"064"
;;
"mgc")
mgc workspace set $profile > /dev/null
When run bash ./spec/retry_command.sh "mgc object-storage objects versions --dst="$bucket_name" --cli.output json --raw"
When run bash ./spec/retry_command.sh "mgc object-storage objects versions --dst="$bucket_name" --output json --raw"
# When run mgc object-storage objects versions --dst="$bucket_name" --cli.output json --raw
The status should be success
The output should not include "\"isLatest\": true,"
Expand Down
10 changes: 5 additions & 5 deletions spec/064_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ create_bucket_success_output(){
"rclone")
echo "" ;;
"mgc")
echo "Created bucket $bucket_name" ;;
echo "$bucket_name" ;;
esac
}
enable_versioning(){
Expand Down Expand Up @@ -53,7 +53,7 @@ enable_versioning_success_output(){
"rclone")
echo "Enabled" ;;
"mgc")
echo "Enabled versioning for $bucket_name" ;;
echo "$bucket_name" ;;
esac
}
put_object(){
Expand Down Expand Up @@ -87,7 +87,7 @@ put_object_success_output(){
"rclone")
echo "" ;;
"mgc")
echo "Uploaded file $local_file to $bucket_name/$key"
echo "$bucket_name/$key"
esac
}
list_object_versions(){
Expand All @@ -101,7 +101,7 @@ list_object_versions(){
rclone --s3-versions ls $profile:$bucket_name ;;
"mgc")
mgc workspace set $profile > /dev/null
mgc object-storage objects versions --dst="$bucket_name" --cli.output json;;
mgc object-storage objects versions --dst="$bucket_name" --output json;;
esac
}
list_object_versions_success_output(){
Expand All @@ -115,6 +115,6 @@ list_object_versions_success_output(){
"rclone")
echo "$key-v";;
"mgc")
echo "\"Key\": \"$key\",";;
echo "$key";;
esac
}

0 comments on commit c1db9e6

Please sign in to comment.