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.

34 lines
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