ClientUtils.RunLink (client_utils v0.3.2)

View Source

A test run's link to the CodeMySpec harness that started it.

The harness names itself in the run's environment: CMS_HARNESS_NODE, CMS_HARNESS_COOKIE and CMS_RUN_ID, and optionally CMS_RUN_LISTENER, the process to report to (by default the harness's CmsHarness.RunLink). The run joins that node and sends each event as it happens to that process. It halts when the harness process that owns it goes away, so a run never outlives its harness, unless it keeps a stream of its events for the harness to re-attach to (outlive_harness: true): that run finishes, and what it would have reported is dropped. A run started with none of these runs as a plain mix test.

Summary

Functions

Join the harness named in the environment, or nil when none is named. A harness that is named but cannot be reached halts the run before any test, unless the run outlives its harness (see on_harness_lost/1).

What a run does when its harness goes away: halts, unless it outlives its harness, when it carries on and stops reporting.

Send one event to the harness. A run without a link sends nothing.

Types

t()

@type t() :: %ClientUtils.RunLink{
  harness: node(),
  listener: atom(),
  run_id: integer()
}

Functions

join(opts \\ [])

@spec join(keyword()) :: t() | nil

Join the harness named in the environment, or nil when none is named. A harness that is named but cannot be reached halts the run before any test, unless the run outlives its harness (see on_harness_lost/1).

on_harness_lost(bool)

@spec on_harness_lost(boolean()) :: :halt | :continue

What a run does when its harness goes away: halts, unless it outlives its harness, when it carries on and stops reporting.

report(link, event)

@spec report(t() | nil, map()) :: :ok

Send one event to the harness. A run without a link sends nothing.