Closed alexvanin closed 2 years ago
Add a set of tests to check all these operations. Based on aws cli commands.
# Bucket creation 1.1 aws s3api create-bucket --bucket new-bucket 1.2 aws s3api list-buckets # Object upload 2.1 aws s3api put-object --bucket new-bucket --key new-object --body data.txt 2.2 aws s3api head-object --bucket new-bucket --key new-object # Directory sync 3.1 aws s3 sync . s3://new-bucket 3.2 aws s3api list-objects --bucket new-bucket # Object operations 4.1 aws s3api put-object --bucket new-bucket --key simple-object --body data.txt 4.2 aws s3api get-object --bucket new-bucket --key simple-object data-out.txt 4.3 aws s3api copy-object --copy-source new-bucket/simple-object --bucket new-bucket --key simple-object-copy 4.4 aws s3api get-object --bucket new-bucket --key simple-object-copy data-out-copy.txt 4.5 aws s3api delete-object --bucket new-bucket --key simple-object 4.6 aws s3api head-object --bucket new-bucket --key simple-object # List objects (from previous uploads) 5.1 aws s3api list-objects --bucket new-bucket 5.2 aws s3api list-objects-v2 --bucket new-bucket # Multipart upload ## Aborted upload 6.1.1 aws s3api create-multipart-upload --bucket new-bucket --key multipart-key 6.1.2 aws s3api list-multipart-uploads --bucket new-bucket 6.1.3 aws s3api abort-multipart-upload --bucket new-bucket --key multipart-key --upload-id [..] 6.1.4 aws s3api list-multipart-uploads --bucket new-bucket ## Successful upload 6.2.1 aws s3api create-multipart-upload --bucket new-bucket --key multipart-key2 6.2.2 aws s3api upload-part --bucket new-bucket --key multipart-key2 --upload-id [..] --part-number 1 --body file1.txt 6.2.3 aws s3api list-parts --bucket new-bucket --key multipart-key2 --upload-id [..] 6.2.4 aws s3api complete-multipart-upload --bucket new-bucket --key multipart-key2 --upload-id [..] --multipart-upload file://parts.json 6.2.5 aws s3api get-object --bucket new-bucket --key multipart-key2 multipart-object.txt # Versioning ## Prepare bucket versioning 7.1.1 aws s3api create-bucket --bucket versioned-bucket 7.1.2 aws s3api put-bucket-versioning --bucket versioned-bucket --versioning-configuration Status=Enabled 7.1.3 aws s3api get-bucket-versioning --bucket versioned-bucket ## Upload versions 7.2.1 aws s3api put-object --bucket versioned-bucket --key versioned-object --body data.txt 7.2.2 aws s3api put-object --bucket versioned-bucket --key versioned-object --body data_new.txt ## Delete object and expect head error 7.3.1 aws s3api delete-object --bucket versioned-bucket --key versioned-object 7.3.2 aws s3api head-object --bucket versioned-bucket --key versioned-object ## Get versions including removed version 7.4.1 aws s3api list-object-versions --bucket versioned-bucket 7.4.2 aws s3api get-object --bucket versioned-bucket --key versioned-object --version-id [..] data1.txt 7.4.3 aws s3api get-object --bucket versioned-bucket --key versioned-object --version-id [..] data2.txt ## Return delete marker to restore an object 7.5.1 aws s3api delete-object --bucket versioned-bucket --key versioned-object --version-id [..] 7.5.2 aws s3api get-object --bucket versioned-bucket --key versioned-object data-out.txt # Object tagging ## Prepare bucket tagging 8.1.1 aws s3api create-bucket --bucket bucket-for-tag 8.1.2 aws s3api put-bucket-tagging --bucket bucket-for-tag --tagging '{"TagSet":[{"Key":"some-key","Value":"some-value"}]}' 8.1.3 aws s3api get-bucket-tagging --bucket bucket-for-tag ## Remove bucket tagging 8.2.1 aws s3api delete-bucket-tagging --bucket bucket-for-tag 8.2.2 aws s3api get-bucket-tagging --bucket bucket-for-tag ## Add object tags 8.2.1 aws s3api put-object --bucket bucket-for-tag --key object-for-tag --body data.txt 8.2.2 aws s3api put-object-tagging --bucket bucket-for-tag --key object-for-tag --tagging '{"TagSet":[{"Key":"some-object-key","Value":"some-object-value"}]}' 8.2.3 aws s3api get-object-tagging --bucket bucket-for-tag --key object-for-tag ## Update object tags 8.3.1 aws s3api put-object-tagging --bucket bucket-for-tag --key object-for-tag --tagging '{"TagSet":[{"Key":"some-new-object-key","Value":"some-new-object-value"}]}' 8.3.2 aws s3api get-object-tagging --bucket bucket-for-tag --key object-for-tag ## Delete object tags 8.4.1 aws s3api delete-object-tagging --bucket bucket-for-tag --key object-for-tag 8.4.2 aws s3api get-object-tagging --bucket bucket-for-tag --key object-for-tag # Object attributes ## Unversioned object attributes 9.1.1 aws s3api create-bucket --bucket bucket-for-attrs 9.1.2 aws s3api put-object --key object-for-attrs --body data.txt --bucket bucket-for-attrs 9.1.3 aws s3api get-object-attributes --key object-for-attrs --bucket bucket-for-attrs --object-attributes ETag 9.1.4 aws s3api get-object-attributes --key object-for-attrs --bucket bucket-for-attrs --object-attributes ObjectSize,StorageClass ## Versioned object attributes 9.2.1 aws s3api put-bucket-versioning --versioning-configuration Status=Enabled --bucket bucket-for-attrs 9.2.2 aws s3api put-object --key object-for-attrs --body data2.txt --bucket bucket-for-attrs 9.2.3 aws s3api get-object-attributes --key object-for-attrs --bucket bucket-for-attrs --object-attributes ETag --version-id [..] ## Multipart object attributes 9.3.1 aws s3api create-multipart-upload --bucket bucket-for-attrs --key mp-for-attrs 9.3.2 aws s3api upload-part --bucket bucket-for-attrs --key mp-for-attrs --upload-id [..] --body multipart1.txt --part-number 1 9.3.3 aws s3api upload-part --bucket bucket-for-attrs --key mp-for-attrs --upload-id [..] --body multipart2.txt --part-number 2 9.3.4 aws s3api upload-part --bucket bucket-for-attrs --key mp-for-attrs --upload-id [..] --body multipart3.txt --part-number 3 9.3.5 aws s3api list-parts --bucket bucket-for-attrs --key mp-for-attrs --upload-id [..] 9.3.6 aws s3api complete-multipart-upload --multipart-upload 'Parts=[{ETag=..,PartNumber=1},{ETag=..,PartNumber=2},{ETag=..,PartNumber=3}]' --bucket bucket-for-attrs --key mp-for-attrs --upload-id [..] 9.3.7 aws s3api get-object-attributes --key mp-for-attrs --bucket bucket-for-attrs --object-attributes ObjectParts 9.3.8 aws s3api get-object-attributes --key mp-for-attrs --bucket bucket-for-attrs --object-attributes ObjectParts --max-parts 2 9.3.9 aws s3api get-object-attributes --key mp-for-attrs --bucket bucket-for-attrs --object-attributes ObjectParts --part-number-marker 3 # Bucket removal 10.1 aws s3api create-bucket --bucket bucket-for-delete 10.2 aws s3api head-bucket --bucket bucket-for-delete 10.3 aws s3api delete-bucket --bucket bucket-for-delete 10.4 aws s3api head-bucket --bucket bucket-for-delete
Add a set of tests to check all these operations. Based on aws cli commands.
TODO
Tests