chore(auth): update emqx_gcp_device tests
This commit is contained in:
parent
3943830eae
commit
d17bcc94f6
|
@ -17,15 +17,19 @@ all() ->
|
||||||
emqx_common_test_helpers:all(?MODULE).
|
emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_conf, emqx_authn, emqx_retainer, emqx_gcp_device]),
|
Apps = emqx_cth_suite:start(
|
||||||
Config.
|
[emqx, emqx_conf, emqx_authn, emqx_gcp_device, {emqx_retainer, "retainer {enable = true}"}],
|
||||||
|
#{
|
||||||
|
work_dir => ?config(priv_dir, Config)
|
||||||
|
}
|
||||||
|
),
|
||||||
|
[{apps, Apps} | Config].
|
||||||
|
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
_ = emqx_common_test_helpers:stop_apps([emqx_authn, emqx_retainer, emqx_gcp_device]),
|
ok = emqx_cth_suite:stop(?config(apps, Config)),
|
||||||
Config.
|
ok.
|
||||||
|
|
||||||
init_per_testcase(_TestCase, Config) ->
|
init_per_testcase(_TestCase, Config) ->
|
||||||
{ok, _} = emqx_cluster_rpc:start_link(node(), emqx_cluster_rpc, 1000),
|
|
||||||
emqx_authn_test_lib:delete_authenticators(
|
emqx_authn_test_lib:delete_authenticators(
|
||||||
[authentication],
|
[authentication],
|
||||||
?GLOBAL
|
?GLOBAL
|
||||||
|
|
|
@ -14,32 +14,34 @@
|
||||||
-include_lib("emqx/include/emqx.hrl").
|
-include_lib("emqx/include/emqx.hrl").
|
||||||
|
|
||||||
-define(PATH, [authentication]).
|
-define(PATH, [authentication]).
|
||||||
-define(BASE_CONF, <<
|
|
||||||
""
|
|
||||||
"\n"
|
|
||||||
"retainer {\n"
|
|
||||||
" enable = true\n"
|
|
||||||
"}"
|
|
||||||
""
|
|
||||||
>>).
|
|
||||||
|
|
||||||
all() ->
|
all() ->
|
||||||
emqx_common_test_helpers:all(?MODULE).
|
emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
ok = emqx_config:init_load(emqx_retainer_schema, ?BASE_CONF),
|
Apps = emqx_cth_suite:start(
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_gcp_device, emqx_authn, emqx_conf, emqx_retainer]),
|
[
|
||||||
emqx_dashboard_api_test_helpers:set_default_config(),
|
emqx,
|
||||||
emqx_mgmt_api_test_util:init_suite(),
|
emqx_conf,
|
||||||
Config.
|
emqx_authn,
|
||||||
|
{emqx_retainer, "retainer {enable = true}"},
|
||||||
|
emqx_management,
|
||||||
|
{emqx_dashboard, "dashboard.listeners.http { enable = true, bind = 18083 }"},
|
||||||
|
emqx_gcp_device
|
||||||
|
],
|
||||||
|
#{
|
||||||
|
work_dir => ?config(priv_dir, Config)
|
||||||
|
}
|
||||||
|
),
|
||||||
|
_ = emqx_common_test_http:create_default_app(),
|
||||||
|
[{apps, Apps} | Config].
|
||||||
|
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
emqx_mgmt_api_test_util:end_suite(),
|
_ = emqx_common_test_http:delete_default_app(),
|
||||||
_ = emqx_common_test_helpers:stop_apps([emqx_authn, emqx_retainer, emqx_gcp_device]),
|
ok = emqx_cth_suite:stop(?config(apps, Config)),
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
init_per_testcase(_TestCase, Config) ->
|
init_per_testcase(_TestCase, Config) ->
|
||||||
{ok, _} = emqx_cluster_rpc:start_link(node(), emqx_cluster_rpc, 1000),
|
|
||||||
emqx_authn_test_lib:delete_authenticators(
|
emqx_authn_test_lib:delete_authenticators(
|
||||||
[authentication],
|
[authentication],
|
||||||
?GLOBAL
|
?GLOBAL
|
||||||
|
|
|
@ -23,7 +23,9 @@ all() ->
|
||||||
|
|
||||||
init_per_suite(Config0) ->
|
init_per_suite(Config0) ->
|
||||||
ok = snabbkaffe:start_trace(),
|
ok = snabbkaffe:start_trace(),
|
||||||
emqx_common_test_helpers:start_apps([emqx_conf, emqx_authn, emqx_gcp_device]),
|
Apps = emqx_cth_suite:start([emqx, emqx_conf, emqx_authn, emqx_gcp_device], #{
|
||||||
|
work_dir => ?config(priv_dir, Config0)
|
||||||
|
}),
|
||||||
ValidExpirationTime = erlang:system_time(second) + 3600,
|
ValidExpirationTime = erlang:system_time(second) + 3600,
|
||||||
ValidJWT = generate_jws(ValidExpirationTime),
|
ValidJWT = generate_jws(ValidExpirationTime),
|
||||||
ExpiredJWT = generate_jws(0),
|
ExpiredJWT = generate_jws(0),
|
||||||
|
@ -35,16 +37,16 @@ init_per_suite(Config0) ->
|
||||||
{valid_jwt, ValidJWT},
|
{valid_jwt, ValidJWT},
|
||||||
{expired_jwt, ExpiredJWT},
|
{expired_jwt, ExpiredJWT},
|
||||||
{valid_client, ValidClient},
|
{valid_client, ValidClient},
|
||||||
{expired_client, ExpiredClient}
|
{expired_client, ExpiredClient},
|
||||||
|
{apps, Apps}
|
||||||
| Config0
|
| Config0
|
||||||
].
|
].
|
||||||
|
|
||||||
end_per_suite(_) ->
|
end_per_suite(Config) ->
|
||||||
_ = emqx_common_test_helpers:stop_apps([emqx_authn, emqx_gcp_device]),
|
ok = emqx_cth_suite:stop(?config(apps, Config)),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_testcase(_, Config) ->
|
init_per_testcase(_, Config) ->
|
||||||
{ok, _} = emqx_cluster_rpc:start_link(node(), emqx_cluster_rpc, 1000),
|
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_testcase(_Case, Config) ->
|
end_per_testcase(_Case, Config) ->
|
||||||
|
|
Loading…
Reference in New Issue