parent
0c3e863ac1
commit
40758fb693
|
@ -0,0 +1,29 @@
|
|||
name: Run test case
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
|
||||
run_test_case:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
container:
|
||||
image: erlang:22.1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Run tests
|
||||
run: |
|
||||
make eunit
|
||||
make ct
|
||||
make cover
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: always()
|
||||
with:
|
||||
name: logs
|
||||
path: _build/test/logs
|
||||
- uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: cover
|
||||
path: _build/test/cover
|
2
Makefile
2
Makefile
|
@ -3,7 +3,7 @@
|
|||
REBAR_GIT_CLONE_OPTIONS += --depth 1
|
||||
export REBAR_GIT_CLONE_OPTIONS
|
||||
|
||||
SUITES_FILES := $(shell find test -name '*_SUITE.erl')
|
||||
SUITES_FILES := $(shell find test -name '*_SUITE.erl' | sort)
|
||||
|
||||
CT_SUITES := $(foreach value,$(SUITES_FILES),$(shell val=$$(basename $(value) .erl); echo $${val%_*}))
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ t_get_env(_) ->
|
|||
application:unset_env(emqx, undefined_key).
|
||||
|
||||
t_emqx_pubsub_api(_) ->
|
||||
emqx:start(),
|
||||
true = emqx:is_running(node()),
|
||||
{ok, C} = emqtt:start_link([{host, "localhost"}, {clientid, "myclient"}]),
|
||||
{ok, _} = emqtt:connect(C),
|
||||
|
@ -190,4 +189,4 @@ hook_filter2(_, _Acc, _IntArg) -> false.
|
|||
|
||||
hook_filter2_1(arg, _Acc, init_arg) -> true;
|
||||
hook_filter2_1(arg1, _Acc, init_arg) -> true;
|
||||
hook_filter2_1(_, _Acc, _IntArg) -> false.
|
||||
hook_filter2_1(_, _Acc, _IntArg) -> false.
|
||||
|
|
|
@ -45,6 +45,7 @@ t_add_delete(_) ->
|
|||
},
|
||||
ok = emqx_banned:create(Banned),
|
||||
?assertEqual(1, emqx_banned:info(size)),
|
||||
|
||||
ok = emqx_banned:delete({clientid, <<"TestClient">>}),
|
||||
?assertEqual(0, emqx_banned:info(size)).
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ set_special_configs(_App) -> ok.
|
|||
|
||||
end_per_suite(_Config) ->
|
||||
emqx_ct_helpers:stop_apps([]),
|
||||
ekka_mnesia:delete_schema(), %% Clean emqx_banned table
|
||||
ok.
|
||||
|
||||
t_detect_check(_) ->
|
||||
|
@ -55,8 +56,8 @@ t_detect_check(_) ->
|
|||
false = emqx_banned:check(ClientInfo),
|
||||
Childrens = supervisor:which_children(emqx_cm_sup),
|
||||
{flapping, Pid, _, _} = lists:keyfind(flapping, 1, Childrens),
|
||||
gen_server:call(Pid, test),
|
||||
gen_server:cast(Pid, test),
|
||||
gen_server:call(Pid, unexpected_msg),
|
||||
gen_server:cast(Pid, unexpected_msg),
|
||||
Pid ! test,
|
||||
ok = emqx_flapping:stop().
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ all() -> emqx_ct:all(?MODULE).
|
|||
|
||||
init_per_suite(Config) ->
|
||||
emqx_ct_helpers:boot_modules(all),
|
||||
emqx_ct_helpers:start_apps([emqx]),
|
||||
emqx_ct_helpers:start_apps([]),
|
||||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
emqx_ct_helpers:stop_apps([emqx]).
|
||||
emqx_ct_helpers:stop_apps([]).
|
||||
|
||||
t_load_unload(_) ->
|
||||
?assertEqual({error,already_exists}, emqx_mod_acl_internal:load([])),
|
||||
|
|
|
@ -26,13 +26,13 @@ all() -> emqx_ct:all(?MODULE).
|
|||
|
||||
init_per_suite(Config) ->
|
||||
emqx_ct_helpers:boot_modules(all),
|
||||
emqx_ct_helpers:start_apps([emqx]),
|
||||
emqx_ct_helpers:start_apps([]),
|
||||
%% Ensure all the modules unloaded.
|
||||
ok = emqx_modules:unload(),
|
||||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
emqx_ct_helpers:stop_apps([emqx]).
|
||||
emqx_ct_helpers:stop_apps([]).
|
||||
|
||||
%% Test case for emqx_mod_presence
|
||||
t_mod_presence(_) ->
|
||||
|
|
|
@ -30,13 +30,13 @@ all() -> emqx_ct:all(?MODULE).
|
|||
|
||||
init_per_suite(Config) ->
|
||||
emqx_ct_helpers:boot_modules(all),
|
||||
emqx_ct_helpers:start_apps([emqx]),
|
||||
emqx_ct_helpers:start_apps([]),
|
||||
%% Ensure all the modules unloaded.
|
||||
ok = emqx_modules:unload(),
|
||||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
emqx_ct_helpers:stop_apps([emqx]).
|
||||
emqx_ct_helpers:stop_apps([]).
|
||||
|
||||
%% Test case for emqx_mod_write
|
||||
t_mod_rewrite(_Config) ->
|
||||
|
|
|
@ -26,11 +26,11 @@ all() -> emqx_ct:all(?MODULE).
|
|||
|
||||
init_per_suite(Config) ->
|
||||
emqx_ct_helpers:boot_modules(all),
|
||||
emqx_ct_helpers:start_apps([emqx]),
|
||||
emqx_ct_helpers:start_apps([]),
|
||||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
emqx_ct_helpers:stop_apps([emqx]).
|
||||
emqx_ct_helpers:stop_apps([]).
|
||||
|
||||
t_on_client_connected(_) ->
|
||||
?assertEqual(ok, emqx_mod_subscription:load([{<<"connected/%c/%u">>, ?QOS_0}])),
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
|
||||
all() -> emqx_ct:all(?MODULE).
|
||||
|
||||
init_per_testcase(_TestCase, Config) ->
|
||||
emqx_ct_helpers:start_apps([emqx]),
|
||||
init_per_suite(Config) ->
|
||||
emqx_ct_helpers:start_apps([]),
|
||||
Config.
|
||||
|
||||
end_per_testcase(_TestCase, Config) ->
|
||||
Config.
|
||||
end_per_suite(_Config) ->
|
||||
emqx_ct_helpers:stop_apps([]).
|
||||
|
||||
t_monitor(_) ->
|
||||
ok = emqx_router_helper:monitor({undefined, node()}),
|
||||
|
|
|
@ -293,3 +293,4 @@ recv_msgs(Count, Msgs) ->
|
|||
after 100 ->
|
||||
Msgs
|
||||
end.
|
||||
|
||||
|
|
Loading…
Reference in New Issue