56 lines
1.7 KiB
Erlang
56 lines
1.7 KiB
Erlang
%%--------------------------------------------------------------------
|
|
%% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
|
%%--------------------------------------------------------------------
|
|
|
|
-module(emqx_license_cli_SUITE).
|
|
|
|
-compile(nowarn_export_all).
|
|
-compile(export_all).
|
|
|
|
-include_lib("eunit/include/eunit.hrl").
|
|
-include_lib("common_test/include/ct.hrl").
|
|
|
|
all() ->
|
|
emqx_common_test_helpers:all(?MODULE).
|
|
|
|
init_per_suite(Config) ->
|
|
_ = application:load(emqx_conf),
|
|
emqx_config:save_schema_mod_and_names(emqx_license_schema),
|
|
emqx_common_test_helpers:start_apps([emqx_license], fun set_special_configs/1),
|
|
Config.
|
|
|
|
end_per_suite(_) ->
|
|
emqx_common_test_helpers:stop_apps([emqx_license]),
|
|
ok.
|
|
|
|
init_per_testcase(_Case, Config) ->
|
|
{ok, _} = emqx_cluster_rpc:start_link(node(), emqx_cluster_rpc, 1000),
|
|
Config.
|
|
|
|
end_per_testcase(_Case, _Config) ->
|
|
ok.
|
|
|
|
set_special_configs(emqx_license) ->
|
|
Config = #{key => emqx_license_test_lib:default_license()},
|
|
emqx_config:put([license], Config),
|
|
RawConfig = #{<<"key">> => emqx_license_test_lib:default_license()},
|
|
emqx_config:put_raw([<<"license">>], RawConfig);
|
|
set_special_configs(_) ->
|
|
ok.
|
|
|
|
%%------------------------------------------------------------------------------
|
|
%% Tests
|
|
%%------------------------------------------------------------------------------
|
|
|
|
t_help(_Config) ->
|
|
_ = emqx_license_cli:license([]).
|
|
|
|
t_info(_Config) ->
|
|
_ = emqx_license_cli:license(["info"]).
|
|
|
|
t_update(_Config) ->
|
|
LicenseValue = emqx_license_test_lib:default_license(),
|
|
_ = emqx_license_cli:license(["update", LicenseValue]),
|
|
_ = emqx_license_cli:license(["reload"]),
|
|
_ = emqx_license_cli:license(["update", "Invalid License Value"]).
|