ex_unit_clustered_case v0.3.1 ExUnit.ClusteredCase.Cluster
This module is responsible for managing the setup and lifecycle of a single cluster.
Link to this section Summary
Functions
Invoke a function on a specific member of the cluster
Invoke a function on a specific member of the cluster
Applies a function on all nodes in the cluster
Applies a function on all nodes in the cluster
Heals all partitions in the cluster
Get the captured log for a specific node in the cluster
Maps a function across all nodes in the cluster
Maps a function across all nodes in the cluster
Retrieve a list of nodes in the given cluster
Partition the cluster based on the provided specification
Retrieve the partitions this cluster is composed of
Retrieve the name of a random node in the given cluster
Repartitions the cluster based on the provided specification
Starts a new cluster with the given specification
Stops a running cluster. Expects the pid of the cluster manager process
Link to this section Types
cluster_opt() :: {:nodes, [node_spec()]} | {:cluster_size, pos_integer()} | {:partitions, pos_integer() | [pos_integer()] | [[atom()]]} | {:env, [{String.t(), String.t()}]} | {:erl_flags, [String.t()]} | {:config, Keyword.t()} | {:boot_timeout, pos_integer()} | {:init_timeout, pos_integer()} | {:post_start_functions, [callback()]}
Link to this section Functions
Invoke a function on a specific member of the cluster
Invoke a function on a specific member of the cluster
Applies a function on all nodes in the cluster.
Applies a function on all nodes in the cluster.
Heals all partitions in the cluster.
Get the captured log for a specific node in the cluster
Maps a function across all nodes in the cluster.
Returns a list of results, where each element is the result from one node.
Maps a function across all nodes in the cluster.
Returns a list of results, where each element is the result from one node.
Retrieve a list of nodes in the given cluster
Partition the cluster based on the provided specification.
You can specify partitions in one of the following ways:
- As an integer representing the number of partitions
- As a list of integers representing the number of nodes in each partition
- As a list of lists, where each sub-list contains the nodes in that partition
If your partitioning specification cannot be complied with, an error is returned
Examples
test "partition by number of partitions", %{cluster: c} do
Cluster.partition(c, 2)
end
test "partition by number of nodes per partition", %{cluster: c} do
Cluster.partition(c, [2, 2])
end
test "partition by list of nodes in each partition", %{cluster: c} do
Cluster.partition(c, [[:a, :b], [:c, :d]])
end
Retrieve the partitions this cluster is composed of
Retrieve the name of a random node in the given cluster
Repartitions the cluster based on the provided specification.
See partition/2
for specification details.
Repartitioning performs the minimal set of changes required to converge on the partitioning scheme in an attempt to minimize the amount of churn. That said, some churn is expected, so bear that in mind when writing tests with partitioning events involved.
Starts a new cluster with the given specification
Stops a running cluster. Expects the pid of the cluster manager process.