ExHammer / hammer

An Elixir rate-limiter with pluggable backends
https://hexdocs.pm/hammer/
MIT License
747 stars 42 forks source link

[tests] Fix Backend.ETS tests #60

Closed JuneKelly closed 1 year ago

JuneKelly commented 1 year ago

Fixes https://github.com/ExHammer/hammer/issues/59

At some point along the way these tests broke. It seems that the pruning timer is only set up once (when the first instance of Backend.ETS is spawned), and so in the "timeout pruning" test the prune timer never fires, so the bucket never gets pruned.

This indicates an issue with the backend architecture, and with the structure of the tests, but for now we can fix this by deleting the ETS table between test runs, so the timer will be initialized on each run.

This commit also includes some other minor tweaks: