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.

27 lines
780B

  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2019 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) == [:active, :healthy, :idle, :memory_used, :pool_size]
  10. end
  11. describe "check_health/1" do
  12. test "pool size equals active connections" do
  13. result = Healthcheck.check_health(%Healthcheck{pool_size: 10, active: 10})
  14. refute result.healthy
  15. end
  16. test "chech_health/1" do
  17. result = Healthcheck.check_health(%Healthcheck{pool_size: 10, active: 9})
  18. assert result.healthy
  19. end
  20. end
  21. end