Skip to content

Fix flaky rate_limiter_test.exs test "it restricts based on config values"

Ilja requested to merge ilja/pleroma:fix_erratic_tests into develop

Part of #2860

It used a timer to sleep. But time also goes on when doing other things, so depending on hardware, the timings could be off. I slightly changed the tests so we still test what we functionally want. Instead of waiting until the cache expires I now have a function to expire the cache and use that.

That means we're not testing any more if the cache really expires after a certain amount of time, but that's the responsability of the dependency imo, so shouldn't be a problem.

I also changed Pleroma.Web.Endpoint, :http, :ip from 8.8.8.8 to 127.0.0.1 because that's the setting people typically have, and I see no reason to do it differently. Especially since it's an exernal ip, which may come over as weird or suspicious to people.

Edited by Ilja

Merge request reports