userver: samples/production_service/tests/test_production.py
Loading...
Searching...
No Matches
samples/production_service/tests/test_production.py
1async def test_monitor(monitor_client):
2 response = await monitor_client.get('/service/log-level/')
3 assert response.status == 200
4
5
6async def test_metrics_smoke(monitor_client):
7 metrics = await monitor_client.metrics()
8 assert len(metrics) > 1
9
10
11# /// [metrics partial portability]
12async def test_partial_metrics_portability(service_client):
13 warnings = await service_client.metrics_portability()
14 warnings.pop('label_name_mismatch', None)
15 assert not warnings, warnings
16 # /// [metrics partial portability]
17
18
19async def test_jemalloc_handle(monitor_client):
20 response = await monitor_client.post('service/jemalloc/prof/disable')
21 if response.status_code == 501:
22 # No jemalloc support
23 return
24 else:
25 # Handle always succeeds even if was not previously enabled
26 assert response.status_code == 200
27
28 response = await monitor_client.post('service/jemalloc/prof/stat')
29 assert response.status_code == 200
30 assert response.text
31
32 try:
33 response = await monitor_client.post('service/jemalloc/prof/enable')
34 assert response.status_code == 503
35 assert 'MALLOC_CONF' in response.text
36 assert 'prof:true' in response.text
37 finally:
38 response = await monitor_client.post('service/jemalloc/prof/disable')
39 assert response.status_code == 200