-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Locust.io load testing script #1188
Conversation
**Why**: To document and share the scripts we use.
fancy_echo "Upgrading %s ..." "$1" | ||
brew upgrade "$@" | ||
else | ||
fancy_echo "Already using the latest version of %s. Skipping ..." "$1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not seen this fancy_echo
/printf
pattern before in bash, why not just interpolate?
"Already using the latest version of $1. Skipping ..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I grabbed it from the laptop script. It adds a newline before and after the text. So, instead of manually adding the newlines every time you need them, you can use the helper method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it!
bin/load_test
Outdated
brew_install_or_upgrade 'libevent' | ||
source /usr/local/bin/virtualenvwrapper.sh | ||
mkvirtualenv locust && \ | ||
workon locust && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about indenting these lines that are a continuation via \
?
mkvirtualenv locust && \
workon locust && \
pip install -r scripts/load_testing/requirements.txt && \
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea.
|
||
# capture email confirmation link on resulting page | ||
dom = pyquery.PyQuery(resp.content) | ||
link = dom.find('a')[2].attrib['href'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add an ID or something to this href in our app so it's less brittle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great idea!
|
||
# visit enter passcode page and submit pre-filled OTP | ||
dom = pyquery.PyQuery(resp.content) | ||
auth_token = dom.find('input[name="authenticity_token"]')[0].attrib['value'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we repeat the authenticity token blurb a few times, WDYT of a helper function for authenticity token?
def authenticity_token(dom):
return dom.find('input[name="authenticity_token"]')[0].attrib['value']
data = {
'code': otp_code,
'authenticity_token': authenticity_token(dom),
'commit': 'Submit'
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea
Addressed feedback here: 39c6c17 PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! thanks
Why: To document and share the scripts we use.