Skip to content

Commit

Permalink
Add a ping test (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
MCPN authored Nov 16, 2023
1 parent 8502239 commit 6275118
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions lib/dl_api_lib/dl_api_lib_tests/db/data_api/test_ping.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from __future__ import annotations

import pytest
import shortuuid

from dl_api_lib_tests.db.base import DefaultApiTestBase
from dl_configs.enums import RequiredService


class TestPing(DefaultApiTestBase):
@pytest.mark.asyncio
async def test_ping(self, data_api_lowlevel_aiohttp_client):
client = data_api_lowlevel_aiohttp_client
req_id = shortuuid.uuid()

resp = await client.get("/ping", headers={"x-request-id": req_id})
assert resp.status == 200
js = await resp.json()
assert js["request_id"].startswith(req_id + "--")

@pytest.mark.asyncio
async def test_ping_ready(self, data_api_lowlevel_aiohttp_client):
client = data_api_lowlevel_aiohttp_client
req_id = shortuuid.uuid()

resp = await client.get("/ping_ready", headers={"x-request-id": req_id})
assert resp.status == 200
js = await resp.json()
assert js["request_id"].startswith(req_id + "--")
details = js["details"]
assert details[RequiredService.POSTGRES.name] is True
assert details[RequiredService.RQE_INT_SYNC.name] == 200
assert details[RequiredService.RQE_EXT_SYNC.name] == 200

0 comments on commit 6275118

Please sign in to comment.