This commit is contained in:
2026-11-06 19:22:27 +03:00
parent 482e7ff477
commit ff6d7c1e73
20 changed files with 58826 additions and 3 deletions
+10 -3
View File
@@ -92,7 +92,7 @@ else:
''', fault=fault)
def main():
def main(outbox_only=False):
client = Client(os.getenv('BASE_URL', 'http://127.0.0.1:8080'))
alice, bob, eve, chat = client.bootstrap()
try:
@@ -103,7 +103,9 @@ def main():
check(not state(aid)['published'], 'outbox was already published')
client.message(alice, chat, '', attachments=[aid])
client.call('GET', f'/api/v1/attachments/{aid}/content', 409, actor=bob)
compose('restart', 'api')
# Hard crash after durable COMMIT while dispatcher is stopped: no publish yet.
compose('kill', '-s', 'SIGKILL', 'api')
compose('start', 'api')
ready(client)
check(state(aid)['status'] == 'queued', 'API restart lost upload')
compose('start', 'dispatcher')
@@ -119,6 +121,8 @@ def main():
check(download['headers'].get_content_type() == variant['content_type'], 'variant MIME mismatch')
check(client.call('GET', f'/api/v1/attachments/{aid}/content', actor=bob)['bytes'] == content, 'original changed')
print('PASS: outbox COMMIT/publish gap, stopped worker, API and broker restart', flush=True)
if outbox_only:
return
for fault in ('after_objects', 'after_commit'):
compose('stop', 'worker')
@@ -194,4 +198,7 @@ else:
if __name__ == '__main__':
main()
import argparse
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--outbox-only', action='store_true', help='Only the COMMIT/publish crash scenario')
main(parser.parse_args().outbox_only)