-
-
Save xjlin0/1f5f2ba4e90cc6007fb2f2520b323893 to your computer and use it in GitHub Desktop.
Apache Bench - Load test a protected page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
COOKIE_JAR="ab-cookie-jar" | |
COOKIE_NAME="_myapp_session" | |
USERNAME="[email protected]" | |
PASSWORD="password" | |
LOGIN_PAGE_URI="http://localhost:3000/users/sign_in" | |
TEST_PAGE_URI="http://localhost:3000/dashboard" | |
echo "Logging in and storing session id." | |
curl -i -c $COOKIE_JAR -X POST -d "user[email]=$USERNAME" -d "user[password]=$PASSWORD" $LOGIN_PAGE_URI | |
SESSION_ID=$(cat $COOKIE_JAR | grep $COOKIE_NAME | cut -f 7) | |
echo "Performing load test." | |
ab -n 1 -c 1 -v4 -C "$COOKIE_NAME=$SESSION_ID" $TEST_PAGE_URI |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment