aboutsummaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2022-02-10 17:02:30 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2022-03-07 17:32:07 +0100
commit2ef60b84178ec0d91c5fa534e63ca2b55e51ad67 (patch)
tree44a9c4515394d4035c5d4c816497a5deb71c1f76 /script
parent1e639ec67c72730fda370e1c3dfe9cbba0b4fa63 (diff)
downloadgarage-2ef60b84178ec0d91c5fa534e63ca2b55e51ad67.tar.gz
garage-2ef60b84178ec0d91c5fa534e63ca2b55e51ad67.zip
Functional test for multipart endpoints
Diffstat (limited to 'script')
-rwxr-xr-xscript/test-smoke.sh103
1 files changed, 0 insertions, 103 deletions
diff --git a/script/test-smoke.sh b/script/test-smoke.sh
index ffd0b317..dc9b2d2d 100755
--- a/script/test-smoke.sh
+++ b/script/test-smoke.sh
@@ -143,109 +143,6 @@ fi
# Advanced testing via S3API
if [ -z "$SKIP_AWS" ]; then
- echo "Test for ListParts"
- UPLOAD_ID=$(aws s3api create-multipart-upload --bucket eprouvette --key list-parts | jq -r .UploadId)
- aws s3api list-parts --bucket eprouvette --key list-parts --upload-id $UPLOAD_ID >$CMDOUT
- [ $(jq '.Parts | length' $CMDOUT) == 0 ]
- [ $(jq -r '.StorageClass' $CMDOUT) == 'STANDARD' ] # check that the result is not empty
- ETAG1=$(aws s3api upload-part --bucket eprouvette --key list-parts --upload-id $UPLOAD_ID --part-number 1 --body /tmp/garage.2.rnd | jq .ETag)
- aws s3api list-parts --bucket eprouvette --key list-parts --upload-id $UPLOAD_ID >$CMDOUT
- [ $(jq '.Parts | length' $CMDOUT) == 1 ]
- [ $(jq '.Parts[0].PartNumber' $CMDOUT) == 1 ]
- [ $(jq '.Parts[0].Size' $CMDOUT) == 5242880 ]
- [ $(jq '.Parts[0].ETag' $CMDOUT) == $ETAG1 ]
-
- ETAG2=$(aws s3api upload-part --bucket eprouvette --key list-parts --upload-id $UPLOAD_ID --part-number 3 --body /tmp/garage.3.rnd | jq .ETag)
- ETAG3=$(aws s3api upload-part --bucket eprouvette --key list-parts --upload-id $UPLOAD_ID --part-number 2 --body /tmp/garage.2.rnd | jq .ETag)
- aws s3api list-parts --bucket eprouvette --key list-parts --upload-id $UPLOAD_ID >$CMDOUT
- [ $(jq '.Parts | length' $CMDOUT) == 3 ]
- [ $(jq '.Parts[1].ETag' $CMDOUT) == $ETAG3 ]
-
- aws s3api list-parts --bucket eprouvette --key list-parts --upload-id $UPLOAD_ID --page-size 1 >$CMDOUT
- [ $(jq '.Parts | length' $CMDOUT) == 3 ]
- [ $(jq '.Parts[1].ETag' $CMDOUT) == $ETAG3 ]
-
- cat >/tmp/garage.multipart_struct <<EOF
-{
- "Parts": [
- {
- "ETag": $ETAG1,
- "PartNumber": 1
- },
- {
- "ETag": $ETAG3,
- "PartNumber": 2
- },
- {
- "ETag": $ETAG2,
- "PartNumber": 3
- }
- ]
-}
-EOF
- aws s3api complete-multipart-upload \
- --bucket eprouvette --key list-parts --upload-id $UPLOAD_ID \
- --multipart-upload file:///tmp/garage.multipart_struct
-
- ! aws s3api list-parts --bucket eprouvette --key list-parts --upload-id $UPLOAD_ID >$CMDOUT
- aws s3 rm "s3://eprouvette/list-parts"
-
-
- # @FIXME We do not write tests with --starting-token due to a bug with awscli
- # See here: https://github.com/aws/aws-cli/issues/6666
-
- echo "Test for UploadPartCopy"
- aws s3 cp "/tmp/garage.3.rnd" "s3://eprouvette/copy_part_source"
- UPLOAD_ID=$(aws s3api create-multipart-upload --bucket eprouvette --key test_multipart | jq -r .UploadId)
- PART1=$(aws s3api upload-part \
- --bucket eprouvette --key test_multipart \
- --upload-id $UPLOAD_ID --part-number 1 \
- --body /tmp/garage.2.rnd | jq .ETag)
- PART2=$(aws s3api upload-part-copy \
- --bucket eprouvette --key test_multipart \
- --upload-id $UPLOAD_ID --part-number 2 \
- --copy-source "/eprouvette/copy_part_source" \
- --copy-source-range "bytes=500-5000500" \
- | jq .CopyPartResult.ETag)
- PART3=$(aws s3api upload-part \
- --bucket eprouvette --key test_multipart \
- --upload-id $UPLOAD_ID --part-number 3 \
- --body /tmp/garage.3.rnd | jq .ETag)
- cat >/tmp/garage.multipart_struct <<EOF
-{
- "Parts": [
- {
- "ETag": $PART1,
- "PartNumber": 1
- },
- {
- "ETag": $PART2,
- "PartNumber": 2
- },
- {
- "ETag": $PART3,
- "PartNumber": 3
- }
- ]
-}
-EOF
- aws s3api complete-multipart-upload \
- --bucket eprouvette --key test_multipart --upload-id $UPLOAD_ID \
- --multipart-upload file:///tmp/garage.multipart_struct
-
- aws s3 cp "s3://eprouvette/test_multipart" /tmp/garage.test_multipart
- cat /tmp/garage.2.rnd <(tail -c +501 /tmp/garage.3.rnd | head -c 5000001) /tmp/garage.3.rnd > /tmp/garage.test_multipart_reference
- diff /tmp/garage.test_multipart /tmp/garage.test_multipart_reference >/tmp/garage.test_multipart_diff 2>&1
-
- aws s3 rm "s3://eprouvette/copy_part_source"
- aws s3 rm "s3://eprouvette/test_multipart"
-
- rm /tmp/garage.multipart_struct
- rm /tmp/garage.test_multipart
- rm /tmp/garage.test_multipart_reference
- rm /tmp/garage.test_multipart_diff
-
-
echo "Test CORS endpoints"
garage -c /tmp/config.1.toml bucket website --allow eprouvette
aws s3api put-object --bucket eprouvette --key index.html