add level 3 and 4
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
"""Synthetic upload with a known W3C trace ID; wait through a worker restart."""
|
||||
import secrets
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'tests'))
|
||||
from client import Client
|
||||
|
||||
client = Client()
|
||||
actor, _, _, chat = client.bootstrap()
|
||||
trace_id = secrets.token_hex(16)
|
||||
parent_id = secrets.token_hex(8)
|
||||
content = (Path(__file__).resolve().parents[1] / 'tests/fixtures/sample.png').read_bytes()
|
||||
attachment = client.call('POST', '/api/v1/chats/' + chat['id'] + '/attachments?filename=sample.png', 202,
|
||||
actor=actor, raw=content, headers={'Content-Type':'image/png',
|
||||
'traceparent':f'00-{trace_id}-{parent_id}-01'}, schema='Attachment')['json']
|
||||
print('trace_id:', trace_id, 'attachment_id:', attachment['id'], flush=True)
|
||||
started = time.monotonic()
|
||||
result = client.wait_ready(actor, attachment, wait_seconds=150)
|
||||
print('status:', result['status'], 'elapsed_seconds:', round(time.monotonic()-started, 3), flush=True)
|
||||
Reference in New Issue
Block a user