Bug fixing

This commit is contained in:
Your Name
2025-05-25 15:19:48 +12:00
parent 3033701d6c
commit 6efa917a2a

19
test.sh
View File

@@ -287,4 +287,23 @@ if ! echo "${RESPONSE}" | jq -r '.error' | grep -q "Too many authentication atte
die "Expected rate limit error, got: ${RESPONSE}"
fi
echo "Sleeping for 3 seconds to allow rate limit to reset"
echo "(Normally 5 mins, but we set to 2s for this test!)"
sleep 3
# Now try a request with a valid token - should be rate limited
echo "Attempting request with valid token (should NOT be rate limited)"
RESPONSE=$(curl -s -X PUT -H "Authorization: Bearer ${WRITE_TOKEN}" -F "file=@${SCRIPT_DIR}/${SCRIPT_NAME}" -F "metadata={\"labeltags\":[\"test:latest\"]}" "${BASE_URL}/upload")
if echo "${RESPONSE}" | jq -r '.error' | grep -q "Too many authentication attempts"; then
die "Expected no rate limit error, got: ${RESPONSE}"
fi
# delete the object
TODELHASH=$(curl -s "${BASE_URL}/hash/test:latest" | jq -r '.hash')
echo "deleting test:latest ${TODELHASH}"
if ! curl -s -H "Authorization: Bearer ${WRITE_TOKEN}" "${BASE_URL}/deleteobject?hash=${TODELHASH}" | jq -r '.result' | grep -q 'success'; then
die "failed to delete ${TODELHASH}"
fi
title "ALL TESTS PASSED"