Skip to content

Commit 8520a48

Browse files
committed
testing: Improve error reporting in grpcwebproxy
1 parent c396cb9 commit 8520a48

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

libs/gl-testing/gltesting/grpcweb.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@ def auth(self, request: Request) -> bool:
154154
ts = request.headers.get("glts", None)
155155

156156
if not pk:
157-
self.logger.warn(f"Missing public key header")
157+
self.logger.warning(f"Missing public key header: headers={request.headers}")
158158
return False
159159

160160
if not sig:
161-
self.logger.warn(f"Missing signature header")
161+
self.logger.warning(f"Missing signature header: headers={request.headers}")
162162
return False
163163

164164
if not ts:
165-
self.logger.warn(f"Missing timestamp header")
165+
self.logger.warning(f"Missing timestamp header: headers={request.headers}")
166166
return False
167167

168168
# TODO Check the signature.
@@ -212,12 +212,15 @@ def proxy(self, request: Request):
212212
)
213213

214214
try:
215+
self.logger.debug(f"Sending grpc request req={req}, payload={content} to url={url}")
215216
res = client.send(req)
216217
# Capture the error from header and send it in the body as well
217-
if res.headers.get("grpc-status", "0") != "0":
218-
grpc_status = res.headers.get("grpc-status")
218+
status = res.headers.get("grpc-status", "0")
219+
logging.debug(f"Server returned grpc-status={status}")
220+
if status != "0":
219221
error_message = res.headers.get("grpc-message", "None")
220-
self.logger.warning(f"gRPC status code received: {grpc_status}")
222+
self.logger.error(f"Received grpc-status={status}, error={error_message}")
223+
self.logger.warning(f"gRPC status code received: {status}")
221224
self.logger.warning(f"gRPC message received: {error_message}")
222225
error = error_message.encode("utf-8")
223226
error_res = struct.pack("!cI", request.flags, len(error)) + error

libs/gl-testing/gltesting/node.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def __init__(
9595
'--dev-bitcoind-poll=5',
9696
'--dev-fast-gossip',
9797
'--offline',
98+
'--allow-deprecated-apis=true',
9899
#'--experimental-anchors',
99100
'--developer', # TODO Make this multi-version capable
100101
]

libs/gl-testing/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies = [
1010
"gl-client",
1111
"grpcio-tools>=1.66",
1212
"grpcio>=1.66.0",
13-
"httpx[http2]>=0.28",
13+
"httpx[http2]==0.27.2",
1414
"purerpc>=0.8.0",
1515
"pyln-client==24.2",
1616
"pyln-testing==24.2",

libs/gl-testing/tests/test_grpc_web.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_node_grpc_web(scheduler, node_grpc_web_proxy, clients):
4747
c = clients.new()
4848
c.register(configure=True)
4949
n = c.node()
50-
_s = c.signer().run_in_thread()
50+
_s = c.signer().run_in_thread()
5151
info = n.get_info()
5252

5353
# Now extract the TLS certificates, so we can sign the payload.

0 commit comments

Comments
 (0)