test(session): switch `emqx_persistent_session_SUITE` to cth tooling
This commit is contained in:
parent
7326ef550b
commit
3383ae19a9
|
@ -59,49 +59,61 @@ groups() ->
|
||||||
].
|
].
|
||||||
|
|
||||||
init_per_group(persistent_store_disabled, Config) ->
|
init_per_group(persistent_store_disabled, Config) ->
|
||||||
%% Start Apps
|
[{emqx_config, "persistent_session_store { enabled = false }"} | Config];
|
||||||
emqx_common_test_helpers:boot_modules(all),
|
init_per_group(Group, Config) when Group == tcp ->
|
||||||
meck:new(emqx_config, [non_strict, passthrough, no_history, no_link]),
|
Apps = emqx_cth_suite:start(
|
||||||
meck:expect(emqx_config, get, fun
|
[{emqx, ?config(emqx_config, Config)}],
|
||||||
([persistent_session_store, enabled]) -> false;
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
(Other) -> meck:passthrough([Other])
|
),
|
||||||
end),
|
[
|
||||||
emqx_common_test_helpers:start_apps([], fun set_special_confs/1),
|
{port, get_listener_port(tcp, default)},
|
||||||
[{persistent_store_enabled, false} | Config];
|
{conn_fun, connect},
|
||||||
init_per_group(Group, Config) when Group == ws; Group == ws_snabbkaffe ->
|
{group_apps, Apps}
|
||||||
|
| Config
|
||||||
|
];
|
||||||
|
init_per_group(Group, Config) when Group == ws ->
|
||||||
|
Apps = emqx_cth_suite:start(
|
||||||
|
[{emqx, ?config(emqx_config, Config)}],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
|
),
|
||||||
[
|
[
|
||||||
{ssl, false},
|
{ssl, false},
|
||||||
{host, "localhost"},
|
{host, "localhost"},
|
||||||
{enable_websocket, true},
|
{enable_websocket, true},
|
||||||
{port, 8083},
|
{port, get_listener_port(ws, default)},
|
||||||
{conn_fun, ws_connect}
|
{conn_fun, ws_connect},
|
||||||
|
{group_apps, Apps}
|
||||||
|
| Config
|
||||||
|
];
|
||||||
|
init_per_group(Group, Config) when Group == quic ->
|
||||||
|
Apps = emqx_cth_suite:start(
|
||||||
|
[
|
||||||
|
{emqx,
|
||||||
|
?config(emqx_config, Config) ++
|
||||||
|
"\n listeners.quic.test { enable = true }"}
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
|
),
|
||||||
|
[
|
||||||
|
{port, get_listener_port(quic, test)},
|
||||||
|
{conn_fun, quic_connect},
|
||||||
|
{group_apps, Apps}
|
||||||
| Config
|
| Config
|
||||||
];
|
];
|
||||||
init_per_group(Group, Config) when Group == tcp; Group == tcp_snabbkaffe ->
|
|
||||||
[{port, 1883}, {conn_fun, connect} | Config];
|
|
||||||
init_per_group(Group, Config) when Group == quic; Group == quic_snabbkaffe ->
|
|
||||||
UdpPort = 1883,
|
|
||||||
emqx_common_test_helpers:ensure_quic_listener(?MODULE, UdpPort),
|
|
||||||
[{port, UdpPort}, {conn_fun, quic_connect} | Config];
|
|
||||||
init_per_group(no_kill_connection_process, Config) ->
|
init_per_group(no_kill_connection_process, Config) ->
|
||||||
[{kill_connection_process, false} | Config];
|
[{kill_connection_process, false} | Config];
|
||||||
init_per_group(kill_connection_process, Config) ->
|
init_per_group(kill_connection_process, Config) ->
|
||||||
[{kill_connection_process, true} | Config].
|
[{kill_connection_process, true} | Config].
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
get_listener_port(Type, Name) ->
|
||||||
Config.
|
case emqx_config:get([listeners, Type, Name, bind]) of
|
||||||
|
{_, Port} -> Port;
|
||||||
|
Port -> Port
|
||||||
|
end.
|
||||||
|
|
||||||
set_special_confs(_) ->
|
end_per_group(Group, Config) when Group == tcp; Group == ws; Group == quic ->
|
||||||
ok.
|
ok = emqx_cth_suite:stop(?config(group_apps, Config));
|
||||||
|
end_per_group(_, _Config) ->
|
||||||
end_per_suite(_Config) ->
|
|
||||||
emqx_common_test_helpers:ensure_mnesia_stopped(),
|
|
||||||
ok.
|
|
||||||
|
|
||||||
end_per_group(persistent_store_disabled, _Config) ->
|
|
||||||
meck:unload(emqx_config),
|
|
||||||
emqx_common_test_helpers:stop_apps([]);
|
|
||||||
end_per_group(_Group, _Config) ->
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_testcase(TestCase, Config) ->
|
init_per_testcase(TestCase, Config) ->
|
||||||
|
|
Loading…
Reference in New Issue