Стабилизация HTTPS-проверок и перезапуска стенда

This commit is contained in:
EgorAnti
2026-11-26 18:53:22 +03:00
parent 60fa12ce6e
commit 1ee35c54a7
5 changed files with 48 additions and 14 deletions
+8 -5
View File
@@ -36,7 +36,9 @@ def main():
script = Path(args.action_script).expanduser().resolve()
check(script.is_file() and os.access(script,os.X_OK),'action script must exist and be executable (chmod +x)')
check('.example.' not in script.name,'copy and implement the example hook first')
c = Client(args.base_url,args.ca_file,timeout=2)
# Bootstrap includes Argon2id and object-storage work. The tighter timeout
# is enabled only for the actual failover measurement below.
c = Client(args.base_url,args.ca_file,timeout=15)
alice,bob,eve,chat = c.bootstrap()
sent = c.message(alice,chat,'Сохранить при отказе')
original = sent['json']
@@ -50,6 +52,7 @@ def main():
env['TARGET_INSTANCE_ID'] = target
observed = set()
if args.mode=='failover':
c.timeout = 2
for _ in range(40):
observed.add(c.call('GET','/api/v1/users/me',actor=alice,schema='User')['headers']['X-Instance-Id'])
check(len(observed)>=2,'less than two API instances observed before failure; verify LB/session affinity')
@@ -61,18 +64,18 @@ def main():
try:
if args.mode=='persistence':
try:
code = proc.wait(timeout=90)
code = proc.wait(timeout=180)
except subprocess.TimeoutExpired:
raise Failure('restart hook exceeded 90 seconds') from None
raise Failure('restart hook exceeded 180 seconds') from None
check(code==0,'restart hook failed (inspect your script locally)')
deadline = time.monotonic()+120
deadline = time.monotonic()+180
while True:
try:
c.call('GET','/health/ready',schema='Health')
c.call('GET','/api/v1/users/me',actor=alice,schema='User')
break
except Failure:
check(time.monotonic()<deadline,'stack/session did not recover within 120 seconds')
check(time.monotonic()<deadline,'stack/session did not recover within 180 seconds')
time.sleep(0.5)
else:
first_recovery = None