Skip to content

Commit

Permalink
fixup! Sync release leadership on stop
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhoerberg committed Dec 10, 2024
1 parent 8ef6506 commit 8403419
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions spec/etcd_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,9 @@ describe LavinMQ::Etcd do
cluster.run do |etcds|
etcd = LavinMQ::Etcd.new(cluster.endpoints)
key = "foo/#{rand}"
lease = etcd.elect(key, "bar", 1)
lease = etcd.elect(key, "bar", ttl: 1)
etcds.first(2).each &.terminate(graceful: false)
unless lease.wait(15.seconds)
fail "should lose the leadership"
end
lease.wait(15.seconds).should be_true, "should lose the leadership"
end
end

Expand All @@ -88,11 +86,9 @@ describe LavinMQ::Etcd do
cluster.run do |etcds|
etcd = LavinMQ::Etcd.new(cluster.endpoints)
key = "foo/#{rand}"
lease = etcd.elect(key, "bar", 1)
lease = etcd.elect(key, "bar", ttl: 1)
etcds.sample.terminate(graceful: false)
unless lease.wait(6.seconds)
fail "should not lose the leadership"
end
lease.wait(6.seconds).should be_false, "should not lose the leadership"
end
end

Expand Down

0 comments on commit 8403419

Please sign in to comment.