Add /health endpoint that returns last_process timestamp, fix issue #6009

This commit is contained in:
Reigo Reinmets
2022-01-23 21:58:46 +02:00
parent 451eca51c8
commit bf62fc9b25
7 changed files with 59 additions and 7 deletions

View File

@@ -1272,3 +1272,12 @@ def test_rpc_edge_enabled(mocker, edge_conf) -> None:
assert ret[0]['Winrate'] == 0.66
assert ret[0]['Expectancy'] == 1.71
assert ret[0]['Stoploss'] == -0.02
def test_rpc_health(mocker, default_conf) -> None:
mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock())
freqtradebot = get_patched_freqtradebot(mocker, default_conf)
rpc = RPC(freqtradebot)
ret = rpc._health()
assert ret['last_process'] == '1970-01-01 00:00:00'

View File

@@ -1442,3 +1442,13 @@ def test_api_backtesting(botclient, mocker, fee, caplog, tmpdir):
assert result['status'] == 'reset'
assert not result['running']
assert result['status_msg'] == 'Backtest reset'
def test_health(botclient):
ftbot, client = botclient
rc = client_get(client, f"{BASE_URI}/health")
assert_response(rc)
ret = rc.json()
assert ret['last_process'] == '1970-01-01T00:00:00'