Merge branch 'hex-flake-id' into 'develop'
[akkoma] / test / healthcheck_test.exs
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
5 defmodule Pleroma.HealthcheckTest do
6 use Pleroma.DataCase
7 alias Pleroma.Healthcheck
8
9 test "system_info/0" do
10 result = Healthcheck.system_info() |> Map.from_struct()
11
12 assert Map.keys(result) == [:active, :healthy, :idle, :memory_used, :pool_size]
13 end
14
15 describe "check_health/1" do
16 test "pool size equals active connections" do
17 result = Healthcheck.check_health(%Healthcheck{pool_size: 10, active: 10})
18 refute result.healthy
19 end
20
21 test "chech_health/1" do
22 result = Healthcheck.check_health(%Healthcheck{pool_size: 10, active: 9})
23 assert result.healthy
24 end
25 end
26 end