Skip to content

Fix random fails of the rate limiter tests (hopefully)

minibikini requested to merge minibikini/pleroma:fix-rate-limiter-test into develop

It looks like sometimes calls to RateLimiter are a little slower than expected so the limiter does not throttle.

The failed test stacktrace:

  1) test config it restricts based on config values (Pleroma.Plugs.RateLimiterTest)
     test/plugs/rate_limiter_test.exs:26
     ** (RuntimeError) expected connection to have a response but no response was set/sent.
     Please verify that you assign to "conn" after a request:
     
         conn = get(conn, "/")
         assert html_response(conn) =~ "Hello"
     
     code: assert %{"error" => "Throttled"} = Phoenix.ConnTest.json_response(conn, :too_many_requests)
     stacktrace:
       (phoenix) lib/phoenix/test/conn_test.ex:358: Phoenix.ConnTest.response/2
       (phoenix) lib/phoenix/test/conn_test.ex:419: Phoenix.ConnTest.json_response/2
       test/plugs/rate_limiter_test.exs:43: (test)

cc @stwf

Merge request reports