logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

healthcheck_test.exs (889B)


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