fix: handle subscription list api when there are `emqx:subscribe` subscriptions
This commit is contained in:
parent
03a70bb527
commit
916ce99fd5
|
@ -177,7 +177,7 @@ format(WhichNode, {{Topic, _Subscriber}, Options}) ->
|
|||
maps:merge(
|
||||
#{
|
||||
topic => get_topic(Topic, Options),
|
||||
clientid => maps:get(subid, Options),
|
||||
clientid => maps:get(subid, Options, null),
|
||||
node => WhichNode
|
||||
},
|
||||
maps:with([qos, nl, rap, rh], Options)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
-compile(nowarn_export_all).
|
||||
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
-include_lib("common_test/include/ct.hrl").
|
||||
|
||||
-define(CLIENTID, <<"api_clientid">>).
|
||||
-define(USERNAME, <<"api_username">>).
|
||||
|
@ -142,6 +143,18 @@ t_subscription_fuzzy_search(Config) ->
|
|||
?assertEqual(#{<<"page">> => 2, <<"limit">> => 3, <<"hasnext">> => false}, MatchMeta2P2),
|
||||
?assertEqual(1, length(maps:get(<<"data">>, MatchData2P2))).
|
||||
|
||||
%% checks that we can list when there are subscriptions made by
|
||||
%% `emqx:subscribe'.
|
||||
t_list_with_internal_subscription(_Config) ->
|
||||
emqx:subscribe(<<"some/topic">>),
|
||||
QS = [],
|
||||
Headers = emqx_mgmt_api_test_util:auth_header_(),
|
||||
?assertMatch(
|
||||
#{<<"data">> := [#{<<"clientid">> := null}]},
|
||||
request_json(get, QS, Headers)
|
||||
),
|
||||
ok.
|
||||
|
||||
request_json(Method, Query, Headers) when is_list(Query) ->
|
||||
Qs = uri_string:compose_query(Query),
|
||||
{ok, MatchRes} = emqx_mgmt_api_test_util:request_api(Method, path(), Qs, Headers),
|
||||
|
|
Loading…
Reference in New Issue