Skip to content

Commit

Permalink
Bump amqp-client and activate pending specs
Browse files Browse the repository at this point in the history
  • Loading branch information
baelter committed Feb 12, 2025
1 parent 09e7357 commit 6108a07
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ shards:

amqp-client:
git: https://github.com/cloudamqp/amqp-client.cr.git
version: 1.2.9
version: 1.3.0

lz4:
git: https://github.com/84codes/lz4.cr.git
Expand Down
17 changes: 8 additions & 9 deletions spec/connection_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ class AMQP::Client::UnsafeConnection < AMQP::Client::Connection
ch = nil
@channels_lock.synchronize do
if id
# raise "channel_max reached" if id > @channel_max
# raise "channel_max reached" if @channel_max.positive? && id > @channel_max
if ch = @channels.fetch(id, nil)
return ch
else
ch = @channels[id] = Channel.new(self, id)
end
end
(1_u16..).each do |i| # (1.up_to(@channel_max)) in safe implementation
# range = @channel_max.zero? ? (1_u16..UInt16::MAX) : (1_u16..@channel_max)
range = (1_u16..UInt16::MAX)
range.each do |i|
next if @channels.has_key? i
ch = @channels[i] = Channel.new(self, i)
break
Expand Down Expand Up @@ -84,8 +86,7 @@ describe LavinMQ::Server do
end
end

# TODO: needs new amqp-client release, current version deadlocks
pending "should not allow client to create more channels than the negotiated max" do
it "should not allow client to create more channels than the negotiated max" do
with_amqp_server do |s|
conn = AMQP::Client::UnsafeClient.new(port: amqp_port(s), channel_max: 1).connect_unsafe
conn.channel
Expand All @@ -95,12 +96,11 @@ describe LavinMQ::Server do
end
end

# TODO: needs new amqp-client release, current version does not support 0 = unlimited
pending "should allow client to create 'unlimited' channels if the server has no limit" do
it "should allow client to create 'unlimited' channels if the server has no limit" do
config = LavinMQ::Config.new
config.channel_max = 0
with_amqp_server(config: config) do |s|
conn = AMQP::Client::UnsafeClient.new(port: amqp_port(s), channel_max: 1).connect_unsafe
conn = AMQP::Client.new(port: amqp_port(s)).connect
conn.channel
conn.channel
end
Expand Down Expand Up @@ -135,8 +135,7 @@ describe LavinMQ::Server do
end
end

# TODO: needs new amqp-client release, current version deadlocks
pending "should not allow client to send a frame larger than the negotiated frame_max" do
it "should not allow client to send a frame larger than the negotiated frame_max" do
with_amqp_server do |s|
conn = AMQP::Client.new(port: amqp_port(s)).connect
ch = conn.channel
Expand Down

0 comments on commit 6108a07

Please sign in to comment.