From b14c2a21551b3790e4419340ad862dc2fa904c56 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sat, 26 Sep 2026 06:35:38 +0100 Subject: Check that reads lend a stable version A 1 MiB read sent over a slow socket must carry the version it read while the document is replaced five times meanwhile. --- tests/check.py | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'tests/check.py') diff --git a/tests/check.py b/tests/check.py index 2682917..83afac9 100644 --- a/tests/check.py +++ b/tests/check.py @@ -16,8 +16,9 @@ escapes and number text follow their stated rules. 9. Server: the HTTP document server running editor.aup answers random requests exactly as the server running editor.pure, on persistent and - pipelined connections too; concurrent edits share commits, and every - acknowledged edit survives kill -9. + pipelined connections too; a read lends the stored extents and still + carries its version while the document changes; concurrent edits share + commits, and every acknowledged edit survives kill -9. 8. Stored state: the list app and the text editor run on a tree store, restarting at random points (every other run saving in bursts), and still match their reference models. @@ -808,6 +809,37 @@ def server_pipelining(aup, pure, work): return len(answers) + 3 * len(expected) +def server_lent_reads(aup, pure, work): + """A read lends the stored document's extents instead of copying them: a + 1 MiB answer sent slowly still carries the version read while the + document is replaced five times meanwhile.""" + import socket + import struct + module = work / 'editor-lent.pmod' + compile_module(aup, ROOT / 'examples/editor.aup', module) + host = HttpHost([pure / 'build/pure-serve', '--module', module, '--store', work / 'lent']) + big = bytes(range(256)) * 4096 + try: + assert host.request('PUT', 'big', struct.pack('