37 lines
1.3 KiB
Python
Executable File
37 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Crash after publisher confirm creates a harmless duplicate delivery."""
|
|
import os
|
|
from pathlib import Path
|
|
import subprocess
|
|
|
|
from client import Client, arguments, check, run
|
|
|
|
|
|
def executable(value):
|
|
path = Path(value).resolve()
|
|
check(path.is_file() and os.access(path, os.X_OK), str(path) + ': not executable')
|
|
return path
|
|
|
|
|
|
def main():
|
|
def configure(parser):
|
|
parser.add_argument('--stop-publisher-script', required=True)
|
|
parser.add_argument('--crash-publisher-script', required=True)
|
|
|
|
args = arguments('Crash after publisher confirm', configure)
|
|
stop = executable(args.stop_publisher_script)
|
|
crash = executable(args.crash_publisher_script)
|
|
client = Client(args.base_url, args.ca_file)
|
|
alice, bob, _eve, chat = client.bootstrap()
|
|
subprocess.run([str(stop)], check=True)
|
|
attachment, _original = client.attachment(alice, chat)
|
|
subprocess.run([str(crash)], check=True)
|
|
ready = client.wait_ready(bob, attachment)
|
|
names = [item['name'] for item in ready['variants']]
|
|
check(sorted(names) == ['crop', 'optimized', 'thumbnail'], 'duplicate or missing variants')
|
|
print('PASS: confirm-before-outbox-mark duplicate produced one logical result')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
run(main)
|