ExUnit.ClusteredCase.Node (ex_unit_clustered_case v0.5.0)

This module handles starting new nodes

You can specify various options when starting a node:

  • :name, takes either a string or an atom, in either long or short form, this sets the node name and id.
  • :boot_timeout, specifies the amount of time to wait for a node to perform it's initial boot sequence before timing out.
  • :init_timeout, specifies the amount of time to wait for the node agent to complete initializing the node (loading and starting required applications, applying configuration, loading test modules, and executing post-start functions).
  • :erl_flags, a list of arguments to pass to erl when starting the node, e.g. ["-init_debug"].
  • :env, a list of tuples containing environment variables to export in the node's environment, e.g. [{"PORT", "8080"}].
  • :config, a Keyword list containing configuration overrides to apply to the node, should be in the form of [app: [key: value]].
  • :post_start_functions, a list of functions, either captured or in {module, function, args} format, which will be invoked on the node after it is booted and initialized. Functions must be zero-arity.
  • :stdout, redirect output to a device or process with stdout: :standard_error | :standard_io | pid.

  • :capture_log, capture the entire log from a node with capture_log: true, can get the captured logs for a specific node with Cluster.log(node).

Link to this section Summary

Link to this section Types

@type fun() :: (() -> term()) | {module(), atom(), [term()]}
Link to this type

node_error()

@type node_error() ::
  :already_started
  | :started_not_connected
  | :boot_timeout
  | :init_timeout
  | :not_alive
@type node_opt() ::
  {:name, String.t() | atom()}
  | {:boot_timeout, pos_integer()}
  | {:init_timeout, pos_integer()}
  | {:erl_flags, [String.t()]}
  | {:env, [{String.t(), String.t()}]}
  | {:config, Keyword.t()}
  | {:post_start_functions, [(... -> any())]}
  | {:stdout, atom() | pid()}
  | {:capture_log, boolean()}
@type node_opts() :: [node_opt()]