Skip to content
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

[Flaky test] openedx/core/djangoapps/user_authn/views/tests/test_logistration.py::LoginAndRegistrationTest::test_login_and_registration_form_ratelimited #35724

Open
timmc-edx opened this issue Oct 24, 2024 · 0 comments
Labels
flaky-test Details a test removed as part of the flaky test process

Comments

@timmc-edx
Copy link
Contributor

This test fails intermittently and has been deleted according to the Flaky Test Process in #32459.

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

Failure output:

=================================== FAILURES ===================================
____ LoginAndRegistrationTest.test_login_and_registration_form_ratelimited _____

self = <openedx.core.djangoapps.user_authn.views.tests.test_logistration.LoginAndRegistrationTest testMethod=test_login_and_registration_form_ratelimited>

    def test_login_and_registration_form_ratelimited(self):
        """
        Test that rate limiting for logistration enpoints works as expected.
        """
        login_url = reverse('signin_user')
        for _ in range(5):
            response = self.client.get(login_url)
            assert response.status_code == 200
    
        # then the rate limiter should kick in and give a HttpForbidden response
        response = self.client.get(login_url)
>       assert response.status_code == 429
E       assert 200 == 429
E        +  where 200 = <HttpResponse status_code=200, "text/html; charset=utf-8">.status_code

openedx/core/djangoapps/user_authn/views/tests/test_logistration.py:132: AssertionError

(Previously filed as https://2u-internal.atlassian.net/browse/CR-5847.)

Notes copied from deletion PR:

  • [idea] It is unclear whether it would pass if it were tried one more time, or given a little more sleep, but maybe the test could be written so if the 429 isn't seen when expected, it does a very small sleep and tries one last time. Or, maybe there is a real bug in the rate limiting code and real failures to rate limit might occur at times?
    • If you choose the workaround in place of looking to see if there is a real flaky bug, then you should comment next to the workaround that if it ever fails, we should really look into whether this is a bug that is not self-healing with our security code.
  • [idea] Rerunning the test many times in a tight loop locally may help duplicate?
@timmc-edx timmc-edx added the flaky-test Details a test removed as part of the flaky test process label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flaky-test Details a test removed as part of the flaky test process
Projects
None yet
Development

No branches or pull requests

1 participant