Skip to content

Add option to modify rate limiting for perftests #1324

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

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/performance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Build & run epidata
run: |
cd ../driver
sudo make web sql="${{ secrets.DB_CONN_STRING }}"
sudo make web sql="${{ secrets.DB_CONN_STRING }}" rate_limit="999999/second"
sudo make redis
- name: Check out delphi-admin
uses: actions/checkout@v3
Expand Down
11 changes: 10 additions & 1 deletion dev/local/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# test= Only runs tests in the directories provided here, e.g.
# repos/delphi/delphi-epidata/tests/acquisition/covidcast
# sql= Overrides the default SQL connection string.
# rate_limit= Overrides the default rate limit for API requests.


# Set optional argument defaults
Expand All @@ -56,6 +57,14 @@ else
sqlalchemy_uri:=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata
endif

ifdef rate_limit
# Notation found here: https://flask-limiter.readthedocs.io/en/stable/#rate-limit-string-notation
rate_limit_settings:=--env "RATE_LIMIT=$(rate_limit)"
else
# Default behavior is to set the rate limit to "5/hour" for API key tests via this environment variable
rate_limit_settings:=--env "TESTING_MODE=True"
endif

SHELL:=/bin/sh

# Get the Makefile's absolute path: https://stackoverflow.com/a/324782/4784655
Expand Down Expand Up @@ -104,7 +113,7 @@ web:
--env "REDIS_PASSWORD=1234" \
--env "API_KEY_ADMIN_PASSWORD=test_admin_password" \
--env "API_KEY_REGISTER_WEBHOOK_TOKEN=abc" \
--env "TESTING_MODE=True" \
$(rate_limit_settings) \
--network delphi-net --name delphi_web_epidata \
delphi_web_epidata >$(LOG_WEB) 2>&1 &

Expand Down