Packages

Spin up dynamic clusters in ExUnit tests with no special setup necessary.

Current section

Files

Jump to
ex_unit_cluster lib ex_unit_cluster case.ex
Raw

lib/ex_unit_cluster/case.ex

defmodule ExUnitCluster.Case do
@moduledoc """
Extends ExUnit.Case to allow dynamic cluster creation
"""
alias ExUnitCluster.Manager
use ExUnit.CaseTemplate
setup ctx do
opts = [test_module: ctx.module, test_name: ctx.test]
{:ok, cluster} = Manager.start_link(opts)
Map.put(ctx, :cluster, cluster)
end
end