Skip to content

Commit e5fafd4

Browse files
authored
Add option to modify rate limiting for perftests (#1324)
1 parent babef90 commit e5fafd4

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.github/workflows/performance-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- name: Build & run epidata
6464
run: |
6565
cd ../driver
66-
sudo make web sql="${{ secrets.DB_CONN_STRING }}"
66+
sudo make web sql="${{ secrets.DB_CONN_STRING }}" rate_limit="999999/second"
6767
sudo make redis
6868
- name: Check out delphi-admin
6969
uses: actions/checkout@v3

dev/local/Makefile

+10-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
# test= Only runs tests in the directories provided here, e.g.
3838
# repos/delphi/delphi-epidata/tests/acquisition/covidcast
3939
# sql= Overrides the default SQL connection string.
40+
# rate_limit= Overrides the default rate limit for API requests.
4041

4142

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

60+
ifdef rate_limit
61+
# Notation found here: https://flask-limiter.readthedocs.io/en/stable/#rate-limit-string-notation
62+
rate_limit_settings:=--env "RATE_LIMIT=$(rate_limit)"
63+
else
64+
# Default behavior is to set the rate limit to "5/hour" for API key tests via this environment variable
65+
rate_limit_settings:=--env "TESTING_MODE=True"
66+
endif
67+
5968
SHELL:=/bin/sh
6069

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

0 commit comments

Comments
 (0)