Bug fixing

This commit is contained in:
Your Name
2025-05-25 12:00:04 +12:00
parent dbb9adf890
commit 591a77cfb5

22
test.sh
View File

@@ -231,35 +231,33 @@ UPLOAD_RESPONSE=$(curl -X PUT \
SECOND_HASH=$(echo ${UPLOAD_RESPONSE} | jq -r '.hash')
# Verify first version's metadata still has v1 tag
FIRST_METADATA=$(curl -s "${BASE_URL}/metadata/${FIRST_HASH}")
if ! echo "${FIRST_METADATA}" | jq -r '.tags[]' | grep -q 'v1'; then
FIRST_METADATA=$(curl -s "${BASE_URL}/meta/${FIRST_HASH}")
echo "First version metadata response: ${FIRST_METADATA}"
if ! echo "${FIRST_METADATA}" | jq -r '.metadata.tags[]' | grep -q 'v1'; then
die "First version does not have v1 tag"
fi
# Verify first version's metadata no longer has the latest or test tags.
FIRST_METADATA=$(curl -s "${BASE_URL}/metadata/${FIRST_HASH}")
if echo "${FIRST_METADATA}" | jq -r '.tags[]' | grep -q 'latest'; then
if echo "${FIRST_METADATA}" | jq -r '.metadata.tags[]' | grep -q 'latest'; then
die "First version still has latest tag"
fi
if echo "${FIRST_METADATA}" | jq -r '.tags[]' | grep -q 'test'; then
if echo "${FIRST_METADATA}" | jq -r '.metadata.tags[]' | grep -q 'test'; then
die "First version still has test tag"
fi
# Verify second version has the correct tags: v2, latest, test!
SECOND_METADATA=$(curl -s "${BASE_URL}/metadata/${BASE_TAG}:latest")
if ! echo "${SECOND_METADATA}" | jq -r '.tags[]' | grep -q 'v2'; then
SECOND_METADATA=$(curl -s "${BASE_URL}/meta/${BASE_TAG}:latest")
echo "Second version metadata response: ${SECOND_METADATA}"
if ! echo "${SECOND_METADATA}" | jq -r '.metadata.tags[]' | grep -q 'v2'; then
die "Second version does not have v2 tag"
fi
if ! echo "${SECOND_METADATA}" | jq -r '.tags[]' | grep -q 'latest'; then
if ! echo "${SECOND_METADATA}" | jq -r '.metadata.tags[]' | grep -q 'latest'; then
die "Second version does not have latest tag"
fi
if ! echo "${SECOND_METADATA}" | jq -r '.tags[]' | grep -q 'test'; then
if ! echo "${SECOND_METADATA}" | jq -r '.metadata.tags[]' | grep -q 'test'; then
die "Second version does not have test tag"
fi
# Clean up
curl -s -H "Authorization: Bearer ${WRITE_TOKEN}" "${BASE_URL}/deleteobject?hash=${FIRST_HASH}" > /dev/null
curl -s -H "Authorization: Bearer ${WRITE_TOKEN}" "${BASE_URL}/deleteobject?hash=${SECOND_HASH}" > /dev/null