From 37d43178342bc147e93fb963f8ec34405522c75c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Thir=C3=A9?= Date: Mon, 2 Dec 2024 09:43:23 +0100 Subject: [PATCH] Tezt/Tezos: Fix the rpc endpoint of a node with a remote runner --- tezt/lib_tezos/node.ml | 8 ++++++-- tezt/lib_tezos/node.mli | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tezt/lib_tezos/node.ml b/tezt/lib_tezos/node.ml index 8ea782536ce1..1749908f31b1 100644 --- a/tezt/lib_tezos/node.ml +++ b/tezt/lib_tezos/node.ml @@ -1091,10 +1091,14 @@ let get_version node = in return @@ String.trim output -let as_rpc_endpoint (t : t) = +let as_rpc_endpoint ?(local = false) (t : t) = let state = t.persistent_state in let scheme = if Option.is_some state.rpc_tls then "https" else "http" in - Endpoint.{scheme; host = state.rpc_host; port = state.rpc_port} + let host = + if local || Option.is_none t.persistent_state.runner then state.rpc_host + else Runner.address t.persistent_state.runner + in + Endpoint.{scheme; host; port = state.rpc_port} module RPC = struct module RPC_callers : RPC_core.CALLERS with type uri_provider := t = struct diff --git a/tezt/lib_tezos/node.mli b/tezt/lib_tezos/node.mli index 6c0b9bbc5e96..6a0607fbc09c 100644 --- a/tezt/lib_tezos/node.mli +++ b/tezt/lib_tezos/node.mli @@ -667,8 +667,9 @@ val upgrade_storage : t -> unit Lwt.t (** Run [octez-node --version] and return the node's version. *) val get_version : t -> string Lwt.t -(** Expose the RPC server address of this node as a foreign endpoint. *) -val as_rpc_endpoint : t -> Endpoint.t +(** Expose the RPC server address of this node as a foreign endpoint. + See [rpc_endpoint] for a description of the [local] argument. *) +val as_rpc_endpoint : ?local:bool -> t -> Endpoint.t module RPC : sig include RPC_core.CALLERS with type uri_provider := t -- GitLab