|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 2 | +# contributor license agreements. See the NOTICE file distributed with |
| 3 | +# this work for additional information regarding copyright ownership. |
| 4 | +# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 5 | +# (the "License"); you may not use this file except in compliance with |
| 6 | +# the License. You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +*** Settings *** |
| 17 | +Documentation S3 gateway test with aws cli with STANDARD_IA storage class |
| 18 | +Library OperatingSystem |
| 19 | +Library String |
| 20 | +Resource ../commonlib.robot |
| 21 | +Resource ../s3/commonawslib.robot |
| 22 | +Resource ../s3/mpu_lib.robot |
| 23 | +Resource ../ozone-lib/shell.robot |
| 24 | +Test Timeout 5 minutes |
| 25 | +Suite Setup Setup EC Multipart Tests |
| 26 | +Suite Teardown Teardown EC Multipart Tests |
| 27 | +Test Setup Generate random prefix |
| 28 | + |
| 29 | +*** Keywords *** |
| 30 | +Setup EC Multipart Tests |
| 31 | + Setup s3 tests |
| 32 | + Create Random File KB 1023 /tmp/1mb |
| 33 | + |
| 34 | +Teardown EC Multipart Tests |
| 35 | + Remove Files /tmp/1mb |
| 36 | + |
| 37 | +*** Variables *** |
| 38 | +${ENDPOINT_URL} http://s3g:9878 |
| 39 | +${BUCKET} generated |
| 40 | + |
| 41 | +*** Test Cases *** |
| 42 | + |
| 43 | +Put Object with STANDARD_IA storage class |
| 44 | + ${file_checksum} = Execute md5sum /tmp/1mb | awk '{print $1}' |
| 45 | + |
| 46 | + ${result} = Execute AWSS3ApiCli put-object --bucket ${BUCKET} --key ${PREFIX}/ecKey32 --body /tmp/1mb --storage-class STANDARD_IA |
| 47 | + ${eTag} = Execute echo '${result}' | jq -r '.ETag' |
| 48 | + Should Be Equal ${eTag} \"${file_checksum}\" |
| 49 | + Verify Key EC Replication Config /s3v/${BUCKET}/${PREFIX}/ecKey32 RS 3 2 1048576 |
| 50 | + |
| 51 | + ${result} = Execute AWSS3ApiCli put-object --bucket ${BUCKET} --key ${PREFIX}/ecKey63 --body /tmp/1mb --storage-class STANDARD_IA --metadata="storage-config=rs-6-3-1024k" |
| 52 | + ${eTag} = Execute echo '${result}' | jq -r '.ETag' |
| 53 | + Should Be Equal ${eTag} \"${file_checksum}\" |
| 54 | + Verify Key EC Replication Config /s3v/${BUCKET}/${PREFIX}/ecKey63 RS 6 3 1048576 |
| 55 | + |
| 56 | +Test multipart upload with STANDARD_IA storage |
| 57 | + ${uploadID} = Initiate MPU ${BUCKET} ${PREFIX}/ecmultipartKey32 0 --storage-class STANDARD_IA |
| 58 | + ${eTag1} = Upload MPU part ${BUCKET} ${PREFIX}/ecmultipartKey32 ${uploadID} 1 /tmp/1mb |
| 59 | + ${result} = Execute AWSS3APICli list-parts --bucket ${BUCKET} --key ${PREFIX}/ecmultipartKey32 --upload-id ${uploadID} |
| 60 | + ${part1} = Execute echo '${result}' | jq -r '.Parts[0].ETag' |
| 61 | + Should Be equal ${part1} ${eTag1} |
| 62 | + Should contain ${result} STANDARD_IA |
| 63 | + Complete MPU ${BUCKET} ${PREFIX}/ecmultipartKey32 ${uploadID} {ETag=${eTag1},PartNumber=1} |
| 64 | + Verify Key EC Replication Config /s3v/${BUCKET}/${PREFIX}/ecmultipartKey32 RS 3 2 1048576 |
| 65 | + |
| 66 | + ${uploadID} = Initiate MPU ${BUCKET} ${PREFIX}/ecmultipartKey63 0 --storage-class STANDARD_IA --metadata="storage-config=rs-6-3-1024k" |
| 67 | + ${eTag1} = Upload MPU part ${BUCKET} ${PREFIX}/ecmultipartKey63 ${uploadID} 1 /tmp/part1 |
| 68 | + ${result} = Execute AWSS3APICli list-parts --bucket ${BUCKET} --key ${PREFIX}/ecmultipartKey63 --upload-id ${uploadID} |
| 69 | + ${part1} = Execute echo '${result}' | jq -r '.Parts[0].ETag' |
| 70 | + Should Be equal ${part1} ${eTag1} |
| 71 | + Should contain ${result} STANDARD_IA |
| 72 | + Complete MPU ${BUCKET} ${PREFIX}/ecmultipartKey63 ${uploadID} {ETag=${eTag1},PartNumber=1} |
| 73 | + Verify Key EC Replication Config /s3v/${BUCKET}/${PREFIX}/ecmultipartKey63 RS 6 3 1048576 |
| 74 | + |
| 75 | +Copy Object change storage class to STANDARD_IA |
| 76 | + ${file_checksum} = Execute md5sum /tmp/1mb | awk '{print $1}' |
| 77 | + ${result} = Execute AWSS3ApiCli put-object --bucket ${BUCKET} --key ${PREFIX}/copyobject/Key1 --body /tmp/1mb |
| 78 | + ${eTag} = Execute echo '${result}' | jq -r '.ETag' |
| 79 | + Should Be Equal ${eTag} \"${file_checksum}\" |
| 80 | + |
| 81 | + ${result} = Execute AWSS3APICli copy-object --storage-class STANDARD_IA --bucket ${BUCKET} --key ${PREFIX}/copyobject/Key1 --copy-source ${BUCKET}/${PREFIX}/copyobject/Key1 |
| 82 | + Should contain ${result} ETag |
| 83 | + ${eTag} = Execute echo '${result}' | jq -r '.CopyObjectResult.ETag' |
| 84 | + Should Be Equal ${eTag} \"${file_checksum}\" |
| 85 | + |
| 86 | + ${result} = Execute AWSS3APICli copy-object --storage-class STANDARD_IA --metadata="storage-config=rs-6-3-1024k" --bucket ${BUCKET} --key ${PREFIX}/copyobject/Key1 --copy-source ${BUCKET}/${PREFIX}/copyobject/Key1 |
| 87 | + Should contain ${result} ETag |
| 88 | + ${eTag} = Execute echo '${result}' | jq -r '.CopyObjectResult.ETag' |
| 89 | + Should Be Equal ${eTag} \"${file_checksum}\" |
| 90 | + ## TODO: Verify Key EC Replication Config when we support changing storage class |
0 commit comments