chore: add test case for non-utf8 topic
This commit is contained in:
parent
ef9a63ae17
commit
a0bf06caba
|
@ -336,6 +336,17 @@ t_handle_incoming(_) ->
|
|||
),
|
||||
?assertMatch({ok, _Out, _NState}, emqx_connection:handle_incoming(frame_error, st())).
|
||||
|
||||
t_handle_outing_non_utf8_topic(_) ->
|
||||
Topic = <<"测试"/utf16>>,
|
||||
Publish = ?PUBLISH_PACKET(0, Topic, 1),
|
||||
StrictOff = #{version => 5, max_size => 16#FFFF, strict_mode => false},
|
||||
StOff = st(#{serialize => StrictOff}),
|
||||
OffResult = emqx_connection:handle_outgoing(Publish, StOff),
|
||||
?assertMatch(ok, OffResult),
|
||||
StrictOn = #{version => 5, max_size => 16#FFFF, strict_mode => true},
|
||||
StOn = st(#{serialize => StrictOn}),
|
||||
?assertError(frame_serialize_error, emqx_connection:handle_outgoing(Publish, StOn)).
|
||||
|
||||
t_with_channel(_) ->
|
||||
State = st(),
|
||||
ok = meck:expect(emqx_channel, handle_in, fun(_, _) -> ok end),
|
||||
|
|
|
@ -540,7 +540,7 @@ t_parse_incoming_frame_error(_) ->
|
|||
|
||||
t_handle_incomming_frame_error(_) ->
|
||||
FrameError = {frame_error, bad_qos},
|
||||
Serialize = emqx_frame:serialize_fun(#{version => 5, max_size => 16#FFFF}),
|
||||
Serialize = emqx_frame:serialize_fun(#{version => 5, max_size => 16#FFFF, strict_mode => false}),
|
||||
{[{close, bad_qos}], _St} = ?ws_conn:handle_incoming(FrameError, st(#{serialize => Serialize})).
|
||||
% ?assertEqual(<<224,2,129,0>>, iolist_to_binary(IoData)).
|
||||
|
||||
|
|
Loading…
Reference in New Issue