logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

healthcheck_test.exs (933B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.HealthcheckTest do
  5. use Pleroma.DataCase, async: true
  6. alias Pleroma.Healthcheck
  7. test "system_info/0" do
  8. result = Healthcheck.system_info() |> Map.from_struct()
  9. keys = Map.keys(result)
  10. assert Keyword.equal?(keys, [
  11. :active,
  12. :healthy,
  13. :idle,
  14. :job_queue_stats,
  15. :memory_used,
  16. :pool_size
  17. ])
  18. end
  19. describe "check_health/1" do
  20. test "pool size equals active connections" do
  21. result = Healthcheck.check_health(%Healthcheck{pool_size: 10, active: 10})
  22. refute result.healthy
  23. end
  24. test "check_health/1" do
  25. result = Healthcheck.check_health(%Healthcheck{pool_size: 10, active: 9})
  26. assert result.healthy
  27. end
  28. end
  29. end