lab5: завершение второго ревью
PNG: validate color-type/bit-depth pairs, reject duplicate IHDR/PLTE, non-consecutive IDAT, PLTE after IDAT, and trailing bytes after the zlib stream; keep accepting valid palette, split-IDAT, 16-bit, and Adam7 uploads. Replay: a newer failed unpublished version returns the attachment to queued, while a published ready version stays serving.
This commit is contained in:
@@ -6,6 +6,7 @@ FAULTS_ENABLED=1 and targeted failpoints, then restores the normal services.
|
||||
|
||||
python3 student-tests/lab5_faults.py --base-url http://localhost:8080
|
||||
"""
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
@@ -232,6 +233,41 @@ def scenario_lease_takeover(client, alice, chat):
|
||||
reset_relay()
|
||||
|
||||
|
||||
def scenario_replay_reprocessed_version(client, alice, chat):
|
||||
compose('stop', 'worker')
|
||||
attached, _ = client.attachment(alice, chat)
|
||||
reprocessed = json.loads(jobctl('reprocess', '-attachment', attached['id'], '-pipeline', '2').stdout)
|
||||
jid = reprocessed['ID']
|
||||
|
||||
worker_with(FAULTS_ENABLED='1', FAULT_TARGET_JOB=jid, FAULT_WORKER_FAIL='permanent')
|
||||
|
||||
deadline = time.monotonic() + 40
|
||||
last = ''
|
||||
while time.monotonic() < deadline:
|
||||
job_status = psql("select status from attachment_jobs where job_id='%s'" % jid)
|
||||
last = psql("select status || '|' || coalesce(error_code,'') from attachments where id='%s'" % attached['id'])
|
||||
if job_status == 'failed' and last.startswith('failed|'):
|
||||
break
|
||||
time.sleep(0.2)
|
||||
|
||||
check(job_status == 'failed' and last == 'failed|injected_failure',
|
||||
'reprocessed failure did not settle: ' + last)
|
||||
|
||||
compose('stop', 'worker')
|
||||
jobctl('replay', '-job', jid)
|
||||
projection = client.call(
|
||||
'GET', '/api/v1/attachments/' + attached['id'], actor=alice, schema='Attachment',
|
||||
)['json']
|
||||
check(projection['status'] == 'queued' and projection['error_code'] is None,
|
||||
'replay left stale terminal projection: ' + str(projection['status']))
|
||||
|
||||
reset_worker()
|
||||
client.wait_ready(alice, attached, wait_seconds=90)
|
||||
check(psql("select pipeline_version from attachments where id='%s'" % attached['id']) == '2',
|
||||
'replayed reprocess did not publish pipeline 2')
|
||||
print('replay of failed reprocess: queued projection restored, then ready at pipeline 2')
|
||||
|
||||
|
||||
def main():
|
||||
args = arguments('Lab5 level 4 fault injection')
|
||||
client = Client(args.base_url, args.ca_file)
|
||||
@@ -239,6 +275,7 @@ def main():
|
||||
|
||||
scenarios = [
|
||||
scenario_permanent_failure_and_replay,
|
||||
scenario_replay_reprocessed_version,
|
||||
scenario_transient_exhaustion,
|
||||
scenario_crash_after_first_variant,
|
||||
scenario_crash_after_commit,
|
||||
|
||||
Reference in New Issue
Block a user