Module Tezt_mavryk.Signer

type t

A signer instance

val init : ?name:string -> ?color:Tezt_wrapper.Log.Color.t -> ?event_pipe:string -> ?base_dir:string -> ?uri:Uri.t -> ?runner:Tezt_wrapper.Runner.t -> ?keys:Account.key list -> ?magic_byte:string -> unit -> t Lwt.t

Initialize a signer.

This creates a signer, waits for it to be ready, and then returns it.

The signer does not rely on a node for its initialization. While initializing the signer, we add a list of accounts keys that the signer is going to use for signing.

We also pass the uri that the signer will use to answer signing calls.

The standard output and standard error output of the signer will be logged with prefix name and color color.

Default event_pipe is a temporary file whose name is derived from name. It will be created as a named pipe so that signer events can be received.

The signer is configured to use its private base directory.

If runner is specified, the signer will be spawned on this runner using SSH.

The allowed magic byte value for the signer can be specified with magic_byte.

val terminate : ?timeout:float -> t -> unit Lwt.t

Send SIGTERM and wait for the process to terminate.

Default timeout is 30 seconds, after which SIGKILL is sent.

val kill : t -> unit Lwt.t

Send SIGKILL and wait for the process to terminate.

val log_events : ?max_length:int -> t -> unit

Register an event handler that logs all events.

Use this when you need to debug or reverse engineer incoming events. Usually you do not want to keep that in the final versions of your tests.

val wait_for : ?where:string -> t -> string -> (Tezt_wrapper.JSON.t -> 'a option) -> 'a Lwt.t

Same as wait_for_full but ignore metadata from the file descriptor sink.

More precisely, filter is applied to the value of field "fd-sink-item.v0"."event".<name>.

If the node receives a JSON value that does not match the right JSON structure, it is not given to filter and the event is ignored. See wait_for_full to know what the JSON value must look like.

type event = {
  1. name : string;
  2. value : Tezt_wrapper.JSON.t;
  3. timestamp : float;
}

Raw events.

val on_event : t -> (event -> unit) -> unit

Add a callback to be called whenever the node emits an event.

Contrary to wait_for functions, this callback is never removed.

Listening to events with on_event will not prevent wait_for promises to be fulfilled. You can also have multiple on_event handlers, although the order in which they trigger is unspecified.

val restart : t -> unit Lwt.t

Restart the daemon.

val uri : t -> Uri.t