diff --git a/scripts/drosync-local-daily-acceptance.py b/scripts/drosync-local-daily-acceptance.py index 779228fb..8a3b7971 100644 --- a/scripts/drosync-local-daily-acceptance.py +++ b/scripts/drosync-local-daily-acceptance.py @@ -67,6 +67,8 @@ class Control(http.server.ThreadingHTTPServer): self.uploads={} self.part_paths={} self.part_attempts={} + self.held=None + self.release_held=threading.Event() def session(self, sid): s = dict(self.sessions[sid]) @@ -128,6 +130,16 @@ class Handler(http.server.BaseHTTPRequestHandler): if spool:spool.write(part) n += len(part) time.sleep(0.001 if number else 0.015) + # Client progress counts bytes handed to loopback socket buffers and is + # sampled once per second, so a freely streaming body can read as 0 or + # complete in every sample. Park the first direct body mid-stream until + # the harness has paused, keeping that upload verifiably in flight. The + # body must exceed what buffers absorb while held: over 5 MiB on Linux. + if args.scenario=='pause-resume' and not number: + with c.lock: + hold=c.held is None + if hold:c.held=(iid,n) + if hold:c.release_held.wait(30) if args.scenario=='put-503' and c.injections==0: c.injections+=1 return self.reply({'code':'injected_storage_unavailable','message':'503 fixture','retryable':True},503) @@ -250,7 +262,7 @@ try: if args.scenario.startswith('concurrency-'):names=[f'parallel_{n}.bin' for n in range(8)] for name in names: f = episode / name - f.write_bytes(b'page' if args.scenario=='pagination-1003' else (name.encode()*2000000)[:4*1024*1024 if args.scenario=='pause-resume' or args.scenario.startswith('concurrency-') else 12*1024*1024]) + f.write_bytes(b'page' if args.scenario=='pagination-1003' else (name.encode()*2000000)[:4*1024*1024 if args.scenario.startswith('concurrency-') else 12*1024*1024]) if args.scenario in ['multipart-large','multipart-crash']: block=hashlib.md5(name.encode()).digest()*32768;remaining=(257 if name=='large_257.bin' else 321)*1024*1024 with f.open('wb') as writer: @@ -286,10 +298,13 @@ try: assert time.monotonic() < deadline, 'isolated upload exceeded 180 seconds' with http.open(f'http://127.0.0.1:{port}/api/progress', timeout=5) as response: progress=json.load(response);observed += progress['items'] - if not triggered and args.scenario in ['pause-resume','abort-active','crash-resume','source-rewrite','source-delete','multipart-crash'] and (args.scenario!='multipart-crash' or any(server.uploads.values())) and any(0