lab7: BROKER_URL из окружения, Redis operator для регрессии ACL, исправления тестов, no-new-privileges tempo-init; перенос исправлений lab6

This commit is contained in:
2026-11-12 14:19:15 +03:00
parent b5b55fda89
commit 1c453e9f0a
16 changed files with 104 additions and 33 deletions
+6 -6
View File
@@ -129,7 +129,7 @@ def scenario_mtls(c):
'trusted_ca_cn_lb': probe('amqp', '-cert', p + 'lb.crt', '-key', p + 'lb.key'),
'worker': probe('amqp', '-cert', p + 'worker.crt', '-key', p + 'worker.key'),
'relay': probe('amqp', '-cert', p + 'relay.crt', '-key', p + 'relay.key'),
'plaintext_5672': probe('plain', '-addr', 'rabbitmq:5672', '-send', 'AMQP\x00\x00\x09\x01'),
'plaintext_5672': probe('plain', '-addr', 'rabbitmq:5672', '-send', 'AMQP'),
}
for k in ('foreign_ca', 'trusted_ca_cn_attacker', 'trusted_ca_cn_lb'):
check(denied(broker[k].get('connect')), 'broker %s not rejected: %s' % (k, broker[k]))
@@ -190,7 +190,7 @@ def scenario_mtls(c):
def scenario_acl(c):
alice, bob, eve, chat = c.bootstrap()
att = c.call('POST', '/api/v1/chats/%s/attachments?filename=a.png' % chat['id'], 202, actor=alice, raw=SAMPLE,
headers={'Content-Type': 'image/png'})['json']
headers={'Content-Type': 'image/png'}, schema='Attachment')['json']
wait_status(c, bob, att['id'], ('ready',))
res = {}
res['outsider_metadata'] = c.call('GET', '/api/v1/attachments/' + att['id'], (404,), actor=eve)['status']
@@ -350,7 +350,7 @@ def scenario_rotation(c):
time.sleep(35) # SECRETS_REFRESH 30 s
# Старые соединения закрываются (как при отзыве); новые открываются с новым паролем
psql("SELECT count(pg_terminate_backend(pid)) FROM pg_stat_activity WHERE usename = 'app_api'")
time.sleep(5)
time.sleep(35) # pgx health check (30 s) выбрасывает разорванные соединения
res['db_old_password'] = probe('db', '-user', 'app_api', '-stdin', stdin=old_pw).get('connect')
check(denied(res['db_old_password']), 'old db password still works')
res['api_after_db_rotation'] = c.call('GET', '/api/v1/chats', actor=alice)['status']
@@ -358,7 +358,7 @@ def scenario_rotation(c):
bootstrap('rotate-s3', 'worker')
time.sleep(35)
att = c.call('POST', '/api/v1/chats/%s/attachments?filename=r.png' % chat['id'], 202, actor=alice, raw=SAMPLE,
headers={'Content-Type': 'image/png'})['json']
headers={'Content-Type': 'image/png'}, schema='Attachment')['json']
res['upload_after_s3_rotation'] = wait_status(c, bob, att['id'], ('ready', 'failed'), timeout=150)['status']
check(res['upload_after_s3_rotation'] == 'ready', 'worker did not pick rotated S3 key')
# 3) leaf API: перевыпуск на месте, без рестарта; LB видит новый serial
@@ -409,14 +409,14 @@ def scenario_lifecycle(c):
bootstrap('seal')
t_seal = time.time()
att = c.call('POST', '/api/v1/chats/%s/attachments?filename=s.png' % chat['id'], 202, actor=alice, raw=SAMPLE,
headers={'Content-Type': 'image/png'})['json']
headers={'Content-Type': 'image/png'}, schema='Attachment')['json']
res['upload_while_sealed'] = wait_status(c, bob, att['id'], ('ready', 'failed'), timeout=120)['status']
compose('restart', 'worker')
time.sleep(25)
wlogs = compose('logs', '--no-color', '--since', '30s', 'worker').stdout
res['worker_restart_while_sealed'] = 'openbao not ready' in wlogs or 'sealed' in wlogs
att2 = c.call('POST', '/api/v1/chats/%s/attachments?filename=s2.png' % chat['id'], 202, actor=alice, raw=SAMPLE,
headers={'Content-Type': 'image/png'})['json']
headers={'Content-Type': 'image/png'}, schema='Attachment')['json']
time.sleep(5)
res['upload_accepted_while_worker_blocked'] = att2['status']
bootstrap('unseal')