ExMoQ.Testing.Relay (ExMoQ.Relay v0.1.0)

Copy Markdown View Source

A relay for ExUnit tests, reached over TCP and stopped with the test.

%ExMoQ.Relay.Info{tcp: url} = ExMoQ.Testing.Relay.start_supervised!()

To stop it before the test ends, start it with ExUnit directly:

relay = start_supervised!({ExMoQ.Relay, ExMoQ.Testing.Relay.options()}, id: :relay)
ExMoQ.Relay.info(relay).tcp
stop_supervised!(:relay)

Summary

Functions

A TCP port nothing listens on right now, for a relay to bind.

Options for a test relay: TCP only, on a port that is free as they are built.

Starts a relay with options/1 under the test supervisor and blocks until it is ready.

Functions

free_port()

@spec free_port() :: :inet.port_number()

A TCP port nothing listens on right now, for a relay to bind.

options(binary \\ nil)

@spec options(Path.t() | nil) :: ExMoQ.Relay.options()

Options for a test relay: TCP only, on a port that is free as they are built.

start_supervised!(binary \\ nil)

@spec start_supervised!(Path.t() | nil) :: ExMoQ.Relay.Info.t()

Starts a relay with options/1 under the test supervisor and blocks until it is ready.

Raises if there is no binary, or the relay exits or is not ready in time.