ЛР 3 — БВТ-2302 — Сабитов — на 3

This commit is contained in:
2026-12-01 18:09:13 +03:00
parent 0ab3a341aa
commit d79bf5c481
36 changed files with 1944 additions and 36 deletions
+20
View File
@@ -0,0 +1,20 @@
"""Wait until both real API aliases are observed through the LB."""
import os
import time
import urllib.request
base = os.environ.get('BASE_URL', 'http://localhost:8080')
seen = set()
deadline = time.monotonic() + 20
while time.monotonic() < deadline:
try:
with urllib.request.urlopen(base + '/health/ready', timeout=2) as reply:
seen.add(reply.headers['X-Instance-Id'])
except OSError:
pass
if {'api1', 'api2'} <= seen:
print('PASS: both replicas observed through LB')
break
time.sleep(0.15)
else:
raise SystemExit('Both API replicas did not return to LB')