Skip to content

Commit

Permalink
fixup! Channel pool
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhoerberg committed Feb 17, 2024
1 parent 928e3c9 commit 6f8688c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
6 changes: 3 additions & 3 deletions spec/amqproxy_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ describe AMQProxy::Server do
end
wait_for_channel.receive.should eq 2 # wait 2
s.client_connections.should eq 2
s.upstream_connections.should eq 2
s.upstream_connections.should eq 1
spawn s.stop_accepting_clients
wait_for_channel.receive.should eq 3 # wait 3
s.client_connections.should eq 1
s.upstream_connections.should eq 2 # since connection stays open
s.upstream_connections.should eq 1 # since connection stays open
spawn do
begin
AMQP::Client.start("amqp://localhost:5673") do |conn|
Expand All @@ -177,7 +177,7 @@ describe AMQProxy::Server do
end
wait_for_channel.receive.should eq 4 # wait 4
s.client_connections.should eq 1 # since the new connection should not have worked
s.upstream_connections.should eq 2 # since connections stay open
s.upstream_connections.should eq 1 # since connections stay open
wait_for_channel.receive.should eq 5 # wait 5
s.client_connections.should eq 0 # since now the server should be closed
s.upstream_connections.should eq 1
Expand Down
30 changes: 0 additions & 30 deletions spec/spec_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,3 @@ require "../src/amqproxy/version"
require "amqp-client"

MAYBE_SUDO = (ENV.has_key?("NO_SUDO") || `id -u` == "0\n") ? "" : "sudo "

# Spec timeout borrowed from Crystal project:
# https://github.com/crystal-lang/crystal/blob/1.10.1/spec/support/mt_abort_timeout.cr

private SPEC_TIMEOUT = 15.seconds

# Spec.around_each do |example|
# done = Channel(Exception?).new
#
# spawn(same_thread: true) do
# begin
# example.run
# rescue e
# done.send(e)
# else
# done.send(nil)
# end
# end
#
# timeout = SPEC_TIMEOUT
#
# select
# when res = done.receive
# raise res if res
# when timeout(timeout)
# _it = example.example
# ex = Spec::AssertionFailed.new("spec timed out after #{timeout}", _it.file, _it.line)
# _it.parent.report(:fail, _it.description, _it.file, _it.line, timeout, ex)
# end
# end

0 comments on commit 6f8688c

Please sign in to comment.