diff --git a/testing/test.sh b/testing/test.sh index deeac9b..44161bf 100755 --- a/testing/test.sh +++ b/testing/test.sh @@ -481,12 +481,18 @@ if echo "${RESPONSE}" | jq -r '.error' | grep -q "Too many authentication attemp die "Expected no rate limit error, got: ${RESPONSE}" fi -# delete the object -TODELHASH=$(curl -s "${HOSTURL}/hash/test:latest" | jq -r '.hash') -echo "deleting test:latest ${TODELHASH}" +curl -s "${HOSTURL}/meta/${HASH}" | jq -if ! curl -s -H "Authorization: Bearer ${WRITE_TOKEN}" "${HOSTURL}/deleteobject?hash=${TODELHASH}" | jq -r '.result' | grep -q 'success'; then - die "failed to delete ${TODELHASH}" +# delete the object (only if it exists) +TODELHASH=$(curl -s "${HOSTURL}/hash/test:form_updated" | jq -r '.hash') +if [ "${TODELHASH}" != "null" ] && [ -n "${TODELHASH}" ]; then + echo "deleting test:form_updated ${TODELHASH}" + if ! curl -s -H "Authorization: Bearer ${WRITE_TOKEN}" "${HOSTURL}/deleteobject?hash=${TODELHASH}" | jq -r '.result' | grep -q 'success'; then + die "failed to delete ${TODELHASH}" + fi +else + echo "test:form_updated not found, skipping deletion" + echo "HASH=${HASH}, TODELHASH=${TODELHASH}" fi #------------------------------------------------------------------------------------------------