Przeglądaj źródła

feat(queue): move ds shared sub dependent test to emqx_ds_shared_sub app

Ilya Averyanov 1 rok temu
rodzic
commit
08f70e4a25

+ 29 - 0
apps/emqx_ds_shared_sub/test/emqx_ds_shared_sub_mgmt_api_subscription_SUITE.erl

@@ -87,6 +87,35 @@ t_list_with_shared_sub(_Config) ->
         request_json(get, QS1, Headers)
         request_json(get, QS1, Headers)
     ).
     ).
 
 
+t_list_with_invalid_match_topic(Config) ->
+    Client = proplists:get_value(client, Config),
+    RealTopic = <<"t/+">>,
+    Topic = <<"$share/g1/", RealTopic/binary>>,
+
+    {ok, _, _} = emqtt:subscribe(Client, Topic),
+    {ok, _, _} = emqtt:subscribe(Client, RealTopic),
+
+    QS = [
+        {"clientid", ?CLIENTID},
+        {"match_topic", "$share/g1/t/1"}
+    ],
+    Headers = emqx_mgmt_api_test_util:auth_header_(),
+
+    ?assertMatch(
+        {error,
+            {{_, 400, _}, _, #{
+                <<"message">> := <<"match_topic_invalid">>,
+                <<"code">> := <<"INVALID_PARAMETER">>
+            }}},
+        begin
+            {error, {R, _H, Body}} = emqx_mgmt_api_test_util:request_api(
+                get, path(), uri_string:compose_query(QS), Headers, [], #{return_all => true}
+            ),
+            {error, {R, _H, emqx_utils_json:decode(Body, [return_maps])}}
+        end
+    ),
+    ok.
+
 request_json(Method, Query, Headers) when is_list(Query) ->
 request_json(Method, Query, Headers) when is_list(Query) ->
     Qs = uri_string:compose_query(Query),
     Qs = uri_string:compose_query(Query),
     {ok, MatchRes} = emqx_mgmt_api_test_util:request_api(Method, path(), Qs, Headers),
     {ok, MatchRes} = emqx_mgmt_api_test_util:request_api(Method, path(), Qs, Headers),

+ 3 - 1
apps/emqx_management/test/emqx_mgmt_api_subscription_SUITE.erl

@@ -50,7 +50,9 @@ groups() ->
         %% Persistent shared subscriptions are an EE app.
         %% Persistent shared subscriptions are an EE app.
         %% So they are tested outside emqx_management app which is CE.
         %% So they are tested outside emqx_management app which is CE.
         {persistent,
         {persistent,
-            (CommonTCs -- [t_list_with_shared_sub, t_subscription_api]) ++ persistent_only_tcs()}
+            (CommonTCs --
+                [t_list_with_shared_sub, t_list_with_invalid_match_topic, t_subscription_api]) ++
+                persistent_only_tcs()}
     ].
     ].
 
 
 persistent_only_tcs() ->
 persistent_only_tcs() ->