test: move new test to newer module and use current apis

This commit is contained in:
Thales Macedo Garitezi 2024-08-01 15:13:25 -03:00
parent 44e7f2e9b2
commit 52b2d73b28
2 changed files with 25 additions and 42 deletions

View File

@ -401,48 +401,6 @@ t_mqtt_conn_bridge_ingress_shared_subscription(_) ->
{ok, 204, <<>>} = request(delete, uri(["bridges", BridgeID]), []),
ok.
t_connect_with_more_clients_than_the_broker_accepts(_) ->
PoolSize = 100,
OrgConf = emqx_mgmt_listeners_conf:get_raw(tcp, default),
on_exit(fun() ->
emqx_mgmt_listeners_conf:update(tcp, default, OrgConf)
end),
NewConf = OrgConf#{<<"max_connections">> => 3},
{ok, _} = emqx_mgmt_listeners_conf:update(tcp, default, NewConf),
BridgeName = atom_to_binary(?FUNCTION_NAME),
?check_trace(
#{timetrap => 10_000},
begin
BridgeID = create_bridge(
?SERVER_CONF#{
<<"name">> => BridgeName,
<<"ingress">> => #{
<<"pool_size">> => PoolSize,
<<"remote">> => #{
<<"topic">> => <<"$share/ingress/", ?INGRESS_REMOTE_TOPIC, "/#">>,
<<"qos">> => 1
},
<<"local">> => #{
<<"topic">> => <<?INGRESS_LOCAL_TOPIC, "/${topic}">>,
<<"qos">> => <<"${qos}">>,
<<"payload">> => <<"${clientid}">>,
<<"retain">> => <<"${retain}">>
}
}
}
),
?block_until(#{?snk_kind := emqx_bridge_mqtt_connector_tcp_closed}),
{ok, 204, <<>>} = request(delete, uri(["bridges", BridgeID]), []),
ok
end,
fun(Trace) ->
?assertMatch([_ | _], ?of_kind(emqx_bridge_mqtt_connector_tcp_closed, Trace)),
ok
end
),
ok.
t_mqtt_egress_bridge_warns_clean_start(_) ->
BridgeName = atom_to_binary(?FUNCTION_NAME),
Action = fun() ->

View File

@ -246,3 +246,28 @@ t_receive_via_rule(Config) ->
end
),
ok.
t_connect_with_more_clients_than_the_broker_accepts(Config0) ->
OrgConf = emqx_mgmt_listeners_conf:get_raw(tcp, default),
on_exit(fun() ->
emqx_mgmt_listeners_conf:update(tcp, default, OrgConf)
end),
NewConf = OrgConf#{<<"max_connections">> => 3},
{ok, _} = emqx_mgmt_listeners_conf:update(tcp, default, NewConf),
ConnectorConfig0 = ?config(connector_config, Config0),
ConnectorConfig = ConnectorConfig0#{<<"pool_size">> := 100},
Config = emqx_utils:merge_opts(Config0, [{connector_config, ConnectorConfig}]),
?check_trace(
#{timetrap => 10_000},
begin
{ok, _} = emqx_bridge_v2_testlib:create_bridge_api(Config),
?block_until(#{?snk_kind := emqx_bridge_mqtt_connector_tcp_closed}),
ok
end,
fun(Trace) ->
?assertMatch([_ | _], ?of_kind(emqx_bridge_mqtt_connector_tcp_closed, Trace)),
ok
end
),
ok.