package tezt

  1. Overview
  2. Docs

Runner specifications for processes spawned remotely using SSH.

Runner specifications for processes spawned remotely using SSH.

type t = private {
  1. id : int;
  2. address : string;
  3. ssh_alias : string option;
  4. ssh_user : string option;
  5. ssh_port : int option;
  6. ssh_id : string option;
}

Connection information for a runner.

See create.

val create : ?ssh_alias:string -> ?ssh_user:string -> ?ssh_port:int -> ?ssh_id:string -> address:string -> unit -> t

Create a runner.

This function does not start any SSH connection, it only stores SSH connection information in a record.

  • ssh_alias is the alias in the ssh config file.
  • ssh_user is the username on the remote machine.
  • ssh_port is the port on the remote machine.
  • ssh_id is the path to the identity file.
  • address is the IP address of the remote machine.
val get_local_public_ip : unit -> string

Get the IP address of the local machine as perceived by other runners.

Use this if you need a runner to reach a process that is running on the local machine.

This returns "127.0.0.1" by default, but you can set it with set_local_public_ip.

val set_local_public_ip : string -> unit

Set the IP address of the local machine as perceived by other runners.

val address : ?hostname:bool -> ?from:t -> t option -> string

Get the IP / DNS address of a runner.

Usage: address ~from runner

Return the address at which a source node from can contact runner.

If the source node from is not specified, return the address of runner as given to create. If runner itself is None, return "127.0.0.1" or "localhost" if the hostname variable is set to true (default false).

If from is specified:

  • if runner is None, return get_local_public_ip ();
  • if from and runner are the same runner, return "127.0.0.1";
  • else, return the address of runner.
module Shell : sig ... end

Shell command representation.

val wrap_with_ssh : t -> Shell.t -> string * string list

Wrap a shell command into an SSH call.

Usage: wrap_with_ssh runner shell

Return (name, arguments) where name is "ssh" and arguments are arguments to pass to SSH to execute shell on runner.

val wrap_with_ssh_pid : t -> Shell.command -> string * string list

Same as wrap_with_ssh, but print the PID on stdout first.

The PID can be used later on to, for instance, kill the remote process. Indeed, killing the local SSH process will not necessarily kill the remote process.

module Sys : sig ... end

Extension to Stdlib.Sys that can also execute on remote runners.

OCaml

Innovation. Community. Security.