Skip to content

Commit

Permalink
Add domain logic tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziosestito committed May 31, 2022
1 parent 380b7f3 commit 1110f85
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/trento/domain/cluster/cluster_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ defmodule Trento.ClusterTest do
alias Trento.Support.StructHelper

alias Trento.Domain.Commands.{
AbortClusterRollup,
CompleteChecksExecution,
RegisterClusterHost,
RequestChecksExecution,
Expand All @@ -24,6 +25,7 @@ defmodule Trento.ClusterTest do
ClusterHealthChanged,
ClusterRegistered,
ClusterRolledUp,
ClusterRollupFailed,
HostAddedToCluster,
HostChecksExecutionCompleted
}
Expand Down Expand Up @@ -799,5 +801,24 @@ defmodule Trento.ClusterTest do
{:error, :cluster_rolling_up}
)
end

test "should abort the rollup process" do
cluster_id = Faker.UUID.v4()

assert_events_and_state(
[
build(:cluster_registered_event, cluster_id: cluster_id),
%ClusterRolledUp{
cluster_id: cluster_id,
applied: false
}
],
AbortClusterRollup.new!(%{cluster_id: cluster_id}),
%ClusterRollupFailed{cluster_id: cluster_id},
fn state ->
assert state.rolling_up == false
end
)
end
end
end

0 comments on commit 1110f85

Please sign in to comment.