Skip to content

Commit

Permalink
spec: kill the node when testing futures as the result of an operatio…
Browse files Browse the repository at this point in the history
…n may hit back while node is being "gently" terminated
  • Loading branch information
niamster committed Feb 16, 2015
1 parent 344909f commit 313b575
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spec/dcell/node_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def wait_for_actor(id)
30.times do
node = DCell::Node[id]
begin
return node if node and node.all
return node if node and node.all and node.alive?
rescue Celluloid::DeadActorError, Celluloid::Task::TerminatedError
end
sleep 1
Expand Down Expand Up @@ -41,7 +41,7 @@ def wait_for_death(time)
10.times do
node = DCell::Node[id]
begin
if node and node[:test_actor].mutable != @unique
if node and node.alive? and node[:test_actor].mutable != @unique
return
end
sleep 1
Expand All @@ -68,17 +68,17 @@ def wait_for_death(time)

it "raises exception on access to the value of future operation if remote actor dies" do
actor = @node[:test_actor]
actor.async.suicide 0
actor.async.suicide 0, :KILL
future = actor.future.value
wait_for_death 0
expect {future.value}.to raise_error Celluloid::DeadActorError
end

it "raises exception on access to the value of future operation which crashed the actor" do
actor = @node[:test_actor]
future = actor.future.suicide 0
future = actor.future.suicide 0, :KILL
wait_for_death 0
expect {future.value}.to raise_error Celluloid::DeadActorError
expect {p future.value}.to raise_error Celluloid::DeadActorError
end

it "raises exception on sync operation if remote actor dies during async operation" do
Expand Down

0 comments on commit 313b575

Please sign in to comment.