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

Backend rate limit tests are failing #879

Open
2 tasks done
to-sta opened this issue May 19, 2024 · 14 comments
Open
2 tasks done

Backend rate limit tests are failing #879

to-sta opened this issue May 19, 2024 · 14 comments
Assignees
Labels
bug Something isn't working

Comments

@to-sta
Copy link
Collaborator

to-sta commented May 19, 2024

Terms

Behavior

Our rate limit tests are currently failing, but the rate limiting functionality is working correctly. I have manually tested it using SwaggerUI.

@to-sta to-sta added the bug Something isn't working label May 19, 2024
@to-sta
Copy link
Collaborator Author

to-sta commented May 19, 2024

cc @josueemartinezz

@thesarfo
Copy link
Contributor

is this being worked on? If not I could get this done

@to-sta
Copy link
Collaborator Author

to-sta commented Aug 12, 2024

Would be great if you can tackle this @thesarfo. Let me know if you need any help.

@andrewtavis
Copy link
Member

Thanks for the assignment, @to-sta, and thanks for offering to help out @thesarfo :)

@prajguru54
Copy link

I don't have much experience to start with. But when I run the tests locally everything is passing. It's just that I had to change the name of the environment file to ".env" instead of ".env.dev" (and adjust the databases connection variables like server and host etc). With ".env.dev" it was not able to detect the "SECRET_KEY" and was throwing --> django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

Apologies if this a noob findings.
coverage
html_coverage
test_details

@to-sta
Copy link
Collaborator Author

to-sta commented Sep 25, 2024

@prajguru54 thanks for checking :). I removed the tests a while ago. In order to avoid failing GitHun Actions, but forgot to add a comment here.

The last change to the test was made in the commit 591bd07c243c279573cbf5b9eeb51e4ca5be89b0 inside the throttle.py file. But I think it would be better to start from scratch 😄.

The test should check the rate limits for logged-in users and anom users.

@andrewtavis
Copy link
Member

@prajguru54 or @thesarfo, would either of you want to reimplement them?

@thesarfo
Copy link
Contributor

yes, I would want to do that. but @prajguru54 can take it if he feels up to it

@andrewtavis
Copy link
Member

You're assigned, @thesarfo, so by all means feel free to send something along :) Let us know if you'd like some ideas or support!

@prajguru54
Copy link

prajguru54 commented Sep 26, 2024

@andrewtavis , I will be glad to take this. Already started on it. @thesarfo Have you also started as well??

@andrewtavis
Copy link
Member

Hey all 👋 Checking in post a busy last month on my end. Hope all are well :) We're still looking for the tests that were removed to be re-implemented. @thesarfo or @prajguru54: Do either of you have interest?

@thesarfo
Copy link
Contributor

@andrewtavis I’ve been going through the codebase to locate the rate-limiting functionality but haven’t been able to pin it down yet. I’m keen to write the tests for it, could you point me in the right direction?

@andrewtavis
Copy link
Member

CC @to-sta who might have a bit better of an opinion on how to implement this? :)

@to-sta
Copy link
Collaborator Author

to-sta commented Nov 25, 2024

Hi @thesarfo, the functionality comes from DRF, here are the docs.

We have set default values users and anons in settings.py.

For your test you could also overwrite those settings and test against that 🙂.

You can test the rate limiting yourself via SwaggerUI. For that you need to run the backend container and go to http://localhost:8000/v1/schema/swagger-ui/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

4 participants