Skip to content

Commit

Permalink
CI: Download the object if the etag matches
Browse files Browse the repository at this point in the history
Jira: OS-556
  • Loading branch information
AymericDu committed Jul 20, 2020
1 parent cebef23 commit 921fc86
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion oioswift/common/middleware/slo.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ def handle_container_listing(self, req, start_response):
item['hash'] = etag + ''.join(
'; %s=%s' % kv for kv in params.items())

resp.body = json.dumps(listing).encode('ascii')
resp.body = json.dumps(listing)
return resp(req.environ, start_response)

def __call__(self, env, start_response):
Expand Down
37 changes: 37 additions & 0 deletions tests/functional/s3-multipart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,43 @@ ETAG=$(echo $DATA | jq -r .ETag)

[ "$ETAG" == '"c9975699ef630d1f3dfc7224b16d1a25-11"' ]

OBJ_META=$(${AWS} s3api get-object --bucket ${BUCKET} --key obj --if-match c9975699ef630d1f3dfc7224b16d1a25-11 obj)
ETAG=$(jq -r ".ETag|tostring" <<< "$OBJ_META")
[ "$ETAG" == '"c9975699ef630d1f3dfc7224b16d1a25-11"' ]
diff "${MULTI_FILE}" obj
if ${AWS} s3api get-object --bucket ${BUCKET} --key obj --if-match c9975699ef630d1f3dfc7224b16d1a25-12 obj; then
false
fi
if ${AWS} s3api get-object --bucket ${BUCKET} --key obj --if-match c9975699ef630d1f3dfc7224b16d1a25 obj; then
false
fi
if ${AWS} s3api get-object --bucket ${BUCKET} --key obj --if-match c9975699ef630d1f3dfc7224b16d1a20-12 obj; then
false
fi

# Without swift3 etag properties
openio --oio-ns "${OIO_NS}" --oio-account "${OIO_ACCOUNT}" object unset "${BUCKET}" obj --property x-object-sysmeta-swift3-etag --property x-object-sysmeta-container-update-override-etag
DATA=$(${AWS} s3api head-object --bucket ${BUCKET} --key obj)
ETAG=$(echo $DATA | jq -r .ETag)
[ "$ETAG" == '"aeeb9a4f5125d76819644941190ce95b-N"' ]
OBJ_META=$(${AWS} s3api get-object --bucket ${BUCKET} --key obj --if-match aeeb9a4f5125d76819644941190ce95b-N obj)
ETAG=$(jq -r ".ETag|tostring" <<< "$OBJ_META")
[ "$ETAG" == '"aeeb9a4f5125d76819644941190ce95b-N"' ]
diff "${MULTI_FILE}" obj
OBJ_META=$(${AWS} s3api get-object --bucket ${BUCKET} --key obj --if-match aeeb9a4f5125d76819644941190ce95b obj)
ETAG=$(jq -r ".ETag|tostring" <<< "$OBJ_META")
[ "$ETAG" == '"aeeb9a4f5125d76819644941190ce95b-N"' ]
diff "${MULTI_FILE}" obj
if ${AWS} s3api get-object --bucket ${BUCKET} --key obj --if-match aeeb9a4f5125d76819644941190ce95b-12 obj; then
false
fi
if ${AWS} s3api get-object --bucket ${BUCKET} --key obj --if-match aeeb9a4f5125d76819644941190ce950-N obj; then
false
fi
if ${AWS} s3api get-object --bucket ${BUCKET} --key obj --if-match aeeb9a4f5125d76819644941190ce950 obj; then
false
fi

echo
echo "Cleanup"
echo "-------"
Expand Down

0 comments on commit 921fc86

Please sign in to comment.