Skip to content

Commit 2efafc1

Browse files
committed
Added test for duration field being set on a Disconnect packet
1 parent 5208a49 commit 2efafc1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/mqtt-sn-pub-test.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,4 +353,24 @@ def test_hostname_lookup_fail
353353
assert_match /nodename nor servname provided, or not known/, @cmd_result[0]
354354
end
355355

356+
def test_disconnect_duration_warning
357+
fake_server do |fs|
358+
def fs.handle_disconnect(packet)
359+
MQTT::SN::Packet::Disconnect.new(
360+
:duration => 10
361+
)
362+
end
363+
364+
@cmd_result = run_cmd(
365+
'mqtt-sn-pub',
366+
'-T' => 10,
367+
'-m' => 'message',
368+
'-p' => fs.port,
369+
'-h' => fs.address
370+
)
371+
end
372+
373+
assert_match /DISCONNECT warning. Gateway returned duration in disconnect packet/, @cmd_result[0]
374+
end
375+
356376
end

0 commit comments

Comments
 (0)