Skip to content

Commit

Permalink
spec that check qos0 msgs are not published if no client is subscribed
Browse files Browse the repository at this point in the history
  • Loading branch information
kickster97 committed Jan 13, 2025
1 parent 853a545 commit 49bffd1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions spec/mqtt/integrations/message_qos_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -260,5 +260,29 @@ module MqttSpecs
end
end
end

it "should not enqueue messages with QoS 0 if no client is subscribed to the session" do
with_server do |server|
with_client_io(server) do |io|
connect(io)
topic_filters = mk_topic_filters({"a/b", 0u8})
subscribe(io, topic_filters: topic_filters)
disconnect(io)
end

with_client_io(server) do |publisher_io|
connect(publisher_io, client_id: "publisher")
publish(publisher_io, topic: "a/b", qos: 0u8)
disconnect(publisher_io)
end

with_client_io(server) do |io|
connect(io)
pkt = read_packet(io)
pkt.should be_nil
disconnect(io)
end
end
end
end
end

0 comments on commit 49bffd1

Please sign in to comment.