Created
March 27, 2012 14:35
-
-
Save brentertz/2216466 to your computer and use it in GitHub Desktop.
Apache Bench - Load test a protected page
This file contains 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="foo@bar.com" | |
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