openedx / openedx/openedx-platform

[Flaky test] `openedx/core/djangoapps/user_authn/views/tests/test_login.py::LoginTest::test_login_ratelimited`

Open
#36,013 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

flaky-test
Dominant language
Python
Stars
8.2k
Forks
4.4k
Avg merge
6d 18h
Merged PRs (30d)
42

Description

This test fails intermittently and has been deleted according to the Flaky Test Process in https://github.com/openedx/edx-platform/pull/25096

See docs on how to address flaky tests for why this should be fixed and how to go about it.

Failure output:

self = <openedx.core.djangoapps.user_authn.views.tests.test_login.LoginTest testMethod=test_login_ratelimited>

    def test_login_ratelimited(self):
        """
        Test that login endpoint is IP ratelimited and only allow 5 requests
        per 5 minutes per IP.
        """
        for i in range(5):
            password = u'test_password{0}'.format(i)
            response, _audit_log = self._login_response(self.user_email, password)
            self._assert_response(response, success=False)
    
        response, _audit_log = self._login_response(self.user_email, self.password)
>       self.assertEqual(response.status_code, 403)
E       AssertionError: 200 != 403

openedx/core/djangoapps/user_authn/views/tests/test_login.py:396: AssertionError

Migrate from private ticket https://2u-internal.atlassian.net/issues/CR-2761

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with openedx/core/djangoapps/user_authn/views/tests/test_login.py and the deleted LoginTest::test_login_ratelimited test. Review the linked flaky-test process and the failure from PR 25082, then trace the rate-limit setup used by the test. Done means the login rate-limit behavior is covered reliably and the test no longer intermittently returns 200 instead of 403.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication, backend, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.