From 3f7e5c88bc2cf15a97ff90a7141804254ab95897 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Fri, 23 Feb 2024 16:37:51 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=85(app-desk)=20change=20backend=20settin?= =?UTF-8?q?gs=20for=20e2e=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we run e2e tests with the CI, we are doing lot of calls to the backend in a short amount of time. This can lead to a rate limit particulary on the "user/me" endpoint. To avoid this, we will use different backend settings for the e2e tests. --- .github/workflows/people.yml | 1 + env.d/development/common.e2e.dist | 3 +++ src/backend/people/settings.py | 13 ++++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 env.d/development/common.e2e.dist diff --git a/.github/workflows/people.yml b/.github/workflows/people.yml index 4b78f9d..9aa8736 100644 --- a/.github/workflows/people.yml +++ b/.github/workflows/people.yml @@ -115,6 +115,7 @@ jobs: - name: Set services env variables run: | make create-env-files + cat env.d/development/common.e2e.dist >> env.d/development/common - name: Build and Start Docker Servers env: diff --git a/env.d/development/common.e2e.dist b/env.d/development/common.e2e.dist new file mode 100644 index 0000000..b0faa27 --- /dev/null +++ b/env.d/development/common.e2e.dist @@ -0,0 +1,3 @@ +# For the CI job test-e2e +SUSTAINED_THROTTLE_RATES="200/hour" +BURST_THROTTLE_RATES="200/minute" diff --git a/src/backend/people/settings.py b/src/backend/people/settings.py index a19031d..69d2fd7 100755 --- a/src/backend/people/settings.py +++ b/src/backend/people/settings.py @@ -228,7 +228,18 @@ class Base(Configuration): "PAGE_SIZE": 20, "DEFAULT_VERSIONING_CLASS": "rest_framework.versioning.URLPathVersioning", "DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema", - "DEFAULT_THROTTLE_RATES": {"sustained": "150/hour", "burst": "20/minute"}, + "DEFAULT_THROTTLE_RATES": { + "sustained": values.Value( + default="150/hour", + environ_name="SUSTAINED_THROTTLE_RATES", + environ_prefix=None, + ), + "burst": values.Value( + default="20/minute", + environ_name="BURST_THROTTLE_RATES", + environ_prefix=None, + ), + }, } SPECTACULAR_SETTINGS = {