"""Дождаться HTTP readiness перед запуском проверок.""" import argparse import time import urllib.request parser=argparse.ArgumentParser() parser.add_argument('--base-url',default='http://localhost:8080') parser.add_argument('--replicas',type=int,default=1) args=parser.parse_args() observed=set() for _ in range(120): try: with urllib.request.urlopen(args.base_url+'/health/ready',timeout=2) as response: if response.status==200: observed.add(response.headers.get('X-Instance-Id')) if len(observed)>=args.replicas: print('PASS: API ready, replicas:', len(observed)) break time.sleep(0.1) except Exception: time.sleep(0.5) else: raise SystemExit('API readiness timeout')