test: Map cli CalledProcessError on server error to JSONRPCException

Like authproxy.py, so that tests can work without having to think whether the cli was used or not.
This commit is contained in:
MarcoFalke
2026-06-27 18:59:29 +02:00
parent c4fbd3c721
commit fa2bd96cc0
2 changed files with 10 additions and 4 deletions

View File

@@ -967,6 +967,13 @@ class TestNodeCLI():
if match:
code, message = match.groups()
raise JSONRPCException(dict(code=int(code), message=message))
match = re.match(r'error: Server response: (.*)\n?$', cli_stderr)
if match:
message = match.group(1)
raise JSONRPCException(dict(
code=-342,
message=f"non-JSON HTTP response with '503 Service Unavailable' from server: {message}",
), http_status=503)
# Ignore cli_stdout, raise with cli_stderr
raise subprocess.CalledProcessError(returncode, p_args, output=cli_stderr)
try: