test(mgmt): add data im/export tests for EE
This commit is contained in:
parent
ef88b283e8
commit
b48c437f97
|
@ -412,7 +412,7 @@ import_auth_clientid(Lists) ->
|
|||
lists:foreach(fun(#{<<"clientid">> := Clientid, <<"password">> := Password}) ->
|
||||
mnesia:dirty_write({emqx_user, {clientid, Clientid}
|
||||
, base64:decode(Password)
|
||||
, erlang:system_time(millisecond)})
|
||||
, erlang:system_time(millisecond)})
|
||||
end, Lists)
|
||||
end.
|
||||
|
||||
|
@ -633,7 +633,7 @@ import(Filename, OverridesJson) ->
|
|||
end;
|
||||
false ->
|
||||
logger:error("Unsupported version: ~p", [Version]),
|
||||
{error, unsupported_version}
|
||||
{error, unsupported_version, Version}
|
||||
end;
|
||||
Error -> Error
|
||||
end.
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
-include_lib("eunit/include/eunit.hrl").
|
||||
-include_lib("emqx_rule_engine/include/rule_engine.hrl").
|
||||
-compile([export_all, nowarn_export_all]).
|
||||
|
||||
% -define(EMQX_ENTERPRISE, true).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Setups
|
||||
%%--------------------------------------------------------------------
|
||||
|
@ -47,60 +50,34 @@ end_per_suite(Cfg) ->
|
|||
|
||||
get_data_path() ->
|
||||
emqx_ct_helpers:deps_path(emqx_management, "test/emqx_bridge_mqtt_data_export_import_SUITE_data/").
|
||||
%%--------------------------------------------------------------------
|
||||
%% Cases
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
handle_config(Config, 420, brigde) ->
|
||||
?assertEqual(<<"off">>, maps:get(<<"ssl">>, Config));
|
||||
|
||||
handle_config(Config, 430, brigde) ->
|
||||
?assertEqual(false, maps:get(<<"ssl">>, Config));
|
||||
|
||||
handle_config(Config, 420, rpc) ->
|
||||
handle_config(Config, 430, rpc);
|
||||
|
||||
handle_config(Config, 409, rpc) ->
|
||||
handle_config(Config, 420, rpc);
|
||||
|
||||
handle_config(Config, 415, rpc) ->
|
||||
handle_config(Config, 420, rpc);
|
||||
|
||||
handle_config(Config, 409, brigde) ->
|
||||
handle_config(Config, 420, brigde);
|
||||
|
||||
handle_config(Config, 415, brigde) ->
|
||||
handle_config(Config, 420, brigde);
|
||||
|
||||
handle_config(Config, 430, rpc) ->
|
||||
?assertEqual(<<"emqx@127.0.0.1">>, maps:get(<<"address">>, Config)),
|
||||
?assertEqual(32, maps:get(<<"batch_size">>, Config)),
|
||||
?assertEqual(<<"off">>, maps:get(<<"disk_cache">>, Config)),
|
||||
?assertEqual(<<"bridge/emqx/${node}/">>, maps:get(<<"mountpoint">>, Config)),
|
||||
?assertEqual(<<"30s">>, maps:get(<<"reconnect_interval">>, Config)),
|
||||
?assertEqual(8, maps:get(<<"pool_size">>, Config));
|
||||
|
||||
handle_config(_, _, _) -> ok.
|
||||
|
||||
remove_resource(Id) ->
|
||||
emqx_rule_registry:remove_resource(Id),
|
||||
emqx_rule_registry:remove_resource_params(Id).
|
||||
|
||||
import(FilePath, Version) ->
|
||||
Overrides = emqx_json:encode(#{<<"auth.mnesia.as">> => atom_to_binary(clientid)}),
|
||||
ok = emqx_mgmt_data_backup:import(get_data_path() ++ "/" ++ FilePath, Overrides),
|
||||
ok = emqx_mgmt_data_backup:import(get_data_path() ++ "/" ++ FilePath, <<"{}">>),
|
||||
lists:foreach(fun(#resource{id = Id, config = Config} = _Resource) ->
|
||||
timer:sleep(1000),
|
||||
case Id of
|
||||
<<"brigde">> ->
|
||||
handle_config(Config, Version, brigde),
|
||||
remove_resource(Id);
|
||||
<<"bridge">> ->
|
||||
test_utils:resource_is_alive(Id),
|
||||
handle_config(Config, Version, bridge),
|
||||
remove_resource(Id);
|
||||
<<"rpc">> ->
|
||||
handle_config(Config, Version, rpc),
|
||||
remove_resource(Id);
|
||||
test_utils:resource_is_alive(Id),
|
||||
handle_config(Config, Version, rpc),
|
||||
remove_resource(Id);
|
||||
_ -> ok
|
||||
end
|
||||
end, emqx_rule_registry:get_resources()).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Cases
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
-ifndef(EMQX_ENTERPRISE).
|
||||
|
||||
t_import420(_) ->
|
||||
import("420.json", 420),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
@ -116,3 +93,92 @@ t_import409(_) ->
|
|||
t_import415(_) ->
|
||||
import("415.json", 415),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
||||
|
||||
handle_config(Config, 420, bridge) ->
|
||||
?assertEqual(false, maps:get(<<"ssl">>, Config));
|
||||
|
||||
handle_config(Config, 430, bridge) ->
|
||||
?assertEqual(false, maps:get(<<"ssl">>, Config));
|
||||
|
||||
handle_config(Config, 420, rpc) ->
|
||||
handle_config(Config, 430, rpc);
|
||||
|
||||
handle_config(Config, 409, rpc) ->
|
||||
handle_config(Config, 420, rpc);
|
||||
|
||||
handle_config(Config, 415, rpc) ->
|
||||
handle_config(Config, 420, rpc);
|
||||
|
||||
handle_config(Config, 409, bridge) ->
|
||||
handle_config(Config, 420, bridge);
|
||||
|
||||
handle_config(Config, 415, bridge) ->
|
||||
handle_config(Config, 420, bridge);
|
||||
|
||||
handle_config(Config, 430, rpc) ->
|
||||
?assertEqual(<<"test@127.0.0.1">>, maps:get(<<"address">>, Config)),
|
||||
?assertEqual(32, maps:get(<<"batch_size">>, Config)),
|
||||
?assertEqual(<<"off">>, maps:get(<<"disk_cache">>, Config)),
|
||||
?assertEqual(<<"bridge/emqx/${node}/">>, maps:get(<<"mountpoint">>, Config)),
|
||||
?assertEqual(<<"30s">>, maps:get(<<"reconnect_interval">>, Config)),
|
||||
?assertEqual(8, maps:get(<<"pool_size">>, Config));
|
||||
|
||||
handle_config(_, _, _) -> ok.
|
||||
|
||||
-endif.
|
||||
|
||||
-ifdef(EMQX_ENTERPRISE).
|
||||
|
||||
t_importee4010(_) ->
|
||||
import("ee4010.json", ee4010),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
||||
t_importee410(_) ->
|
||||
import("ee410.json", ee410),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
||||
t_importee411(_) ->
|
||||
import("ee411.json", ee411),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
||||
t_importee420(_) ->
|
||||
import("ee420.json", ee420),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
||||
t_importee425(_) ->
|
||||
import("ee425.json", ee425),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
||||
t_importee430(_) ->
|
||||
import("ee430.json", ee430),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% handle_config
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
handle_config(Config, ee4010, Id) ->
|
||||
handle_config(Config, ee430, Id);
|
||||
|
||||
handle_config(Config, ee410, Id) ->
|
||||
handle_config(Config, ee430, Id);
|
||||
|
||||
handle_config(Config, ee411, Id) ->
|
||||
handle_config(Config, ee430, Id);
|
||||
|
||||
handle_config(Config, ee420, Id) ->
|
||||
handle_config(Config, ee430, Id);
|
||||
|
||||
handle_config(Config, ee425, Id) ->
|
||||
handle_config(Config, ee430, Id);
|
||||
|
||||
handle_config(Config, ee430, bridge) ->
|
||||
?assertEqual(false, maps:get(<<"ssl">>, Config));
|
||||
|
||||
handle_config(Config, ee430, rpc) ->
|
||||
?assertEqual(<<"off">>, maps:get(<<"disk_cache">>, Config));
|
||||
|
||||
handle_config(Config, ee435, Id) ->
|
||||
handle_config(Config, ee430, Id).
|
||||
-endif.
|
|
@ -45,7 +45,7 @@
|
|||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"disk_cache": "off",
|
||||
"batch_size": 32,
|
||||
"address": "emqx@127.0.0.1"
|
||||
"address": "test@127.0.0.1"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"disk_cache": "off",
|
||||
"batch_size": 32,
|
||||
"address": "emqx@127.0.0.1"
|
||||
"address": "test@127.0.0.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"id": "rpc",
|
||||
"type": "bridge_rpc",
|
||||
"config": {
|
||||
"address": "emqx@127.0.0.1",
|
||||
"address": "test@127.0.0.1",
|
||||
"batch_size": 32,
|
||||
"disk_cache": "off",
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
|
@ -31,7 +31,7 @@
|
|||
"disk_cache": "off",
|
||||
"keepalive": "60s",
|
||||
"keyfile": "etc/certs/client-key.pem",
|
||||
"mountpoint": "bridge/aws/${node}/",
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"password": "",
|
||||
"pool_size": 8,
|
||||
"proto_ver": "mqttv4",
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
"filename": "etc/certs/client-key.pem",
|
||||
"file": ""
|
||||
},
|
||||
"mountpoint": "bridge/aws/${node}/",
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"password": "",
|
||||
"pool_size": 8,
|
||||
"proto_ver": "mqttv4",
|
||||
|
@ -41,7 +41,7 @@
|
|||
"id": "rpc",
|
||||
"type": "bridge_rpc",
|
||||
"config": {
|
||||
"address": "emqx@127.0.0.1",
|
||||
"address": "test@127.0.0.1",
|
||||
"batch_size": 32,
|
||||
"disk_cache": "off",
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"version": "4.0",
|
||||
"users": [
|
||||
{
|
||||
"username": "admin",
|
||||
"tags": "administrator",
|
||||
"password": "GCX5nvOMK0hbiMB4AUyc25wI8fU="
|
||||
}
|
||||
],
|
||||
"schemas": [],
|
||||
"rules": [],
|
||||
"resources": [
|
||||
{
|
||||
"type": "bridge_mqtt",
|
||||
"id": "bridge",
|
||||
"description": "bridge",
|
||||
"created_at": null,
|
||||
"config": {
|
||||
"username": "user",
|
||||
"ssl": "off",
|
||||
"retry_interval": "20s",
|
||||
"reconnect_interval": "30s",
|
||||
"proto_ver": "mqttv4",
|
||||
"password": "passwd",
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"keyfile": "etc/certs/client-key.pem",
|
||||
"keepalive": "60s",
|
||||
"disk_cache": "off",
|
||||
"clientid": "bridge_aws",
|
||||
"ciphers": "ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384",
|
||||
"certfile": "etc/certs/client-cert.pem",
|
||||
"cacertfile": "etc/certs/cacert.pem",
|
||||
"bridge_mode": true,
|
||||
"address": "127.0.0.1:1883"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "bridge_rpc",
|
||||
"id": "rpc",
|
||||
"description": "rpc",
|
||||
"created_at": null,
|
||||
"config": {
|
||||
"reconnect_interval": "30s",
|
||||
"pool_size": 8,
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"disk_cache": "off",
|
||||
"batch_size": 32,
|
||||
"address": "test@127.0.0.1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"date": "2021-04-13 13:57:23",
|
||||
"blacklist": [],
|
||||
"auth_username": [],
|
||||
"auth_mnesia": [],
|
||||
"auth_clientid": [],
|
||||
"apps": [
|
||||
{
|
||||
"status": true,
|
||||
"secret": "public",
|
||||
"name": "Default",
|
||||
"id": "admin",
|
||||
"expired": "undefined",
|
||||
"desc": "Application user"
|
||||
}
|
||||
],
|
||||
"acl_mnesia": []
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
"version": "4.1",
|
||||
"users": [
|
||||
{
|
||||
"username": "admin",
|
||||
"tags": "administrator",
|
||||
"password": "atdwlByxL9/9P3CoFJ60drhodkY="
|
||||
}
|
||||
],
|
||||
"schemas": [],
|
||||
"rules": [],
|
||||
"resources": [
|
||||
{
|
||||
"type": "bridge_rpc",
|
||||
"id": "rpc",
|
||||
"description": "rpc",
|
||||
"created_at": null,
|
||||
"config": {
|
||||
"reconnect_interval": "30s",
|
||||
"pool_size": 8,
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"disk_cache": "off",
|
||||
"batch_size": 32,
|
||||
"address": "test@127.0.0.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "bridge_mqtt",
|
||||
"id": "bridge",
|
||||
"description": "bridge",
|
||||
"created_at": null,
|
||||
"config": {
|
||||
"username": "",
|
||||
"ssl": "off",
|
||||
"retry_interval": "20s",
|
||||
"reconnect_interval": "30s",
|
||||
"proto_ver": "mqttv4",
|
||||
"pool_size": 8,
|
||||
"password": "",
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"keyfile": "etc/certs/client-key.pem",
|
||||
"keepalive": "60s",
|
||||
"disk_cache": "off",
|
||||
"clientid": "client",
|
||||
"ciphers": "ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-AES256-SHA384,ECDHE-RSA-AES256-SHA384,ECDHE-ECDSA-DES-CBC3-SHA,ECDH-ECDSA-AES256-GCM-SHA384,ECDH-RSA-AES256-GCM-SHA384,ECDH-ECDSA-AES256-SHA384,ECDH-RSA-AES256-SHA384,DHE-DSS-AES256-GCM-SHA384,DHE-DSS-AES256-SHA256,AES256-GCM-SHA384,AES256-SHA256,ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES128-SHA256,ECDHE-RSA-AES128-SHA256,ECDH-ECDSA-AES128-GCM-SHA256,ECDH-RSA-AES128-GCM-SHA256,ECDH-ECDSA-AES128-SHA256,ECDH-RSA-AES128-SHA256,DHE-DSS-AES128-GCM-SHA256,DHE-DSS-AES128-SHA256,AES128-GCM-SHA256,AES128-SHA256,ECDHE-ECDSA-AES256-SHA,ECDHE-RSA-AES256-SHA,DHE-DSS-AES256-SHA,ECDH-ECDSA-AES256-SHA,ECDH-RSA-AES256-SHA,AES256-SHA,ECDHE-ECDSA-AES128-SHA,ECDHE-RSA-AES128-SHA,DHE-DSS-AES128-SHA,ECDH-ECDSA-AES128-SHA,ECDH-RSA-AES128-SHA,AES128-SHA",
|
||||
"certfile": "etc/certs/client-cert.pem",
|
||||
"cacertfile": "etc/certs/cacert.pem",
|
||||
"bridge_mode": false,
|
||||
"append": true,
|
||||
"address": "127.0.0.1:1883"
|
||||
}
|
||||
}
|
||||
],
|
||||
"date": "2021-04-13 11:30:21",
|
||||
"blacklist": [],
|
||||
"auth_username": [],
|
||||
"auth_mnesia": [],
|
||||
"auth_clientid": [],
|
||||
"apps": [
|
||||
{
|
||||
"status": true,
|
||||
"secret": "public",
|
||||
"name": "Default",
|
||||
"id": "admin",
|
||||
"expired": "undefined",
|
||||
"desc": "Application user"
|
||||
}
|
||||
],
|
||||
"acl_mnesia": []
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
"version": "4.1",
|
||||
"users": [
|
||||
{
|
||||
"username": "admin",
|
||||
"tags": "administrator",
|
||||
"password": "tsYtP3TylchkM7J7YTc46Di0kPk="
|
||||
}
|
||||
],
|
||||
"schemas": [],
|
||||
"rules": [],
|
||||
"resources": [
|
||||
{
|
||||
"type": "bridge_rpc",
|
||||
"id": "rpc",
|
||||
"description": "rpc",
|
||||
"created_at": null,
|
||||
"config": {
|
||||
"reconnect_interval": "30s",
|
||||
"pool_size": 8,
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"disk_cache": "off",
|
||||
"batch_size": 32,
|
||||
"address": "test@127.0.0.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "bridge_mqtt",
|
||||
"id": "bridge",
|
||||
"description": "bridge",
|
||||
"created_at": null,
|
||||
"config": {
|
||||
"username": "",
|
||||
"ssl": "off",
|
||||
"retry_interval": "20s",
|
||||
"reconnect_interval": "30s",
|
||||
"proto_ver": "mqttv4",
|
||||
"pool_size": 8,
|
||||
"password": "",
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"keyfile": "etc/certs/client-key.pem",
|
||||
"keepalive": "60s",
|
||||
"disk_cache": "off",
|
||||
"clientid": "client",
|
||||
"ciphers": "ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-AES256-SHA384,ECDHE-RSA-AES256-SHA384,ECDHE-ECDSA-DES-CBC3-SHA,ECDH-ECDSA-AES256-GCM-SHA384,ECDH-RSA-AES256-GCM-SHA384,ECDH-ECDSA-AES256-SHA384,ECDH-RSA-AES256-SHA384,DHE-DSS-AES256-GCM-SHA384,DHE-DSS-AES256-SHA256,AES256-GCM-SHA384,AES256-SHA256,ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES128-SHA256,ECDHE-RSA-AES128-SHA256,ECDH-ECDSA-AES128-GCM-SHA256,ECDH-RSA-AES128-GCM-SHA256,ECDH-ECDSA-AES128-SHA256,ECDH-RSA-AES128-SHA256,DHE-DSS-AES128-GCM-SHA256,DHE-DSS-AES128-SHA256,AES128-GCM-SHA256,AES128-SHA256,ECDHE-ECDSA-AES256-SHA,ECDHE-RSA-AES256-SHA,DHE-DSS-AES256-SHA,ECDH-ECDSA-AES256-SHA,ECDH-RSA-AES256-SHA,AES256-SHA,ECDHE-ECDSA-AES128-SHA,ECDHE-RSA-AES128-SHA,DHE-DSS-AES128-SHA,ECDH-ECDSA-AES128-SHA,ECDH-RSA-AES128-SHA,AES128-SHA",
|
||||
"certfile": "etc/certs/client-cert.pem",
|
||||
"cacertfile": "etc/certs/cacert.pem",
|
||||
"bridge_mode": false,
|
||||
"append": true,
|
||||
"address": "127.0.0.1:1883"
|
||||
}
|
||||
}
|
||||
],
|
||||
"date": "2021-04-13 16:37:18",
|
||||
"blacklist": [],
|
||||
"auth_username": [],
|
||||
"auth_mnesia": [],
|
||||
"auth_clientid": [],
|
||||
"apps": [
|
||||
{
|
||||
"status": true,
|
||||
"secret": "public",
|
||||
"name": "Default",
|
||||
"id": "admin",
|
||||
"expired": "undefined",
|
||||
"desc": "Application user"
|
||||
}
|
||||
],
|
||||
"acl_mnesia": []
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
{
|
||||
"version": "4.2",
|
||||
"date": "2021-04-13 11:35:13",
|
||||
"modules": [
|
||||
{
|
||||
"id": "module:b9294d70",
|
||||
"type": "recon",
|
||||
"config": {},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:c7c7b692",
|
||||
"type": "presence",
|
||||
"config": {
|
||||
"qos": 0
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:486adc4b",
|
||||
"type": "internal_acl",
|
||||
"config": {
|
||||
"acl_rule_file": "etc/acl.conf"
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:411cf85d",
|
||||
"type": "retainer",
|
||||
"config": {
|
||||
"storage_type": "ram",
|
||||
"max_retained_messages": 0,
|
||||
"max_payload_size": "1MB",
|
||||
"expiry_interval": 0
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:127b92c3",
|
||||
"type": "hot_confs",
|
||||
"config": {},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
}
|
||||
],
|
||||
"rules": [],
|
||||
"resources": [
|
||||
{
|
||||
"id": "bridge",
|
||||
"type": "bridge_mqtt",
|
||||
"config": {
|
||||
"address": "127.0.0.1:1883",
|
||||
"append": true,
|
||||
"bridge_mode": false,
|
||||
"cacertfile": "etc/certs/cacert.pem",
|
||||
"certfile": "etc/certs/client-cert.pem",
|
||||
"ciphers": "ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-AES256-SHA384,ECDHE-RSA-AES256-SHA384,ECDHE-ECDSA-DES-CBC3-SHA,ECDH-ECDSA-AES256-GCM-SHA384,ECDH-RSA-AES256-GCM-SHA384,ECDH-ECDSA-AES256-SHA384,ECDH-RSA-AES256-SHA384,DHE-DSS-AES256-GCM-SHA384,DHE-DSS-AES256-SHA256,AES256-GCM-SHA384,AES256-SHA256,ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES128-SHA256,ECDHE-RSA-AES128-SHA256,ECDH-ECDSA-AES128-GCM-SHA256,ECDH-RSA-AES128-GCM-SHA256,ECDH-ECDSA-AES128-SHA256,ECDH-RSA-AES128-SHA256,DHE-DSS-AES128-GCM-SHA256,DHE-DSS-AES128-SHA256,AES128-GCM-SHA256,AES128-SHA256,ECDHE-ECDSA-AES256-SHA,ECDHE-RSA-AES256-SHA,DHE-DSS-AES256-SHA,ECDH-ECDSA-AES256-SHA,ECDH-RSA-AES256-SHA,AES256-SHA,ECDHE-ECDSA-AES128-SHA,ECDHE-RSA-AES128-SHA,DHE-DSS-AES128-SHA,ECDH-ECDSA-AES128-SHA,ECDH-RSA-AES128-SHA,AES128-SHA",
|
||||
"clientid": "client",
|
||||
"disk_cache": "off",
|
||||
"keepalive": "60s",
|
||||
"keyfile": "etc/certs/client-key.pem",
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"password": "",
|
||||
"pool_size": 8,
|
||||
"proto_ver": "mqttv4",
|
||||
"reconnect_interval": "30s",
|
||||
"retry_interval": "20s",
|
||||
"ssl": "off",
|
||||
"username": ""
|
||||
},
|
||||
"created_at": null,
|
||||
"description": "bridge"
|
||||
},
|
||||
{
|
||||
"id": "rpc",
|
||||
"type": "bridge_rpc",
|
||||
"config": {
|
||||
"address": "test@127.0.0.1",
|
||||
"batch_size": 32,
|
||||
"disk_cache": "off",
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"pool_size": 8,
|
||||
"reconnect_interval": "30s"
|
||||
},
|
||||
"created_at": null,
|
||||
"description": "rpc"
|
||||
}
|
||||
],
|
||||
"blacklist": [],
|
||||
"apps": [
|
||||
{
|
||||
"id": "admin",
|
||||
"secret": "public",
|
||||
"name": "Default",
|
||||
"desc": "Application user",
|
||||
"status": true,
|
||||
"expired": "undefined"
|
||||
}
|
||||
],
|
||||
"users": [
|
||||
{
|
||||
"username": "admin",
|
||||
"password": "bx1P63qGDhKvZYdltxX4NVY2kS4=",
|
||||
"tags": "administrator"
|
||||
}
|
||||
],
|
||||
"auth_mnesia": [],
|
||||
"acl_mnesia": [],
|
||||
"schemas": []
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
{
|
||||
"version": "4.2",
|
||||
"date": "2021-04-13 16:42:34",
|
||||
"modules": [
|
||||
{
|
||||
"id": "module:3dc04a9c",
|
||||
"type": "retainer",
|
||||
"config": {
|
||||
"storage_type": "ram",
|
||||
"max_retained_messages": 0,
|
||||
"max_payload_size": "1MB",
|
||||
"expiry_interval": 0
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:5128901f",
|
||||
"type": "recon",
|
||||
"config": {},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:9d1596c8",
|
||||
"type": "presence",
|
||||
"config": {
|
||||
"qos": 0
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:43d43410",
|
||||
"type": "internal_acl",
|
||||
"config": {
|
||||
"acl_rule_file": "etc/acl.conf"
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
}
|
||||
],
|
||||
"rules": [],
|
||||
"resources": [
|
||||
{
|
||||
"id": "bridge",
|
||||
"type": "bridge_mqtt",
|
||||
"config": {
|
||||
"address": "127.0.0.1:1883",
|
||||
"append": true,
|
||||
"bridge_mode": false,
|
||||
"cacertfile": {
|
||||
"filename": "",
|
||||
"file": ""
|
||||
},
|
||||
"certfile": {
|
||||
"filename": "",
|
||||
"file": ""
|
||||
},
|
||||
"ciphers": "ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-AES256-SHA384,ECDHE-RSA-AES256-SHA384,ECDHE-ECDSA-DES-CBC3-SHA,ECDH-ECDSA-AES256-GCM-SHA384,ECDH-RSA-AES256-GCM-SHA384,ECDH-ECDSA-AES256-SHA384,ECDH-RSA-AES256-SHA384,DHE-DSS-AES256-GCM-SHA384,DHE-DSS-AES256-SHA256,AES256-GCM-SHA384,AES256-SHA256,ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES128-SHA256,ECDHE-RSA-AES128-SHA256,ECDH-ECDSA-AES128-GCM-SHA256,ECDH-RSA-AES128-GCM-SHA256,ECDH-ECDSA-AES128-SHA256,ECDH-RSA-AES128-SHA256,DHE-DSS-AES128-GCM-SHA256,DHE-DSS-AES128-SHA256,AES128-GCM-SHA256,AES128-SHA256,ECDHE-ECDSA-AES256-SHA,ECDHE-RSA-AES256-SHA,DHE-DSS-AES256-SHA,ECDH-ECDSA-AES256-SHA,ECDH-RSA-AES256-SHA,AES256-SHA,ECDHE-ECDSA-AES128-SHA,ECDHE-RSA-AES128-SHA,DHE-DSS-AES128-SHA,ECDH-ECDSA-AES128-SHA,ECDH-RSA-AES128-SHA,AES128-SHA",
|
||||
"clientid": "client",
|
||||
"disk_cache": "off",
|
||||
"keepalive": "60s",
|
||||
"keyfile": {
|
||||
"filename": "",
|
||||
"file": ""
|
||||
},
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"password": "",
|
||||
"pool_size": 8,
|
||||
"proto_ver": "mqttv4",
|
||||
"reconnect_interval": "30s",
|
||||
"retry_interval": "20s",
|
||||
"ssl": false,
|
||||
"username": "",
|
||||
"verify": false
|
||||
},
|
||||
"created_at": null,
|
||||
"description": "bridge"
|
||||
},
|
||||
{
|
||||
"id": "rpc",
|
||||
"type": "bridge_rpc",
|
||||
"config": {
|
||||
"address": "test@127.0.0.1",
|
||||
"batch_size": 32,
|
||||
"disk_cache": "off",
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"pool_size": 8,
|
||||
"reconnect_interval": "30s"
|
||||
},
|
||||
"created_at": null,
|
||||
"description": "rpc"
|
||||
}
|
||||
],
|
||||
"blacklist": [],
|
||||
"apps": [
|
||||
{
|
||||
"id": "admin",
|
||||
"secret": "public",
|
||||
"name": "Default",
|
||||
"desc": "Application user",
|
||||
"status": true,
|
||||
"expired": "undefined"
|
||||
}
|
||||
],
|
||||
"users": [
|
||||
{
|
||||
"username": "admin",
|
||||
"password": "Hd8AMmbFs+LsqQXQxaV/WqLoGEk=",
|
||||
"tags": "administrator"
|
||||
}
|
||||
],
|
||||
"auth_mnesia": [],
|
||||
"acl_mnesia": [],
|
||||
"schemas": [],
|
||||
"configs": [],
|
||||
"listeners_state": []
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
{
|
||||
"version": "4.3",
|
||||
"rules": [],
|
||||
"resources": [
|
||||
{
|
||||
"id": "bridge",
|
||||
"type": "bridge_mqtt",
|
||||
"config": {
|
||||
"address": "127.0.0.1:1883",
|
||||
"append": true,
|
||||
"bridge_mode": false,
|
||||
"cacertfile": {
|
||||
"filename": "",
|
||||
"file": ""
|
||||
},
|
||||
"certfile": {
|
||||
"filename": "",
|
||||
"file": ""
|
||||
},
|
||||
"ciphers": "ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-AES256-SHA384,ECDHE-RSA-AES256-SHA384,ECDHE-ECDSA-DES-CBC3-SHA,ECDH-ECDSA-AES256-GCM-SHA384,ECDH-RSA-AES256-GCM-SHA384,ECDH-ECDSA-AES256-SHA384,ECDH-RSA-AES256-SHA384,DHE-DSS-AES256-GCM-SHA384,DHE-DSS-AES256-SHA256,AES256-GCM-SHA384,AES256-SHA256,ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES128-SHA256,ECDHE-RSA-AES128-SHA256,ECDH-ECDSA-AES128-GCM-SHA256,ECDH-RSA-AES128-GCM-SHA256,ECDH-ECDSA-AES128-SHA256,ECDH-RSA-AES128-SHA256,DHE-DSS-AES128-GCM-SHA256,DHE-DSS-AES128-SHA256,AES128-GCM-SHA256,AES128-SHA256,ECDHE-ECDSA-AES256-SHA,ECDHE-RSA-AES256-SHA,DHE-DSS-AES256-SHA,ECDH-ECDSA-AES256-SHA,ECDH-RSA-AES256-SHA,AES256-SHA,ECDHE-ECDSA-AES128-SHA,ECDHE-RSA-AES128-SHA,DHE-DSS-AES128-SHA,ECDH-ECDSA-AES128-SHA,ECDH-RSA-AES128-SHA,AES128-SHA",
|
||||
"clientid": "client",
|
||||
"disk_cache": "off",
|
||||
"keepalive": "60s",
|
||||
"keyfile": {
|
||||
"filename": "",
|
||||
"file": ""
|
||||
},
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"password": "",
|
||||
"pool_size": 8,
|
||||
"proto_ver": "mqttv4",
|
||||
"reconnect_interval": "30s",
|
||||
"retry_interval": "20s",
|
||||
"ssl": false,
|
||||
"username": "",
|
||||
"verify": false
|
||||
},
|
||||
"created_at": 1618304391051,
|
||||
"description": "bridge"
|
||||
},
|
||||
{
|
||||
"id": "rpc",
|
||||
"type": "bridge_rpc",
|
||||
"config": {
|
||||
"address": "test@127.0.0.1",
|
||||
"batch_size": 32,
|
||||
"disk_cache": "off",
|
||||
"mountpoint": "bridge/emqx/${node}/",
|
||||
"pool_size": 8,
|
||||
"reconnect_interval": "30s"
|
||||
},
|
||||
"created_at": 1618304406842,
|
||||
"description": "rpc"
|
||||
}
|
||||
],
|
||||
"blacklist": [],
|
||||
"apps": [
|
||||
{
|
||||
"id": "admin",
|
||||
"secret": "public",
|
||||
"name": "Default",
|
||||
"desc": "Application user",
|
||||
"status": true,
|
||||
"expired": "undefined"
|
||||
}
|
||||
],
|
||||
"users": [
|
||||
{
|
||||
"username": "admin",
|
||||
"password": "qq8hg9pOkmYiHqzi3+bcUaK2CGA=",
|
||||
"tags": "administrator"
|
||||
}
|
||||
],
|
||||
"auth_mnesia": [],
|
||||
"acl_mnesia": [],
|
||||
"modules": [
|
||||
{
|
||||
"id": "module:aabeddbf",
|
||||
"type": "recon",
|
||||
"config": {},
|
||||
"enabled": true,
|
||||
"created_at": 1618304311061,
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:cbe6d976",
|
||||
"type": "internal_acl",
|
||||
"config": {
|
||||
"acl_rule_file": "etc/acl.conf"
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": 1618304311061,
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:46375e06",
|
||||
"type": "retainer",
|
||||
"config": {
|
||||
"storage_type": "ram",
|
||||
"max_retained_messages": 0,
|
||||
"max_payload_size": "1MB",
|
||||
"expiry_interval": 0
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": 1618304311061,
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:091eb7c3",
|
||||
"type": "presence",
|
||||
"config": {
|
||||
"qos": 0
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": 1618304311061,
|
||||
"description": ""
|
||||
}
|
||||
],
|
||||
"schemas": [],
|
||||
"configs": [],
|
||||
"listeners_state": [],
|
||||
"date": "2021-04-13 17:59:52"
|
||||
}
|
|
@ -18,6 +18,9 @@
|
|||
-include_lib("eunit/include/eunit.hrl").
|
||||
-include_lib("emqx_rule_engine/include/rule_engine.hrl").
|
||||
-compile([export_all, nowarn_export_all]).
|
||||
|
||||
% -define(EMQX_ENTERPRISE, true).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Setups
|
||||
%%--------------------------------------------------------------------
|
||||
|
@ -47,10 +50,55 @@ end_per_suite(Cfg) ->
|
|||
|
||||
get_data_path() ->
|
||||
emqx_ct_helpers:deps_path(emqx_management, "test/emqx_webhook_data_export_import_SUITE_data/").
|
||||
|
||||
remove_resource(Id) ->
|
||||
emqx_rule_registry:remove_resource(Id),
|
||||
emqx_rule_registry:remove_resource_params(Id).
|
||||
|
||||
import(FilePath, Version) ->
|
||||
ok = emqx_mgmt_data_backup:import(get_data_path() ++ "/" ++ FilePath, <<"{}">>),
|
||||
lists:foreach(fun(#resource{id = Id, config = Config} = _Resource) ->
|
||||
case Id of
|
||||
<<"webhook">> ->
|
||||
test_utils:resource_is_alive(Id),
|
||||
handle_config(Config, Version),
|
||||
remove_resource(Id);
|
||||
_ -> ok
|
||||
end
|
||||
end, emqx_rule_registry:get_resources()).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Cases
|
||||
%%--------------------------------------------------------------------
|
||||
-ifdef(EMQX_ENTERPRISE).
|
||||
|
||||
t_importee4010(_) ->
|
||||
import("ee4010.json", ee4010),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
||||
t_importee410(_) ->
|
||||
import("ee410.json", ee410),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
||||
t_importee411(_) ->
|
||||
import("ee411.json", ee411),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
||||
t_importee420(_) ->
|
||||
import("ee420.json", ee420),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
||||
t_importee425(_) ->
|
||||
import("ee425.json", ee425),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
||||
t_importee430(_) ->
|
||||
import("ee430.json", ee430),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% handle_config
|
||||
%%--------------------------------------------------------------------
|
||||
handle_config(Config, 409) ->
|
||||
handle_config(Config, 422);
|
||||
|
||||
|
@ -87,24 +135,10 @@ handle_config(Config, 430) ->
|
|||
?assertEqual(true, is_map(maps:get(<<"certfile">>, Config))),
|
||||
?assertEqual(true, is_map(maps:get(<<"keyfile">>, Config))),
|
||||
?assertEqual(8, maps:get(<<"pool_size">>, Config));
|
||||
|
||||
handle_config(_, _) -> ok.
|
||||
-endif.
|
||||
|
||||
remove_resource(Id) ->
|
||||
emqx_rule_registry:remove_resource(Id),
|
||||
emqx_rule_registry:remove_resource_params(Id).
|
||||
|
||||
import(FilePath, Version) ->
|
||||
Overrides = emqx_json:encode(#{<<"auth.mnesia.as">> => atom_to_binary(clientid)}),
|
||||
ok = emqx_mgmt_data_backup:import(get_data_path() ++ "/" ++ FilePath, Overrides),
|
||||
lists:foreach(fun(#resource{id = Id, config = Config} = _Resource) ->
|
||||
case Id of
|
||||
"webhook" ->
|
||||
handle_config(Config, Version),
|
||||
remove_resource(Id);
|
||||
_ -> ok
|
||||
end
|
||||
end, emqx_rule_registry:get_resources()).
|
||||
-ifndef(EMQX_ENTERPRISE).
|
||||
|
||||
t_import422(_) ->
|
||||
import("422.json", 422),
|
||||
|
@ -129,3 +163,41 @@ t_import409(_) ->
|
|||
t_import415(_) ->
|
||||
import("415.json", 415),
|
||||
{ok, _} = emqx_mgmt_data_backup:export().
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% handle_config
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
handle_config(Config, ee4010) ->
|
||||
?assertEqual(<<"http://www.emqx.io">>, maps:get(<<"url">>, Config));
|
||||
|
||||
handle_config(Config, ee410) ->
|
||||
?assertEqual(<<"http://www.emqx.io">>, maps:get(<<"url">>, Config));
|
||||
|
||||
handle_config(Config, ee411) ->
|
||||
?assertEqual(<<"http://www.emqx.io">>, maps:get(<<"url">>, Config));
|
||||
|
||||
handle_config(Config, ee420) ->
|
||||
?assertEqual(<<"http://www.emqx.io">>, maps:get(<<"url">>, Config));
|
||||
|
||||
handle_config(Config, ee425) ->
|
||||
?assertEqual(<<"http://www.emqx.io">>, maps:get(<<"url">>, Config)),
|
||||
?assertEqual(<<"5s">>, maps:get(<<"connect_timeout">>, Config)),
|
||||
?assertEqual(<<"5s">>, maps:get(<<"request_timeout">>, Config)),
|
||||
?assertEqual(false, maps:get(<<"verify">>, Config)),
|
||||
?assertEqual(8, maps:get(<<"pool_size">>, Config));
|
||||
|
||||
handle_config(Config, ee435) ->
|
||||
handle_config(Config, ee430);
|
||||
|
||||
handle_config(Config, ee430) ->
|
||||
?assertEqual(<<"http://www.emqx.io">>, maps:get(<<"url">>, Config)),
|
||||
?assertEqual(<<"5s">>, maps:get(<<"connect_timeout">>, Config)),
|
||||
?assertEqual(<<"5s">>, maps:get(<<"request_timeout">>, Config)),
|
||||
?assertEqual(false, maps:get(<<"verify">>, Config)),
|
||||
?assertEqual(8, maps:get(<<"pool_size">>, Config));
|
||||
|
||||
handle_config(Config, _) ->
|
||||
io:format("|>=> :~p~n", [Config]).
|
||||
|
||||
-endif.
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"version": "4.0",
|
||||
"users": [
|
||||
{
|
||||
"username": "admin",
|
||||
"tags": "administrator",
|
||||
"password": "GCX5nvOMK0hbiMB4AUyc25wI8fU="
|
||||
}
|
||||
],
|
||||
"schemas": [],
|
||||
"rules": [],
|
||||
"resources": [
|
||||
{
|
||||
"type": "web_hook",
|
||||
"id": "web_hook",
|
||||
"description": "webhook",
|
||||
"created_at": null,
|
||||
"config": {
|
||||
"url": "http://www.emqx.io",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"k": "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"date": "2021-04-13 13:57:23",
|
||||
"blacklist": [],
|
||||
"auth_username": [],
|
||||
"auth_mnesia": [],
|
||||
"auth_clientid": [],
|
||||
"apps": [
|
||||
{
|
||||
"status": true,
|
||||
"secret": "public",
|
||||
"name": "Default",
|
||||
"id": "admin",
|
||||
"expired": "undefined",
|
||||
"desc": "Application user"
|
||||
}
|
||||
],
|
||||
"acl_mnesia": []
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"version": "4.1",
|
||||
"users": [
|
||||
{
|
||||
"username": "admin",
|
||||
"tags": "administrator",
|
||||
"password": "atdwlByxL9/9P3CoFJ60drhodkY="
|
||||
}
|
||||
],
|
||||
"schemas": [],
|
||||
"rules": [],
|
||||
"resources": [
|
||||
{
|
||||
"type": "web_hook",
|
||||
"id": "webhook",
|
||||
"description": "webhook",
|
||||
"created_at": null,
|
||||
"config": {
|
||||
"url": "http://www.emqx.io",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"k": "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"date": "2021-04-13 11:30:21",
|
||||
"blacklist": [],
|
||||
"auth_username": [],
|
||||
"auth_mnesia": [],
|
||||
"auth_clientid": [],
|
||||
"apps": [
|
||||
{
|
||||
"status": true,
|
||||
"secret": "public",
|
||||
"name": "Default",
|
||||
"id": "admin",
|
||||
"expired": "undefined",
|
||||
"desc": "Application user"
|
||||
}
|
||||
],
|
||||
"acl_mnesia": []
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"version": "4.1",
|
||||
"users": [
|
||||
{
|
||||
"username": "admin",
|
||||
"tags": "administrator",
|
||||
"password": "tsYtP3TylchkM7J7YTc46Di0kPk="
|
||||
}
|
||||
],
|
||||
"schemas": [],
|
||||
"rules": [],
|
||||
"resources": [
|
||||
{
|
||||
"type": "web_hook",
|
||||
"id": "web_hook",
|
||||
"description": "webhook",
|
||||
"created_at": null,
|
||||
"config": {
|
||||
"url": "http://www.emqx.io",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"k": "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"date": "2021-04-13 16:37:18",
|
||||
"blacklist": [],
|
||||
"auth_username": [],
|
||||
"auth_mnesia": [],
|
||||
"auth_clientid": [],
|
||||
"apps": [
|
||||
{
|
||||
"status": true,
|
||||
"secret": "public",
|
||||
"name": "Default",
|
||||
"id": "admin",
|
||||
"expired": "undefined",
|
||||
"desc": "Application user"
|
||||
}
|
||||
],
|
||||
"acl_mnesia": []
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
{
|
||||
"version": "4.2",
|
||||
"date": "2021-04-13 11:35:13",
|
||||
"modules": [
|
||||
{
|
||||
"id": "module:b9294d70",
|
||||
"type": "recon",
|
||||
"config": {},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:c7c7b692",
|
||||
"type": "presence",
|
||||
"config": {
|
||||
"qos": 0
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:486adc4b",
|
||||
"type": "internal_acl",
|
||||
"config": {
|
||||
"acl_rule_file": "etc/acl.conf"
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:411cf85d",
|
||||
"type": "retainer",
|
||||
"config": {
|
||||
"storage_type": "ram",
|
||||
"max_retained_messages": 0,
|
||||
"max_payload_size": "1MB",
|
||||
"expiry_interval": 0
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:127b92c3",
|
||||
"type": "hot_confs",
|
||||
"config": {},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
}
|
||||
],
|
||||
"rules": [],
|
||||
"resources": [
|
||||
{
|
||||
"id": "webhook",
|
||||
"type": "web_hook",
|
||||
"config": {
|
||||
"headers": {
|
||||
"k": "v"
|
||||
},
|
||||
"method": "POST",
|
||||
"url": "http://www.emqx.io"
|
||||
},
|
||||
"created_at": null,
|
||||
"description": "webhook"
|
||||
}
|
||||
],
|
||||
"blacklist": [],
|
||||
"apps": [
|
||||
{
|
||||
"id": "admin",
|
||||
"secret": "public",
|
||||
"name": "Default",
|
||||
"desc": "Application user",
|
||||
"status": true,
|
||||
"expired": "undefined"
|
||||
}
|
||||
],
|
||||
"users": [
|
||||
{
|
||||
"username": "admin",
|
||||
"password": "bx1P63qGDhKvZYdltxX4NVY2kS4=",
|
||||
"tags": "administrator"
|
||||
}
|
||||
],
|
||||
"auth_mnesia": [],
|
||||
"acl_mnesia": [],
|
||||
"schemas": []
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
{
|
||||
"version": "4.2",
|
||||
"date": "2021-04-13 16:42:34",
|
||||
"modules": [
|
||||
{
|
||||
"id": "module:3dc04a9c",
|
||||
"type": "retainer",
|
||||
"config": {
|
||||
"storage_type": "ram",
|
||||
"max_retained_messages": 0,
|
||||
"max_payload_size": "1MB",
|
||||
"expiry_interval": 0
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:5128901f",
|
||||
"type": "recon",
|
||||
"config": {},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:9d1596c8",
|
||||
"type": "presence",
|
||||
"config": {
|
||||
"qos": 0
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:43d43410",
|
||||
"type": "internal_acl",
|
||||
"config": {
|
||||
"acl_rule_file": "etc/acl.conf"
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": "undefined",
|
||||
"description": ""
|
||||
}
|
||||
],
|
||||
"rules": [],
|
||||
"resources": [
|
||||
{
|
||||
"id": "webhook",
|
||||
"type": "web_hook",
|
||||
"config": {
|
||||
"cacertfile": {
|
||||
"filename": "",
|
||||
"file": ""
|
||||
},
|
||||
"certfile": {
|
||||
"filename": "",
|
||||
"file": ""
|
||||
},
|
||||
"connect_timeout": "5s",
|
||||
"headers": {
|
||||
"k": "v"
|
||||
},
|
||||
"keyfile": {
|
||||
"filename": "",
|
||||
"file": ""
|
||||
},
|
||||
"method": "POST",
|
||||
"pool_size": 8,
|
||||
"request_timeout": "5s",
|
||||
"url": "http://www.emqx.io",
|
||||
"verify": false
|
||||
},
|
||||
"created_at": null,
|
||||
"description": "webhook"
|
||||
}
|
||||
],
|
||||
"blacklist": [],
|
||||
"apps": [
|
||||
{
|
||||
"id": "admin",
|
||||
"secret": "public",
|
||||
"name": "Default",
|
||||
"desc": "Application user",
|
||||
"status": true,
|
||||
"expired": "undefined"
|
||||
}
|
||||
],
|
||||
"users": [
|
||||
{
|
||||
"username": "admin",
|
||||
"password": "Hd8AMmbFs+LsqQXQxaV/WqLoGEk=",
|
||||
"tags": "administrator"
|
||||
}
|
||||
],
|
||||
"auth_mnesia": [],
|
||||
"acl_mnesia": [],
|
||||
"schemas": [],
|
||||
"configs": [],
|
||||
"listeners_state": []
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
{
|
||||
"version": "4.3",
|
||||
"rules": [],
|
||||
"resources": [
|
||||
{
|
||||
"id": "webhook",
|
||||
"type": "web_hook",
|
||||
"config": {
|
||||
"cacertfile": {
|
||||
"filename": "",
|
||||
"file": ""
|
||||
},
|
||||
"certfile": {
|
||||
"filename": "",
|
||||
"file": ""
|
||||
},
|
||||
"connect_timeout": "5s",
|
||||
"keyfile": {
|
||||
"filename": "",
|
||||
"file": ""
|
||||
},
|
||||
"pool_size": 8,
|
||||
"request_timeout": "5s",
|
||||
"url": "http://www.emqx.io",
|
||||
"verify": false
|
||||
},
|
||||
"created_at": 1618304340172,
|
||||
"description": "webhook"
|
||||
}
|
||||
],
|
||||
"blacklist": [],
|
||||
"apps": [
|
||||
{
|
||||
"id": "admin",
|
||||
"secret": "public",
|
||||
"name": "Default",
|
||||
"desc": "Application user",
|
||||
"status": true,
|
||||
"expired": "undefined"
|
||||
}
|
||||
],
|
||||
"users": [
|
||||
{
|
||||
"username": "admin",
|
||||
"password": "qq8hg9pOkmYiHqzi3+bcUaK2CGA=",
|
||||
"tags": "administrator"
|
||||
}
|
||||
],
|
||||
"auth_mnesia": [],
|
||||
"acl_mnesia": [],
|
||||
"modules": [
|
||||
{
|
||||
"id": "module:aabeddbf",
|
||||
"type": "recon",
|
||||
"config": {},
|
||||
"enabled": true,
|
||||
"created_at": 1618304311061,
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:cbe6d976",
|
||||
"type": "internal_acl",
|
||||
"config": {
|
||||
"acl_rule_file": "etc/acl.conf"
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": 1618304311061,
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:46375e06",
|
||||
"type": "retainer",
|
||||
"config": {
|
||||
"storage_type": "ram",
|
||||
"max_retained_messages": 0,
|
||||
"max_payload_size": "1MB",
|
||||
"expiry_interval": 0
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": 1618304311061,
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": "module:091eb7c3",
|
||||
"type": "presence",
|
||||
"config": {
|
||||
"qos": 0
|
||||
},
|
||||
"enabled": true,
|
||||
"created_at": 1618304311061,
|
||||
"description": ""
|
||||
}
|
||||
],
|
||||
"schemas": [],
|
||||
"configs": [],
|
||||
"listeners_state": [],
|
||||
"date": "2021-04-13 17:59:52"
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
%% @author:
|
||||
%% @description:
|
||||
-module(test_utils).
|
||||
%% ====================================================================
|
||||
%% API functions
|
||||
%% ====================================================================
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
-include_lib("emqx_rule_engine/include/rule_engine.hrl").
|
||||
|
||||
-compile([export_all, nowarn_export_all]).
|
||||
|
||||
%% ====================================================================
|
||||
%% Internal functions
|
||||
%% ====================================================================
|
||||
resource_is_alive(Id) ->
|
||||
{ok, #resource_params{status = #{is_alive := Alive}} = Params} = emqx_rule_registry:find_resource_params(Id),
|
||||
ct:print("Id: ~p, Alive: ~p, Resource ===> :~p~n", [Id, Alive, Params]),
|
||||
?assertEqual(true, Alive),
|
||||
Alive.
|
Loading…
Reference in New Issue