Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
871B

  1. defmodule MockActivityPub do
  2. def publish_one(ret) do
  3. {ret, "success"}
  4. end
  5. end
  6. defmodule Pleroma.Web.Federator.RetryQueueTest do
  7. use Pleroma.DataCase
  8. alias Pleroma.Web.Federator.RetryQueue
  9. @small_retry_count 0
  10. @hopeless_retry_count 10
  11. test "failed posts are retried" do
  12. {:retry, _timeout} = RetryQueue.get_retry_params(@small_retry_count)
  13. assert {:noreply, %{delivered: 1}} ==
  14. RetryQueue.handle_info({:send, :ok, MockActivityPub, @small_retry_count}, %{
  15. delivered: 0
  16. })
  17. end
  18. test "posts that have been tried too many times are dropped" do
  19. {:drop, _timeout} = RetryQueue.get_retry_params(@hopeless_retry_count)
  20. assert {:noreply, %{dropped: 1}} ==
  21. RetryQueue.handle_cast({:maybe_enqueue, %{}, nil, @hopeless_retry_count}, %{
  22. dropped: 0
  23. })
  24. end
  25. end