summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-30 15:14:00 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commit864407b240b812743d6f57a56daf9706b36fc027 (patch)
treef2934c7c82602b456cdbacbe446b7e58b4c2d96e /test
parent1d0f8cd158bb47941c0187d32422787c92e8feeb (diff)
downloadpardes-864407b240b812743d6f57a56daf9706b36fc027.tar.gz
pardes-864407b240b812743d6f57a56daf9706b36fc027.zip
pardes --wait for a new name waits on the pane it made, by serial, and a pane closed before it looks is done, not a failure
fs.py's `pardes --wait 'wait new.txt'` failed two runs in three on the 0.0.8 merge. The stress case repeats the test's steps: 4 of 50 failed under load, each with "pardes: --wait: no pane shows that file". A new name's launch makes its pane, names it, then found it again by path in /index. The script had already seen the name, saved and removed the pane by then, so the lookup missed and --wait exited 1. Now the launch hands --wait the serial pane/new gave it. After a look, finding no pane on the file means that pane is already closed, which is the end --wait waits for: exit 0. The follow with its /index recheck covers a close in between, as before. Under the same load the stress case went 0 of 100. The same load showed a test race too, at fs.py's second Restore. The exec write is answered before the hang-up, but the client's clunk after it can meet the connection already cut. The test now requires the answer and tolerates the reset. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test')
-rw-r--r--test/fs.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/fs.py b/test/fs.py
index b02b9e45..3f11269a 100644
--- a/test/fs.py
+++ b/test/fs.py
@@ -1117,7 +1117,15 @@ def test(binary, quic=False):
except OSError as refused:
assert 'Modified' in str(refused), refused
assert old.read('/pane/1/body') == b'changed after dump\n'
- execute(old, control, 'Restore ' + str(saved))
+ # Answered before the hang-up: the write's reply comes; the
+ # clunk after it may meet the connection already cut.
+ restore = old.open(f'/pane/{control}/exec', 1)
+ line = ('Restore ' + str(saved) + '\n').encode()
+ old.rpc(118, struct.pack('<IQI', restore, 0, len(line)) + line)
+ try:
+ old.close(restore)
+ except (EOFError, OSError):
+ pass
# Refused while the connections are cut, or cut already.
try:
old.read_fid(held_body)
@@ -1315,7 +1323,8 @@ def test(binary, quic=False):
client.write(f'/pane/{named}/body', b'new\n')
execute(client, named, 'Save')
client.remove(f'/pane/{named}')
- assert made.wait(timeout=5) == 0
+ code = made.wait(timeout=5)
+ assert code == 0, (code, made.stderr.read())
assert fresh.read_bytes() == b'new\n'
# ...in a directory not there either: forwarded all the same, and
# Save makes the directories.