Clean up curl test

master
Nicolas Favre-Felix 3 years ago
parent 2b69ead0a3
commit cf0f77907e
No known key found for this signature in database
GPG Key ID: C04E7AA8B6F73372

@ -4,5 +4,25 @@
set -e set -e
# GitHub issue #194 (connection: close + HTTP 100) # GitHub issue #194 (connection: close + HTTP 100)
printf 'A%.0s' $(seq 1 10000) | curl -v -H 'Connection: close' -XPUT 'http://127.0.0.1:7379/SET/toobig' -d @- function validate_connection_close_100() {
if [[ $(curl -v 'http://127.0.0.1:7379/STRLEN/toobig.txt') != '10000' ]]; then exit 1; fi key=$(cat /dev/urandom | LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
echo -n 'Sending a PUT request with a large payload... '
put_output=$(printf 'A%.0s' $(seq 1 10000) | curl -s -H 'Connection: close' -XPUT "http://127.0.0.1:7379/SET/${key}" -d @-)
if [[ ${PIPESTATUS[1]} -ne 0 || "${put_output}" != '{"SET":[true,"OK"]}' ]]; then
echo "failed! Response was: ${put_output}"
exit 1
else
echo 'OK'
fi
echo -n 'Verifying the upload... '
strlen_output=$(curl -s "http://127.0.0.1:7379/STRLEN/${key}.txt")
if [[ $strlen_output != '10000' ]]; then
echo "failed! Unexpected value for STRLEN: ${strlen_output}"
exit 1;
else
echo 'OK'
fi
}
validate_connection_close_100

Loading…
Cancel
Save