тесты и healthcheck устойчивее к медленному хосту: время пробы внутри контейнера, healthcheck timeout 5 с, дочитывание TLS-ответа, grace уборщика 15 с
This commit is contained in:
@@ -15,7 +15,7 @@ import uuid
|
||||
import httpx2 as httpx
|
||||
import pytest
|
||||
|
||||
from conftest import BASE_URL, REPLICAS, Api, compose, lbctl, probe_inside, psql, replica_stopped, run_hook, \
|
||||
from conftest import BASE_URL, REPLICAS, Api, compose, lbctl, probe_inside_timed, psql, replica_stopped, run_hook, \
|
||||
running_replicas, wait_healthy, wait_stand
|
||||
|
||||
pytestmark = pytest.mark.stack
|
||||
@@ -109,10 +109,10 @@ def test_lb_stops_routing_to_a_replica_that_is_alive_but_not_ready(api, position
|
||||
time.sleep(0.1)
|
||||
detected = time.monotonic() - started
|
||||
for _ in range(3): # the process stays responsive (event loop never blocked) ...
|
||||
started_probe = time.monotonic()
|
||||
assert probe_inside(replica, "/health/live") == 200
|
||||
assert probe_inside(replica, "/health/ready") == 503 # ... but not ready
|
||||
assert time.monotonic() - started_probe < 4.5, "replica froze while its dependencies were unreachable"
|
||||
live, live_s = probe_inside_timed(replica, "/health/live")
|
||||
ready, ready_s = probe_inside_timed(replica, "/health/ready")
|
||||
assert live == 200 and ready == 503 # ... but not ready
|
||||
assert live_s + ready_s < 4.5, ("replica froze while its dependencies were unreachable", live_s, ready_s)
|
||||
seen = instances_seen(api, actor["token"], 40)
|
||||
assert replica["instance"] not in seen and len(seen) == 40
|
||||
for i in range(20): # writes keep working, only through the ready replicas
|
||||
|
||||
Reference in New Issue
Block a user