From 591a77cfb5d1b59b55e39edc570cecc032620044 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 25 May 2025 12:00:04 +1200 Subject: [PATCH] Bug fixing --- test.sh | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/test.sh b/test.sh index 5c6a13d..ab70aa2 100755 --- a/test.sh +++ b/test.sh @@ -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