MCPcopy Create free account
hub / github.com/cloudflare/cloudflared / generate_and_validate_http_events

Function generate_and_validate_http_events

component-tests/test_tail.py:156–171  ·  view source on GitHub ↗
(websocket: WebSocketClientProtocol, url: str, count_send: int)

Source from the content-addressed store, hash-verified

154
155# Every http request has two log lines sent
156async def generate_and_validate_http_events(websocket: WebSocketClientProtocol, url: str, count_send: int):
157 for i in range(count_send):
158 send_request(url)
159 # There are typically always two log lines for http requests (request and response)
160 count = 0
161 while True:
162 try:
163 req_line = await asyncio.wait_for(websocket.recv(), 2)
164 log_line = json.loads(req_line)
165 assert log_line["type"] == "logs"
166 assert log_line["logs"][0]["event"] == "http"
167 count += 1
168 except asyncio.TimeoutError:
169 # ignore timeout from waiting for recv
170 break
171 return count
172
173# Every http request has two log lines sent
174async def generate_and_validate_no_log_event(websocket: WebSocketClientProtocol, url: str):

Callers 2

test_streaming_logsMethod · 0.85

Calls 1

send_requestFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…