openedx / openedx/openedx-platform
[Flaky test] `RegistrationViewTestV2::test_rate_limiting_registration_view`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.2k
- Forks
- 4.4k
- Avg merge
- 6d 18h
- Merged PRs (30d)
- 42
Description
This test fails intermittently and will be deleted according to the Flaky Test Process in https://github.com/openedx/edx-platform/pull/36491
See docs on how to address flaky tests for why this should be fixed and how to go about it.
- Failing CI run, under
openedx-2-with-lms(py=3.11,dj=pinned,mongo=7.0): https://github.com/openedx/edx-platform/actions/runs/14311302935/job/40106739835 - Subsequent Passing CI run: https://github.com/openedx/edx-platform/actions/runs/14311302935/job/40113340581
Failure output:
=================================== FAILURES ===================================
_________ RegistrationViewTestV2.test_rate_limiting_registration_view __________
self = <openedx.core.djangoapps.user_authn.views.tests.test_register.RegistrationViewTestV2 testMethod=test_rate_limiting_registration_view>
@override_settings(
CACHES={
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'registration_proxy',
}
}
)
def test_rate_limiting_registration_view(self):
"""
Confirm rate limits work as expected for registration
end point.
Note that drf's rate limiting makes use of the default cache
to enforce limits; that's why this test needs a "real"
default cache (as opposed to the usual-for-tests DummyCache)
"""
payload = {
"email": 'email',
"name": self.NAME,
"username": self.USERNAME,
"password": self.PASSWORD,
"honor_code": "true",
}
for _ in range(int(settings.REGISTRATION_RATELIMIT.split('/')[0])):
response = self.client.post(self.url, payload)
assert response.status_code != 403
response = self.client.post(self.url, payload)
> assert response.status_code == 403
E assert 400 == 403
E + where 400 = <JsonResponse status_code=400, "application/json">.status_code
openedx/core/djangoapps/user_authn/views/tests/test_register.py:1889: AssertionError
------------------------------ Captured log call -------------------------------
WARNING django.request:log.py:241 Bad Request: /api/user/v2/account/registration/
WARNING django.request:log.py:241 Bad Request: /api/user/v2/account/registration/
WARNING django.request:log.py:241 Bad Request: /api/user/v2/account/registration/
WARNING django.request:log.py:241 Bad Request: /api/user/v2/account/registration/
WARNING django.request:log.py:241 Bad Request: /api/user/v2/account/registration/
WARNING django.request:log.py:241 Bad Request: /api/user/v2/account/registration/
=============================== warnings summary ===============================
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with openedx/core/djangoapps/user_authn/views/tests/test_register.py at RegistrationViewTestV2::test_rate_limiting_registration_view, then run the targeted test and compare the provided failing and passing CI runs. Consult the linked Flaky Test Process and pull request 36491; done means the test is handled according to that process and no longer produces intermittent failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100