chore: preparing to run common tests / eunit with mix
This commit is contained in:
parent
8c4a67de31
commit
19f3b030f9
6
Makefile
6
Makefile
|
@ -63,8 +63,10 @@ mix-deps-get: $(ELIXIR_COMMON_DEPS)
|
||||||
@mix deps.get
|
@mix deps.get
|
||||||
|
|
||||||
.PHONY: eunit
|
.PHONY: eunit
|
||||||
eunit: $(REBAR) merge-config
|
eunit: $(REBAR) ${ELIXIR_COMMON_DEPS} merge-config
|
||||||
@$(REBAR) eunit --name eunit@127.0.0.1 -c -v --cover_export_name $(CT_COVER_EXPORT_PREFIX)-eunit
|
# @$(REBAR) eunit --name eunit@127.0.0.1 -c -v --cover_export_name $(CT_COVER_EXPORT_PREFIX)-eunit
|
||||||
|
# TODO: cover compile
|
||||||
|
mix eunit
|
||||||
|
|
||||||
.PHONY: proper
|
.PHONY: proper
|
||||||
proper: $(REBAR)
|
proper: $(REBAR)
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
defmodule Mix.Tasks.Compile.CopySrcs do
|
||||||
|
use Mix.Task.Compiler
|
||||||
|
|
||||||
|
@recursive true
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def run(_args) do
|
||||||
|
Mix.Project.get!()
|
||||||
|
config = Mix.Project.config()
|
||||||
|
extra_dirs = config[:extra_dirs]
|
||||||
|
|
||||||
|
unless extra_dirs && is_list(extra_dirs) do
|
||||||
|
Mix.raise("application option :extra_dirs in #{Mix.Project.project_file()} must be a list of directories under the application")
|
||||||
|
end
|
||||||
|
|
||||||
|
app_root = File.cwd!()
|
||||||
|
app_build_path = Mix.Project.app_path(config)
|
||||||
|
|
||||||
|
for extra_dir <- extra_dirs do
|
||||||
|
src = Path.join([app_root, extra_dir])
|
||||||
|
dest = Path.join([app_build_path, extra_dir])
|
||||||
|
File.rm(dest)
|
||||||
|
case File.ln_s(src, dest) do
|
||||||
|
:ok ->
|
||||||
|
:ok
|
||||||
|
|
||||||
|
{:error, :eexist} ->
|
||||||
|
Mix.shell().info(IO.ANSI.format([:yellow, "#{dest} still exists after attempted removal"]))
|
||||||
|
:ok
|
||||||
|
|
||||||
|
{:error, error} ->
|
||||||
|
Mix.raise("error trying to link #{src} to #{dest}: #{error}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
{:noop, []}
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,15 +1,21 @@
|
||||||
defmodule EMQX.MixProject do
|
defmodule EMQX.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx,
|
app: :emqx,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
erlc_options: [
|
erlc_options: [
|
||||||
{:i, "src"}
|
{:i, "src"}
|
||||||
| EMQXUmbrella.MixProject.erlc_options()
|
| UMP.erlc_options()
|
||||||
],
|
],
|
||||||
|
compilers: Mix.compilers() ++ [:copy_srcs],
|
||||||
|
# used by our `Mix.Tasks.Compile.CopySrcs` compiler
|
||||||
|
extra_dirs: extra_dirs(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -21,14 +27,17 @@ defmodule EMQX.MixProject do
|
||||||
# Run "mix help compile.app" to learn about applications
|
# Run "mix help compile.app" to learn about applications
|
||||||
def application do
|
def application do
|
||||||
[
|
[
|
||||||
extra_applications: [:public_key, :ssl],
|
## FIXME!!! go though emqx.app.src and add missing stuff...
|
||||||
|
extra_applications: [:public_key, :ssl, :os_mon, :logger, :mnesia] ++ UMP.extra_applications(),
|
||||||
mod: {:emqx_app, []}
|
mod: {:emqx_app, []}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
## FIXME!!! go though emqx.app.src and add missing stuff...
|
||||||
[
|
[
|
||||||
{:emqx_utils, in_umbrella: true},
|
{:emqx_utils, in_umbrella: true},
|
||||||
|
{:emqx_ds_backends, in_umbrella: true},
|
||||||
|
|
||||||
{:ekka, github: "emqx/ekka", tag: "0.19.3", override: true},
|
{:ekka, github: "emqx/ekka", tag: "0.19.3", override: true},
|
||||||
{:esockd, github: "emqx/esockd", tag: "5.11.2"},
|
{:esockd, github: "emqx/esockd", tag: "5.11.2"},
|
||||||
|
@ -36,9 +45,15 @@ defmodule EMQX.MixProject do
|
||||||
{:hocon, github: "emqx/hocon", tag: "0.42.2", override: true},
|
{:hocon, github: "emqx/hocon", tag: "0.42.2", override: true},
|
||||||
{:lc, github: "emqx/lc", tag: "0.3.2", override: true},
|
{:lc, github: "emqx/lc", tag: "0.3.2", override: true},
|
||||||
{:ranch, github: "emqx/ranch", tag: "1.8.1-emqx", override: true},
|
{:ranch, github: "emqx/ranch", tag: "1.8.1-emqx", override: true},
|
||||||
{:snabbkaffe, github: "kafka4beam/snabbkaffe", tag: "1.0.10", override: true},
|
] ++ UMP.quicer_dep()
|
||||||
] ++ quicer_dep()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp quicer_dep(), do: EMQXUmbrella.MixProject.quicer_dep()
|
defp extra_dirs() do
|
||||||
|
dirs = ["src", "etc"]
|
||||||
|
if UMP.test_env?() do
|
||||||
|
["test", "integration_test" | dirs]
|
||||||
|
else
|
||||||
|
dirs
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
-include_lib("stdlib/include/assert.hrl").
|
-include_lib("stdlib/include/assert.hrl").
|
||||||
-include_lib("emqx/src/bpapi/emqx_bpapi.hrl").
|
-include("../src/bpapi/emqx_bpapi.hrl").
|
||||||
|
|
||||||
all() -> emqx_common_test_helpers:all(?MODULE).
|
all() -> emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
|
|
|
@ -248,6 +248,7 @@ render_and_load_app_config(App, Opts) ->
|
||||||
%% turn throw into error
|
%% turn throw into error
|
||||||
error({Conf, E, St})
|
error({Conf, E, St})
|
||||||
end.
|
end.
|
||||||
|
|
||||||
do_render_app_config(App, Schema, ConfigFile, Opts) ->
|
do_render_app_config(App, Schema, ConfigFile, Opts) ->
|
||||||
%% copy acl_conf must run before read_schema_configs
|
%% copy acl_conf must run before read_schema_configs
|
||||||
copy_acl_conf(),
|
copy_acl_conf(),
|
||||||
|
|
|
@ -391,7 +391,14 @@ node_init(#{name := Node, work_dir := WorkDir}) ->
|
||||||
_ = share_load_module(Node, cthr),
|
_ = share_load_module(Node, cthr),
|
||||||
%% Enable snabbkaffe trace forwarding
|
%% Enable snabbkaffe trace forwarding
|
||||||
ok = snabbkaffe:forward_trace(Node),
|
ok = snabbkaffe:forward_trace(Node),
|
||||||
when_cover_enabled(fun() -> {ok, _} = cover:start([Node]) end),
|
when_cover_enabled(fun() ->
|
||||||
|
case cover:start([Node]) of
|
||||||
|
{ok, _} ->
|
||||||
|
ok;
|
||||||
|
{error, {already_started, _}} ->
|
||||||
|
ok
|
||||||
|
end
|
||||||
|
end),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
%% Returns 'true' if this node should appear in running nodes list.
|
%% Returns 'true' if this node should appear in running nodes list.
|
||||||
|
@ -456,7 +463,7 @@ stop(Nodes) ->
|
||||||
|
|
||||||
stop_node(Name) ->
|
stop_node(Name) ->
|
||||||
Node = node_name(Name),
|
Node = node_name(Name),
|
||||||
when_cover_enabled(fun() -> cover:flush([Node]) end),
|
when_cover_enabled(fun() -> ok = cover:flush([Node]) end),
|
||||||
ok = emqx_cth_peer:stop(Node).
|
ok = emqx_cth_peer:stop(Node).
|
||||||
|
|
||||||
%% Ports
|
%% Ports
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
-export([start_app/3]).
|
-export([start_app/3]).
|
||||||
-export([stop_apps/1]).
|
-export([stop_apps/1]).
|
||||||
|
|
||||||
|
-export([default_config/2]).
|
||||||
-export([merge_appspec/2]).
|
-export([merge_appspec/2]).
|
||||||
-export([merge_config/2]).
|
-export([merge_config/2]).
|
||||||
|
|
||||||
|
@ -243,6 +244,7 @@ log_appspec(App, #{}) ->
|
||||||
|
|
||||||
spec_fmt(fc, config) -> "~n~ts";
|
spec_fmt(fc, config) -> "~n~ts";
|
||||||
spec_fmt(fc, _) -> "~p";
|
spec_fmt(fc, _) -> "~p";
|
||||||
|
spec_fmt(ffun, {config, false}) -> "false (don't inhibit config loader)";
|
||||||
spec_fmt(ffun, {config, C}) -> render_config(C);
|
spec_fmt(ffun, {config, C}) -> render_config(C);
|
||||||
spec_fmt(ffun, {_, X}) -> X.
|
spec_fmt(ffun, {_, X}) -> X.
|
||||||
|
|
||||||
|
@ -349,6 +351,7 @@ default_appspec(emqx_conf, SuiteOpts) ->
|
||||||
data_dir => unicode:characters_to_binary(maps:get(work_dir, SuiteOpts, "data"))
|
data_dir => unicode:characters_to_binary(maps:get(work_dir, SuiteOpts, "data"))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
SharedApps = maps:get(emqx_conf_shared_apps, SuiteOpts, [emqx, emqx_auth]),
|
||||||
% NOTE
|
% NOTE
|
||||||
% Since `emqx_conf_schema` manages config for a lot of applications, it's good to include
|
% Since `emqx_conf_schema` manages config for a lot of applications, it's good to include
|
||||||
% their defaults as well.
|
% their defaults as well.
|
||||||
|
@ -357,10 +360,7 @@ default_appspec(emqx_conf, SuiteOpts) ->
|
||||||
emqx_utils_maps:deep_merge(Acc, default_config(App, SuiteOpts))
|
emqx_utils_maps:deep_merge(Acc, default_config(App, SuiteOpts))
|
||||||
end,
|
end,
|
||||||
Config,
|
Config,
|
||||||
[
|
SharedApps
|
||||||
emqx,
|
|
||||||
emqx_auth
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
#{
|
#{
|
||||||
config => SharedConfig,
|
config => SharedConfig,
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
|
|
||||||
-include_lib("emqx/src/emqx_persistent_session_ds/emqx_ps_ds_int.hrl").
|
-include("../src/emqx_persistent_session_ds/emqx_ps_ds_int.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXAudit.MixProject do
|
defmodule EMQXAudit.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_audit,
|
app: :emqx_audit,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXAudit.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: [], mod: {:emqx_audit_app, []}]
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_audit_app, []}]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
|
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
|
||||||
all() ->
|
all() ->
|
||||||
[
|
[
|
||||||
|
@ -54,18 +55,27 @@ common_tests() ->
|
||||||
}).
|
}).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
_ = application:load(emqx_conf),
|
Apps = emqx_cth_suite:start(
|
||||||
emqx_config:erase_all(),
|
[
|
||||||
emqx_mgmt_api_test_util:init_suite([emqx_ctl, emqx_conf, emqx_audit]),
|
emqx_ctl,
|
||||||
ok = emqx_common_test_helpers:load_config(emqx_enterprise_schema, ?CONF_DEFAULT),
|
emqx,
|
||||||
emqx_config:save_schema_mod_and_names(emqx_enterprise_schema),
|
{emqx_conf, #{
|
||||||
ok = emqx_config_logger:refresh_config(),
|
config => ?CONF_DEFAULT,
|
||||||
application:set_env(emqx, boot_modules, []),
|
schema_mod => emqx_enterprise_schema
|
||||||
emqx_conf_cli:load(),
|
}},
|
||||||
Config.
|
emqx_modules,
|
||||||
|
emqx_audit,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
|
),
|
||||||
|
[{apps, Apps} | Config].
|
||||||
|
|
||||||
end_per_suite(_) ->
|
end_per_suite(Config) ->
|
||||||
emqx_mgmt_api_test_util:end_suite([emqx_audit, emqx_conf, emqx_ctl]).
|
Apps = ?config(apps, Config),
|
||||||
|
ok = emqx_cth_suite:stop(Apps),
|
||||||
|
ok.
|
||||||
|
|
||||||
t_http_api(_) ->
|
t_http_api(_) ->
|
||||||
process_flag(trap_exit, true),
|
process_flag(trap_exit, true),
|
||||||
|
@ -164,6 +174,7 @@ t_cli(_Config) ->
|
||||||
],
|
],
|
||||||
Data
|
Data
|
||||||
),
|
),
|
||||||
|
[ShowLogEntry] = Data,
|
||||||
%% check create at is valid
|
%% check create at is valid
|
||||||
[#{<<"created_at">> := CreateAtRaw}] = Data,
|
[#{<<"created_at">> := CreateAtRaw}] = Data,
|
||||||
CreateAt = calendar:rfc3339_to_system_time(binary_to_list(CreateAtRaw), [{unit, microsecond}]),
|
CreateAt = calendar:rfc3339_to_system_time(binary_to_list(CreateAtRaw), [{unit, microsecond}]),
|
||||||
|
@ -172,7 +183,10 @@ t_cli(_Config) ->
|
||||||
%% check cli filter
|
%% check cli filter
|
||||||
{ok, Res1} = emqx_mgmt_api_test_util:request_api(get, AuditPath, "from=cli", AuthHeader),
|
{ok, Res1} = emqx_mgmt_api_test_util:request_api(get, AuditPath, "from=cli", AuthHeader),
|
||||||
#{<<"data">> := Data1} = emqx_utils_json:decode(Res1, [return_maps]),
|
#{<<"data">> := Data1} = emqx_utils_json:decode(Res1, [return_maps]),
|
||||||
?assertEqual(Data, Data1),
|
?assertMatch(
|
||||||
|
[ShowLogEntry, #{<<"operation_type">> := <<"emqx">>, <<"args">> := [<<"start">>]}],
|
||||||
|
Data1
|
||||||
|
),
|
||||||
{ok, Res2} = emqx_mgmt_api_test_util:request_api(
|
{ok, Res2} = emqx_mgmt_api_test_util:request_api(
|
||||||
get, AuditPath, "from=erlang_console", AuthHeader
|
get, AuditPath, "from=erlang_console", AuthHeader
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
defmodule EMQXAuth.MixProject do
|
defmodule EMQXAuth.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_auth,
|
app: :emqx_auth,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
|
compilers: Mix.compilers() ++ [:copy_srcs],
|
||||||
|
# used by our `Mix.Tasks.Compile.CopySrcs` compiler
|
||||||
|
extra_dirs: extra_dirs(),
|
||||||
# config_path: "../../config/config.exs",
|
# config_path: "../../config/config.exs",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -18,15 +23,22 @@ defmodule EMQXAuth.MixProject do
|
||||||
|
|
||||||
# Run "mix help compile.app" to learn about applications
|
# Run "mix help compile.app" to learn about applications
|
||||||
def application do
|
def application do
|
||||||
[
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_auth_app, []}]
|
||||||
extra_applications: [],
|
|
||||||
mod: {:emqx_auth_app, []}
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:emqx, in_umbrella: true},
|
{:emqx, in_umbrella: true},
|
||||||
|
{:emqx_utils, in_umbrella: true}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp extra_dirs() do
|
||||||
|
dirs = ["etc"]
|
||||||
|
if UMP.test_env?() do
|
||||||
|
["test" | dirs]
|
||||||
|
else
|
||||||
|
dirs
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,32 +32,30 @@ groups() ->
|
||||||
[].
|
[].
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
ok = emqx_mgmt_api_test_util:init_suite(
|
Apps = emqx_cth_suite:start(
|
||||||
[emqx_conf, emqx_auth],
|
[
|
||||||
fun set_special_configs/1
|
emqx_conf,
|
||||||
|
{emqx_auth, #{
|
||||||
|
config =>
|
||||||
|
#{
|
||||||
|
authorization =>
|
||||||
|
#{
|
||||||
|
cache => #{enabled => true},
|
||||||
|
no_match => deny,
|
||||||
|
sources => []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
),
|
),
|
||||||
Config.
|
[{apps, Apps} | Config].
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(Config) ->
|
||||||
{ok, _} = emqx:update_config(
|
Apps = ?config(apps, Config),
|
||||||
[authorization],
|
emqx_cth_suite:stop(Apps),
|
||||||
#{
|
|
||||||
<<"no_match">> => <<"allow">>,
|
|
||||||
<<"cache">> => #{<<"enable">> => <<"true">>},
|
|
||||||
<<"sources">> => []
|
|
||||||
}
|
|
||||||
),
|
|
||||||
emqx_mgmt_api_test_util:end_suite([emqx_auth, emqx_conf]),
|
|
||||||
ok.
|
|
||||||
|
|
||||||
set_special_configs(emqx_dashboard) ->
|
|
||||||
emqx_dashboard_api_test_helpers:set_default_config();
|
|
||||||
set_special_configs(emqx_auth) ->
|
|
||||||
{ok, _} = emqx:update_config([authorization, cache, enable], true),
|
|
||||||
{ok, _} = emqx:update_config([authorization, no_match], deny),
|
|
||||||
{ok, _} = emqx:update_config([authorization, sources], []),
|
|
||||||
ok;
|
|
||||||
set_special_configs(_App) ->
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
t_clean_cache(_) ->
|
t_clean_cache(_) ->
|
||||||
|
|
|
@ -30,33 +30,30 @@ groups() ->
|
||||||
[].
|
[].
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
ok = emqx_mgmt_api_test_util:init_suite(
|
Apps = emqx_cth_suite:start(
|
||||||
[emqx_conf, emqx_auth, emqx_dashboard],
|
[
|
||||||
fun set_special_configs/1
|
emqx_conf,
|
||||||
|
{emqx_auth, #{
|
||||||
|
config =>
|
||||||
|
#{
|
||||||
|
authorization =>
|
||||||
|
#{
|
||||||
|
cache => #{enabled => true},
|
||||||
|
no_match => allow,
|
||||||
|
sources => []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
),
|
),
|
||||||
Config.
|
[{apps, Apps} | Config].
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(Config) ->
|
||||||
{ok, _} = emqx:update_config(
|
Apps = ?config(apps, Config),
|
||||||
[authorization],
|
emqx_cth_suite:stop(Apps),
|
||||||
#{
|
|
||||||
<<"no_match">> => <<"allow">>,
|
|
||||||
<<"cache">> => #{<<"enable">> => <<"true">>},
|
|
||||||
<<"sources">> => []
|
|
||||||
}
|
|
||||||
),
|
|
||||||
ok = stop_apps([emqx_resource]),
|
|
||||||
emqx_mgmt_api_test_util:end_suite([emqx_auth, emqx_conf]),
|
|
||||||
ok.
|
|
||||||
|
|
||||||
set_special_configs(emqx_dashboard) ->
|
|
||||||
emqx_dashboard_api_test_helpers:set_default_config();
|
|
||||||
set_special_configs(emqx_auth) ->
|
|
||||||
{ok, _} = emqx:update_config([authorization, cache, enable], false),
|
|
||||||
{ok, _} = emqx:update_config([authorization, no_match], deny),
|
|
||||||
{ok, _} = emqx:update_config([authorization, sources], []),
|
|
||||||
ok;
|
|
||||||
set_special_configs(_App) ->
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
|
@ -34,22 +34,30 @@ 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(
|
Apps = emqx_cth_suite:start(
|
||||||
[emqx_conf, emqx_auth],
|
[
|
||||||
fun set_special_configs/1
|
emqx_conf,
|
||||||
|
{emqx_auth, #{
|
||||||
|
config =>
|
||||||
|
#{
|
||||||
|
authorization =>
|
||||||
|
#{
|
||||||
|
cache => #{enabled => false},
|
||||||
|
no_match => deny,
|
||||||
|
sources => []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
),
|
),
|
||||||
Config.
|
[{apps, Apps} | Config].
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(Config) ->
|
||||||
{ok, _} = emqx:update_config(
|
Apps = ?config(apps, Config),
|
||||||
[authorization],
|
emqx_cth_suite:stop(Apps),
|
||||||
#{
|
|
||||||
<<"no_match">> => <<"allow">>,
|
|
||||||
<<"cache">> => #{<<"enable">> => <<"true">>},
|
|
||||||
<<"sources">> => []
|
|
||||||
}
|
|
||||||
),
|
|
||||||
emqx_common_test_helpers:stop_apps([emqx_auth, emqx_conf]),
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_testcase(_TestCase, Config) ->
|
init_per_testcase(_TestCase, Config) ->
|
||||||
|
@ -58,14 +66,6 @@ end_per_testcase(_TestCase, _Config) ->
|
||||||
_ = emqx_authz:set_feature_available(rich_actions, true),
|
_ = emqx_authz:set_feature_available(rich_actions, true),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
set_special_configs(emqx_auth) ->
|
|
||||||
{ok, _} = emqx:update_config([authorization, cache, enable], false),
|
|
||||||
{ok, _} = emqx:update_config([authorization, no_match], deny),
|
|
||||||
{ok, _} = emqx:update_config([authorization, sources], []),
|
|
||||||
ok;
|
|
||||||
set_special_configs(_App) ->
|
|
||||||
ok.
|
|
||||||
|
|
||||||
t_compile(_) ->
|
t_compile(_) ->
|
||||||
% NOTE
|
% NOTE
|
||||||
% Some of the following testcase are relying on the internal representation of
|
% Some of the following testcase are relying on the internal representation of
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXAuthExt.MixProject do
|
defmodule EMQXAuthExt.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_auth_ext,
|
app: :emqx_auth_ext,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXAuthExt.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
defmodule EMQXAuthHTTP.MixProject do
|
defmodule EMQXAuthHTTP.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
|
@ -7,7 +8,8 @@ defmodule EMQXAuthHTTP.MixProject do
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
# config_path: "../../config/config.exs",
|
# config_path: "../../config/config.exs",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -18,18 +20,16 @@ defmodule EMQXAuthHTTP.MixProject do
|
||||||
|
|
||||||
# Run "mix help compile.app" to learn about applications
|
# Run "mix help compile.app" to learn about applications
|
||||||
def application do
|
def application do
|
||||||
[
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_auth_http_app, []}]
|
||||||
extra_applications: [],
|
|
||||||
mod: {:emqx_auth_http_app, []}
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:emqx, in_umbrella: true},
|
{:emqx, in_umbrella: true},
|
||||||
{:emqx_auth, in_umbrella: true},
|
{:emqx_auth, in_umbrella: true},
|
||||||
{:hocon, github: "emqx/hocon", tag: "0.42.2", override: true},
|
{:emqx_resource, in_umbrella: true},
|
||||||
{:snabbkaffe, github: "kafka4beam/snabbkaffe", tag: "1.0.10", override: true},
|
{:emqx_connector, in_umbrella: true},
|
||||||
|
{:hocon, github: "emqx/hocon", tag: "0.42.2", override: true}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
defmodule EMQXAuthJWT.MixProject do
|
defmodule EMQXAuthJWT.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
|
@ -7,7 +8,8 @@ defmodule EMQXAuthJWT.MixProject do
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
# config_path: "../../config/config.exs",
|
# config_path: "../../config/config.exs",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -18,10 +20,7 @@ defmodule EMQXAuthJWT.MixProject do
|
||||||
|
|
||||||
# Run "mix help compile.app" to learn about applications
|
# Run "mix help compile.app" to learn about applications
|
||||||
def application do
|
def application do
|
||||||
[
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_auth_jwt_app, []}]
|
||||||
extra_applications: [],
|
|
||||||
mod: {:emqx_auth_jwt_app, []}
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
@ -29,7 +28,7 @@ defmodule EMQXAuthJWT.MixProject do
|
||||||
{:emqx, in_umbrella: true},
|
{:emqx, in_umbrella: true},
|
||||||
{:emqx_auth, in_umbrella: true},
|
{:emqx_auth, in_umbrella: true},
|
||||||
{:emqx_resource, in_umbrella: true},
|
{:emqx_resource, in_umbrella: true},
|
||||||
{:jose, github: "potatosalad/erlang-jose", tag: "1.11.2"},
|
{:jose, github: "potatosalad/erlang-jose", tag: "1.11.2"}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
defmodule EMQXAuthLDAP.MixProject do
|
defmodule EMQXAuthLDAP.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
|
@ -7,7 +8,8 @@ defmodule EMQXAuthLDAP.MixProject do
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
# config_path: "../../config/config.exs",
|
# config_path: "../../config/config.exs",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -18,16 +20,14 @@ defmodule EMQXAuthLDAP.MixProject do
|
||||||
|
|
||||||
# Run "mix help compile.app" to learn about applications
|
# Run "mix help compile.app" to learn about applications
|
||||||
def application do
|
def application do
|
||||||
[
|
[extra_applications: [:eldap], mod: {:emqx_auth_ldap_app, []}]
|
||||||
extra_applications: [:eldap],
|
|
||||||
mod: {:emqx_auth_ldap_app, []}
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:emqx, in_umbrella: true},
|
{:emqx, in_umbrella: true},
|
||||||
{:emqx_auth, in_umbrella: true},
|
{:emqx_auth, in_umbrella: true},
|
||||||
|
{:emqx_ldap, in_umbrella: true},
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,25 +33,27 @@ groups() ->
|
||||||
emqx_authz_test_lib:table_groups(t_run_case, cases()).
|
emqx_authz_test_lib:table_groups(t_run_case, cases()).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
ok = stop_apps([emqx_resource]),
|
|
||||||
case emqx_common_test_helpers:is_tcp_server_available(?LDAP_HOST, ?LDAP_DEFAULT_PORT) of
|
case emqx_common_test_helpers:is_tcp_server_available(?LDAP_HOST, ?LDAP_DEFAULT_PORT) of
|
||||||
true ->
|
true ->
|
||||||
ok = emqx_common_test_helpers:start_apps(
|
Apps = emqx_cth_suite:start(
|
||||||
[emqx_conf, emqx_auth, emqx_auth_ldap],
|
[
|
||||||
fun set_special_configs/1
|
emqx,
|
||||||
|
emqx_conf,
|
||||||
|
emqx_auth,
|
||||||
|
emqx_auth_ldap
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
),
|
),
|
||||||
ok = start_apps([emqx_resource]),
|
|
||||||
ok = create_ldap_resource(),
|
ok = create_ldap_resource(),
|
||||||
Config;
|
[{apps, Apps} | Config];
|
||||||
false ->
|
false ->
|
||||||
{skip, no_ldap}
|
{skip, no_ldap}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(Config) ->
|
||||||
ok = emqx_authz_test_lib:restore_authorizers(),
|
Apps = ?config(apps, Config),
|
||||||
ok = emqx_resource:remove_local(?LDAP_RESOURCE),
|
emqx_cth_suite:stop(Apps),
|
||||||
ok = stop_apps([emqx_resource]),
|
ok.
|
||||||
ok = emqx_common_test_helpers:stop_apps([emqx_conf, emqx_auth, emqx_auth_ldap]).
|
|
||||||
|
|
||||||
init_per_group(Group, Config) ->
|
init_per_group(Group, Config) ->
|
||||||
[{test_case, emqx_authz_test_lib:get_case(Group, cases())} | Config].
|
[{test_case, emqx_authz_test_lib:get_case(Group, cases())} | Config].
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
defmodule EMQXAuthMnesia.MixProject do
|
defmodule EMQXAuthMnesia.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
|
@ -7,7 +8,8 @@ defmodule EMQXAuthMnesia.MixProject do
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
# config_path: "../../config/config.exs",
|
# config_path: "../../config/config.exs",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -18,16 +20,10 @@ defmodule EMQXAuthMnesia.MixProject do
|
||||||
|
|
||||||
# Run "mix help compile.app" to learn about applications
|
# Run "mix help compile.app" to learn about applications
|
||||||
def application do
|
def application do
|
||||||
[
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_auth_mnesia_app, []}]
|
||||||
extra_applications: [],
|
|
||||||
mod: {:emqx_auth_mnesia_app, []}
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[{:emqx, in_umbrella: true}, {:emqx_auth, in_umbrella: true}]
|
||||||
{:emqx, in_umbrella: true},
|
|
||||||
{:emqx_auth, in_umbrella: true},
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -51,6 +51,7 @@ end_per_testcase(_, Config) ->
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
Apps = emqx_cth_suite:start(
|
Apps = emqx_cth_suite:start(
|
||||||
[
|
[
|
||||||
|
emqx_ctl,
|
||||||
emqx,
|
emqx,
|
||||||
emqx_conf,
|
emqx_conf,
|
||||||
emqx_auth,
|
emqx_auth,
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include_lib("emqx_authz.hrl").
|
-include_lib("emqx_auth/include/emqx_authz.hrl").
|
||||||
|
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
defmodule EMQXAuthMongoDB.MixProject do
|
defmodule EMQXAuthMongoDB.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
|
@ -7,7 +8,8 @@ defmodule EMQXAuthMongoDB.MixProject do
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
# config_path: "../../config/config.exs",
|
# config_path: "../../config/config.exs",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -18,16 +20,14 @@ defmodule EMQXAuthMongoDB.MixProject do
|
||||||
|
|
||||||
# Run "mix help compile.app" to learn about applications
|
# Run "mix help compile.app" to learn about applications
|
||||||
def application do
|
def application do
|
||||||
[
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_auth_mongodb_app, []}]
|
||||||
extra_applications: [],
|
|
||||||
mod: {:emqx_auth_mongodb_app, []}
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:emqx, in_umbrella: true},
|
{:emqx, in_umbrella: true},
|
||||||
{:emqx_auth, in_umbrella: true},
|
{:emqx_auth, in_umbrella: true},
|
||||||
|
{:emqx_mongodb, in_umbrella: true},
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include_lib("emqx_connector/include/emqx_connector.hrl").
|
-include("../../emqx_connector/include/emqx_connector.hrl").
|
||||||
-include_lib("emqx_auth/include/emqx_authn.hrl").
|
-include_lib("emqx_auth/include/emqx_authn.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include_lib("emqx_connector/include/emqx_connector.hrl").
|
-include("../../emqx_connector/include/emqx_connector.hrl").
|
||||||
-include_lib("emqx_auth/include/emqx_authn.hrl").
|
-include_lib("emqx_auth/include/emqx_authn.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include_lib("emqx_auth/include/emqx_authz.hrl").
|
-include_lib("emqx_auth/include/emqx_authz.hrl").
|
||||||
-include_lib("emqx_connector/include/emqx_connector.hrl").
|
-include("../../emqx_connector/include/emqx_connector.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
-include_lib("emqx/include/emqx_placeholder.hrl").
|
-include_lib("emqx/include/emqx_placeholder.hrl").
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
defmodule EMQXAuthMySQL.MixProject do
|
defmodule EMQXAuthMySQL.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
|
@ -7,7 +8,8 @@ defmodule EMQXAuthMySQL.MixProject do
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
# config_path: "../../config/config.exs",
|
# config_path: "../../config/config.exs",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -18,16 +20,14 @@ defmodule EMQXAuthMySQL.MixProject do
|
||||||
|
|
||||||
# Run "mix help compile.app" to learn about applications
|
# Run "mix help compile.app" to learn about applications
|
||||||
def application do
|
def application do
|
||||||
[
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_auth_mysql_app, []}]
|
||||||
extra_applications: [],
|
|
||||||
mod: {:emqx_auth_mysql_app, []}
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:emqx, in_umbrella: true},
|
{:emqx, in_umbrella: true},
|
||||||
{:emqx_auth, in_umbrella: true},
|
{:emqx_auth, in_umbrella: true},
|
||||||
|
{:emqx_mysql, in_umbrella: true}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include_lib("emqx_connector/include/emqx_connector.hrl").
|
-include("../../emqx_connector/include/emqx_connector.hrl").
|
||||||
-include_lib("emqx_auth/include/emqx_authn.hrl").
|
-include_lib("emqx_auth/include/emqx_authn.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include_lib("emqx_connector/include/emqx_connector.hrl").
|
-include("../../emqx_connector/include/emqx_connector.hrl").
|
||||||
-include_lib("emqx_auth/include/emqx_authn.hrl").
|
-include_lib("emqx_auth/include/emqx_authn.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include("emqx_connector.hrl").
|
-include("../../emqx_connector/include/emqx_connector.hrl").
|
||||||
-include_lib("emqx_auth/include/emqx_authz.hrl").
|
-include_lib("emqx_auth/include/emqx_authz.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
defmodule EMQXAuthPostgreSQL.MixProject do
|
defmodule EMQXAuthPostgreSQL.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
|
@ -7,7 +8,8 @@ defmodule EMQXAuthPostgreSQL.MixProject do
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
# config_path: "../../config/config.exs",
|
# config_path: "../../config/config.exs",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -18,17 +20,14 @@ defmodule EMQXAuthPostgreSQL.MixProject do
|
||||||
|
|
||||||
# Run "mix help compile.app" to learn about applications
|
# Run "mix help compile.app" to learn about applications
|
||||||
def application do
|
def application do
|
||||||
[
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_auth_postgresql_app, []}]
|
||||||
extra_applications: [],
|
|
||||||
mod: {:emqx_auth_postgresql_app, []}
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:emqx, in_umbrella: true},
|
{:emqx, in_umbrella: true},
|
||||||
{:emqx_auth, in_umbrella: true},
|
{:emqx_auth, in_umbrella: true},
|
||||||
{:epgsql, github: "emqx/epgsql", tag: "4.7.1.2", override: true},
|
{:emqx_postgresql, in_umbrella: true},
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include_lib("emqx_postgresql/include/emqx_postgresql.hrl").
|
-include_lib("../../emqx_postgresql/include/emqx_postgresql.hrl").
|
||||||
-include_lib("emqx_auth/include/emqx_authn.hrl").
|
-include_lib("emqx_auth/include/emqx_authn.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
@ -196,7 +196,7 @@ test_user_auth(#{
|
||||||
?GLOBAL
|
?GLOBAL
|
||||||
).
|
).
|
||||||
|
|
||||||
t_authenticate_disabled_prepared_statements(Config) ->
|
t_authenticate_disabled_prepared_statements(_Config) ->
|
||||||
ResConfig = maps:merge(pgsql_config(), #{disable_prepared_statements => true}),
|
ResConfig = maps:merge(pgsql_config(), #{disable_prepared_statements => true}),
|
||||||
{ok, _} = emqx_resource:recreate_local(?PGSQL_RESOURCE, emqx_postgresql, ResConfig),
|
{ok, _} = emqx_resource:recreate_local(?PGSQL_RESOURCE, emqx_postgresql, ResConfig),
|
||||||
on_exit(fun() ->
|
on_exit(fun() ->
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include_lib("emqx_postgresql/include/emqx_postgresql.hrl").
|
-include_lib("../../emqx_postgresql/include/emqx_postgresql.hrl").
|
||||||
-include_lib("emqx_auth/include/emqx_authn.hrl").
|
-include_lib("emqx_auth/include/emqx_authn.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include_lib("emqx_postgresql/include/emqx_postgresql.hrl").
|
-include_lib("../../emqx_postgresql/include/emqx_postgresql.hrl").
|
||||||
-include_lib("emqx_auth/include/emqx_authz.hrl").
|
-include_lib("emqx_auth/include/emqx_authz.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
defmodule EMQXAuthRedis.MixProject do
|
defmodule EMQXAuthRedis.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
|
@ -7,7 +8,8 @@ defmodule EMQXAuthRedis.MixProject do
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
# config_path: "../../config/config.exs",
|
# config_path: "../../config/config.exs",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -18,16 +20,14 @@ defmodule EMQXAuthRedis.MixProject do
|
||||||
|
|
||||||
# Run "mix help compile.app" to learn about applications
|
# Run "mix help compile.app" to learn about applications
|
||||||
def application do
|
def application do
|
||||||
[
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_auth_redis_app, []}]
|
||||||
extra_applications: [],
|
|
||||||
mod: {:emqx_auth_redis_app, []}
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:emqx, in_umbrella: true},
|
{:emqx, in_umbrella: true},
|
||||||
{:emqx_auth, in_umbrella: true},
|
{:emqx_auth, in_umbrella: true},
|
||||||
|
{:emqx_redis, in_umbrella: true}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include_lib("emqx_connector/include/emqx_connector.hrl").
|
-include("../../emqx_connector/include/emqx_connector.hrl").
|
||||||
-include_lib("emqx_auth/include/emqx_authn.hrl").
|
-include_lib("emqx_auth/include/emqx_authn.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include("emqx_connector.hrl").
|
-include("../../emqx_connector/include/emqx_connector.hrl").
|
||||||
-include_lib("emqx_auth/include/emqx_authz.hrl").
|
-include_lib("emqx_auth/include/emqx_authz.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXAutoSubscribe.MixProject do
|
defmodule EMQXAutoSubscribe.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_auto_subscribe,
|
app: :emqx_auto_subscribe,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXAutoSubscribe.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: [], mod: {:emqx_auto_subscribe_app, []}]
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_auto_subscribe_app, []}]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -19,8 +19,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
|
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
-include_lib("common_test/include/ct.hrl").
|
||||||
-define(APP, emqx_auto_subscribe).
|
|
||||||
|
|
||||||
-define(TOPIC_C, <<"/c/${clientid}">>).
|
-define(TOPIC_C, <<"/c/${clientid}">>).
|
||||||
-define(TOPIC_U, <<"/u/${username}">>).
|
-define(TOPIC_U, <<"/u/${username}">>).
|
||||||
|
@ -44,8 +43,6 @@ all() ->
|
||||||
emqx_common_test_helpers:all(?MODULE).
|
emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
mria:start(),
|
|
||||||
application:stop(?APP),
|
|
||||||
meck:new(emqx_schema, [non_strict, passthrough, no_history, no_link]),
|
meck:new(emqx_schema, [non_strict, passthrough, no_history, no_link]),
|
||||||
meck:expect(emqx_schema, fields, fun
|
meck:expect(emqx_schema, fields, fun
|
||||||
("auto_subscribe") ->
|
("auto_subscribe") ->
|
||||||
|
@ -60,43 +57,45 @@ init_per_suite(Config) ->
|
||||||
meck:expect(emqx_resource, update, fun(_, _, _, _) -> {ok, meck_data} end),
|
meck:expect(emqx_resource, update, fun(_, _, _, _) -> {ok, meck_data} end),
|
||||||
meck:expect(emqx_resource, remove, fun(_) -> ok end),
|
meck:expect(emqx_resource, remove, fun(_) -> ok end),
|
||||||
|
|
||||||
application:load(emqx_dashboard),
|
ASCfg = <<
|
||||||
application:load(?APP),
|
"auto_subscribe {\n"
|
||||||
ok = emqx_common_test_helpers:load_config(
|
" topics = [\n"
|
||||||
emqx_auto_subscribe_schema,
|
" {\n"
|
||||||
<<
|
" topic = \"/c/${clientid}\"\n"
|
||||||
"auto_subscribe {\n"
|
" },\n"
|
||||||
" topics = [\n"
|
" {\n"
|
||||||
" {\n"
|
" topic = \"/u/${username}\"\n"
|
||||||
" topic = \"/c/${clientid}\"\n"
|
" },\n"
|
||||||
" },\n"
|
" {\n"
|
||||||
" {\n"
|
" topic = \"/h/${host}\"\n"
|
||||||
" topic = \"/u/${username}\"\n"
|
" },\n"
|
||||||
" },\n"
|
" {\n"
|
||||||
" {\n"
|
" topic = \"/p/${port}\"\n"
|
||||||
" topic = \"/h/${host}\"\n"
|
" },\n"
|
||||||
" },\n"
|
" {\n"
|
||||||
" {\n"
|
" topic = \"/client/${clientid}/username/${username}/host/${host}/port/${port}\"\n"
|
||||||
" topic = \"/p/${port}\"\n"
|
" },\n"
|
||||||
" },\n"
|
" {\n"
|
||||||
" {\n"
|
" topic = \"/topic/simple\"\n"
|
||||||
" topic = \"/client/${clientid}/username/${username}/host/${host}/port/${port}\"\n"
|
" qos = 1\n"
|
||||||
" },\n"
|
" rh = 0\n"
|
||||||
" {\n"
|
" rap = 0\n"
|
||||||
" topic = \"/topic/simple\"\n"
|
" nl = 0\n"
|
||||||
" qos = 1\n"
|
" }\n"
|
||||||
" rh = 0\n"
|
" ]\n"
|
||||||
" rap = 0\n"
|
" }"
|
||||||
" nl = 0\n"
|
>>,
|
||||||
" }\n"
|
Apps = emqx_cth_suite:start(
|
||||||
" ]\n"
|
[
|
||||||
" }"
|
emqx,
|
||||||
>>
|
emqx_conf,
|
||||||
|
{emqx_auto_subscribe, ASCfg},
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
),
|
),
|
||||||
emqx_mgmt_api_test_util:init_suite(
|
[{apps, Apps} | Config].
|
||||||
[emqx_conf, ?APP]
|
|
||||||
),
|
|
||||||
Config.
|
|
||||||
|
|
||||||
init_per_testcase(t_get_basic_usage_info, Config) ->
|
init_per_testcase(t_get_basic_usage_info, Config) ->
|
||||||
{ok, _} = emqx_auto_subscribe:update([]),
|
{ok, _} = emqx_auto_subscribe:update([]),
|
||||||
|
@ -119,13 +118,10 @@ topic_config(T) ->
|
||||||
nl => 0
|
nl => 0
|
||||||
}.
|
}.
|
||||||
|
|
||||||
end_per_suite(_) ->
|
end_per_suite(Config) ->
|
||||||
application:unload(emqx_management),
|
Apps = ?config(apps, Config),
|
||||||
application:unload(emqx_conf),
|
emqx_cth_suite:stop(Apps),
|
||||||
application:unload(?APP),
|
ok.
|
||||||
meck:unload(emqx_resource),
|
|
||||||
meck:unload(emqx_schema),
|
|
||||||
emqx_mgmt_api_test_util:end_suite([emqx_conf, ?APP]).
|
|
||||||
|
|
||||||
t_auto_subscribe(_) ->
|
t_auto_subscribe(_) ->
|
||||||
emqx_auto_subscribe:update([#{<<"topic">> => Topic} || Topic <- ?TOPICS]),
|
emqx_auto_subscribe:update([#{<<"topic">> => Topic} || Topic <- ?TOPICS]),
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
defmodule EMQXBridge.MixProject do
|
defmodule EMQXBridge.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge,
|
app: :emqx_bridge,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
|
compilers: Mix.compilers() ++ [:copy_srcs],
|
||||||
|
# used by our `Mix.Tasks.Compile.CopySrcs` compiler
|
||||||
|
extra_dirs: extra_dirs(),
|
||||||
# config_path: "../../config/config.exs",
|
# config_path: "../../config/config.exs",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -18,16 +23,23 @@ defmodule EMQXBridge.MixProject do
|
||||||
|
|
||||||
# Run "mix help compile.app" to learn about applications
|
# Run "mix help compile.app" to learn about applications
|
||||||
def application do
|
def application do
|
||||||
[
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_bridge_app, []}]
|
||||||
extra_applications: [],
|
|
||||||
mod: {:emqx_bridge_app, []}
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:emqx, in_umbrella: true},
|
{:emqx, in_umbrella: true},
|
||||||
{:emqx_resource, in_umbrella: true},
|
{:emqx_resource, in_umbrella: true},
|
||||||
|
{:emqx_connector, in_umbrella: true},
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp extra_dirs() do
|
||||||
|
dirs = []
|
||||||
|
if UMP.test_env?() do
|
||||||
|
["test" | dirs]
|
||||||
|
else
|
||||||
|
dirs
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,25 +22,22 @@ init_per_suite(Config, Apps) ->
|
||||||
[{start_apps, Apps} | Config].
|
[{start_apps, Apps} | Config].
|
||||||
|
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
delete_all_bridges_and_connectors(),
|
Apps = ?config(apps, Config),
|
||||||
emqx_mgmt_api_test_util:end_suite(),
|
emqx_cth_suite:stop(Apps),
|
||||||
ok = emqx_common_test_helpers:stop_apps([emqx_conf]),
|
|
||||||
ok = emqx_connector_test_helpers:stop_apps(lists:reverse(?config(start_apps, Config))),
|
|
||||||
_ = application:stop(emqx_connector),
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_group(TestGroup, BridgeType, Config) ->
|
init_per_group(TestGroup, BridgeType, Config) ->
|
||||||
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
||||||
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
application:load(emqx_bridge),
|
Apps = emqx_cth_suite:start(
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_conf]),
|
?config(start_apps, Config),
|
||||||
ok = emqx_connector_test_helpers:start_apps(?config(start_apps, Config)),
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
{ok, _} = application:ensure_all_started(emqx_connector),
|
),
|
||||||
emqx_mgmt_api_test_util:init_suite(),
|
|
||||||
UniqueNum = integer_to_binary(erlang:unique_integer([positive])),
|
UniqueNum = integer_to_binary(erlang:unique_integer([positive])),
|
||||||
MQTTTopic = <<"mqtt/topic/abc", UniqueNum/binary>>,
|
MQTTTopic = <<"mqtt/topic/abc", UniqueNum/binary>>,
|
||||||
[
|
[
|
||||||
|
{apps, Apps},
|
||||||
{proxy_host, ProxyHost},
|
{proxy_host, ProxyHost},
|
||||||
{proxy_port, ProxyPort},
|
{proxy_port, ProxyPort},
|
||||||
{mqtt_topic, MQTTTopic},
|
{mqtt_topic, MQTTTopic},
|
||||||
|
@ -50,10 +47,11 @@ init_per_group(TestGroup, BridgeType, Config) ->
|
||||||
].
|
].
|
||||||
|
|
||||||
end_per_group(Config) ->
|
end_per_group(Config) ->
|
||||||
|
Apps = ?config(apps, Config),
|
||||||
ProxyHost = ?config(proxy_host, Config),
|
ProxyHost = ?config(proxy_host, Config),
|
||||||
ProxyPort = ?config(proxy_port, Config),
|
ProxyPort = ?config(proxy_port, Config),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
% delete_all_bridges(),
|
emqx_cth_suite:stop(Apps),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_testcase(TestCase, Config0, BridgeConfigCb) ->
|
init_per_testcase(TestCase, Config0, BridgeConfigCb) ->
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeAzureBlobStorage.MixProject do
|
defmodule EMQXBridgeAzureBlobStorage.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_azure_blob_storage,
|
app: :emqx_bridge_azure_blob_storage,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,10 @@ defmodule EMQXBridgeAzureBlobStorage.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: [], mod: {:emqx_bridge_azure_blob_storage_app, []}]
|
[
|
||||||
|
extra_applications: UMP.extra_applications(),
|
||||||
|
mod: {:emqx_bridge_azure_blob_storage_app, []}
|
||||||
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeAzureEventHub.MixProject do
|
defmodule EMQXBridgeAzureEventHub.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_azure_event_hub,
|
app: :emqx_bridge_azure_event_hub,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,16 +18,16 @@ defmodule EMQXBridgeAzureEventHub.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:wolff, github: "kafka4beam/wolff", tag: "1.10.4"},
|
{:wolff, github: "kafka4beam/wolff", tag: "1.10.4"},
|
||||||
## TODO: remove `mix.exs` from `wolff` and remove this override
|
|
||||||
{:kafka_protocol, github: "kafka4beam/kafka_protocol", tag: "4.1.5", override: true},
|
{:kafka_protocol, github: "kafka4beam/kafka_protocol", tag: "4.1.5", override: true},
|
||||||
{:brod_gssapi, github: "kafka4beam/brod_gssapi", tag: "v0.1.1"},
|
{:brod_gssapi, github: "kafka4beam/brod_gssapi", tag: "v0.1.1"},
|
||||||
{:brod, github: "kafka4beam/brod", tag: "3.18.0"},
|
{:brod, github: "kafka4beam/brod", tag: "3.18.0"},
|
||||||
|
## TODO: remove `mix.exs` from `wolff` and remove this override
|
||||||
## TODO: remove `mix.exs` from `pulsar` and remove this override
|
## TODO: remove `mix.exs` from `pulsar` and remove this override
|
||||||
{:snappyer, "1.2.9", override: true},
|
{:snappyer, "1.2.9", override: true},
|
||||||
{:emqx_connector, in_umbrella: true, runtime: false},
|
{:emqx_connector, in_umbrella: true, runtime: false},
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeCassandra.MixProject do
|
defmodule EMQXBridgeCassandra.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_cassandra,
|
app: :emqx_bridge_cassandra,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeCassandra.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -148,8 +148,6 @@ init_per_suite(Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(_Config) ->
|
||||||
emqx_mgmt_api_test_util:end_suite(),
|
|
||||||
ok = emqx_common_test_helpers:stop_apps([emqx_bridge, emqx_conf]),
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_testcase(_Testcase, Config) ->
|
init_per_testcase(_Testcase, Config) ->
|
||||||
|
@ -191,11 +189,10 @@ common_init(Config0) ->
|
||||||
emqx_bridge,
|
emqx_bridge,
|
||||||
emqx_rule_engine,
|
emqx_rule_engine,
|
||||||
emqx_management,
|
emqx_management,
|
||||||
{emqx_dashboard, "dashboard.listeners.http { enable = true, bind = 18083 }"}
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
],
|
],
|
||||||
#{work_dir => emqx_cth_suite:work_dir(Config0)}
|
#{work_dir => emqx_cth_suite:work_dir(Config0)}
|
||||||
),
|
),
|
||||||
{ok, _Api} = emqx_common_test_http:create_default_app(),
|
|
||||||
% Connect to cassnadra directly and create the table
|
% Connect to cassnadra directly and create the table
|
||||||
catch connect_and_drop_table(Config0),
|
catch connect_and_drop_table(Config0),
|
||||||
connect_and_create_table(Config0),
|
connect_and_create_table(Config0),
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
-include("emqx_bridge_cassandra.hrl").
|
-include("emqx_bridge_cassandra.hrl").
|
||||||
-include("emqx_connector/include/emqx_connector.hrl").
|
-include("../../emqx_connector/include/emqx_connector.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("emqx/include/emqx.hrl").
|
-include_lib("emqx/include/emqx.hrl").
|
||||||
-include_lib("stdlib/include/assert.hrl").
|
-include_lib("stdlib/include/assert.hrl").
|
||||||
|
@ -53,10 +53,24 @@ cassandra_servers(CassandraHost, CassandraPort) ->
|
||||||
).
|
).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_conf]),
|
Apps = emqx_cth_suite:start(
|
||||||
ok = emqx_connector_test_helpers:start_apps([emqx_resource]),
|
[
|
||||||
{ok, _} = application:ensure_all_started(emqx_connector),
|
emqx,
|
||||||
Config.
|
emqx_conf,
|
||||||
|
emqx_bridge_cassandra,
|
||||||
|
emqx_bridge,
|
||||||
|
emqx_rule_engine,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
|
),
|
||||||
|
[{apps, Apps} | Config].
|
||||||
|
|
||||||
|
end_per_suite(Config) ->
|
||||||
|
Apps = ?config(apps, Config),
|
||||||
|
emqx_cth_suite:stop(Apps),
|
||||||
|
ok.
|
||||||
|
|
||||||
init_per_group(Group, Config) ->
|
init_per_group(Group, Config) ->
|
||||||
{CassandraHost, CassandraPort, AuthOpts} =
|
{CassandraHost, CassandraPort, AuthOpts} =
|
||||||
|
@ -98,11 +112,6 @@ init_per_group(Group, Config) ->
|
||||||
end_per_group(_Group, _Config) ->
|
end_per_group(_Group, _Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
|
||||||
ok = emqx_common_test_helpers:stop_apps([emqx_conf]),
|
|
||||||
ok = emqx_connector_test_helpers:stop_apps([emqx_resource]),
|
|
||||||
_ = application:stop(emqx_connector).
|
|
||||||
|
|
||||||
init_per_testcase(_, Config) ->
|
init_per_testcase(_, Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeClickhouse.MixProject do
|
defmodule EMQXBridgeClickhouse.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_clickhouse,
|
app: :emqx_bridge_clickhouse,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeClickhouse.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-define(APP, emqx_bridge_clickhouse).
|
|
||||||
-define(CLICKHOUSE_HOST, "clickhouse").
|
-define(CLICKHOUSE_HOST, "clickhouse").
|
||||||
-define(CLICKHOUSE_PORT, "8123").
|
-define(CLICKHOUSE_PORT, "8123").
|
||||||
|
-include_lib("common_test/include/ct.hrl").
|
||||||
-include_lib("emqx_connector/include/emqx_connector.hrl").
|
-include_lib("emqx_connector/include/emqx_connector.hrl").
|
||||||
|
|
||||||
%% See comment in
|
%% See comment in
|
||||||
|
@ -25,17 +25,26 @@ init_per_suite(Config) ->
|
||||||
Port = list_to_integer(clickhouse_port()),
|
Port = list_to_integer(clickhouse_port()),
|
||||||
case emqx_common_test_helpers:is_tcp_server_available(Host, Port) of
|
case emqx_common_test_helpers:is_tcp_server_available(Host, Port) of
|
||||||
true ->
|
true ->
|
||||||
emqx_common_test_helpers:render_and_load_app_config(emqx_conf),
|
Apps = emqx_cth_suite:start(
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_conf, emqx_bridge]),
|
[
|
||||||
ok = emqx_connector_test_helpers:start_apps([emqx_resource, ?APP]),
|
emqx,
|
||||||
snabbkaffe:fix_ct_logging(),
|
emqx_conf,
|
||||||
|
emqx_bridge_clickhouse,
|
||||||
|
emqx_connector,
|
||||||
|
emqx_bridge,
|
||||||
|
emqx_rule_engine,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
|
),
|
||||||
%% Create the db table
|
%% Create the db table
|
||||||
Conn = start_clickhouse_connection(),
|
Conn = start_clickhouse_connection(),
|
||||||
% erlang:monitor,sb
|
% erlang:monitor,sb
|
||||||
{ok, _, _} = clickhouse:query(Conn, sql_create_database(), #{}),
|
{ok, _, _} = clickhouse:query(Conn, sql_create_database(), #{}),
|
||||||
{ok, _, _} = clickhouse:query(Conn, sql_create_table(), []),
|
{ok, _, _} = clickhouse:query(Conn, sql_create_table(), []),
|
||||||
clickhouse:query(Conn, sql_find_key(42), []),
|
clickhouse:query(Conn, sql_find_key(42), []),
|
||||||
[{clickhouse_connection, Conn} | Config];
|
[{apps, Apps}, {clickhouse_connection, Conn} | Config];
|
||||||
false ->
|
false ->
|
||||||
case os:getenv("IS_CI") of
|
case os:getenv("IS_CI") of
|
||||||
"yes" ->
|
"yes" ->
|
||||||
|
@ -74,8 +83,9 @@ start_clickhouse_connection() ->
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
ClickhouseConnection = proplists:get_value(clickhouse_connection, Config),
|
ClickhouseConnection = proplists:get_value(clickhouse_connection, Config),
|
||||||
clickhouse:stop(ClickhouseConnection),
|
clickhouse:stop(ClickhouseConnection),
|
||||||
ok = emqx_connector_test_helpers:stop_apps([?APP, emqx_resource]),
|
Apps = ?config(apps, Config),
|
||||||
ok = emqx_common_test_helpers:stop_apps([emqx_bridge, emqx_conf]).
|
emqx_cth_suite:stop(Apps),
|
||||||
|
ok.
|
||||||
|
|
||||||
init_per_testcase(_, Config) ->
|
init_per_testcase(_, Config) ->
|
||||||
reset_table(Config),
|
reset_table(Config),
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include("emqx_connector.hrl").
|
-include("../../emqx_connector/include/emqx_connector.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("stdlib/include/assert.hrl").
|
-include_lib("stdlib/include/assert.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
@ -43,8 +43,19 @@ init_per_suite(Config) ->
|
||||||
Port = list_to_integer(emqx_bridge_clickhouse_SUITE:clickhouse_port()),
|
Port = list_to_integer(emqx_bridge_clickhouse_SUITE:clickhouse_port()),
|
||||||
case emqx_common_test_helpers:is_tcp_server_available(Host, Port) of
|
case emqx_common_test_helpers:is_tcp_server_available(Host, Port) of
|
||||||
true ->
|
true ->
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_conf]),
|
Apps = emqx_cth_suite:start(
|
||||||
ok = emqx_connector_test_helpers:start_apps([emqx_resource, ?APP]),
|
[
|
||||||
|
emqx,
|
||||||
|
emqx_conf,
|
||||||
|
emqx_bridge_clickhouse,
|
||||||
|
emqx_connector,
|
||||||
|
emqx_bridge,
|
||||||
|
emqx_rule_engine,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
|
),
|
||||||
%% Create the db table
|
%% Create the db table
|
||||||
{ok, Conn} =
|
{ok, Conn} =
|
||||||
clickhouse:start_link([
|
clickhouse:start_link([
|
||||||
|
@ -55,7 +66,7 @@ init_per_suite(Config) ->
|
||||||
]),
|
]),
|
||||||
{ok, _, _} = clickhouse:query(Conn, <<"CREATE DATABASE IF NOT EXISTS mqtt">>, #{}),
|
{ok, _, _} = clickhouse:query(Conn, <<"CREATE DATABASE IF NOT EXISTS mqtt">>, #{}),
|
||||||
clickhouse:stop(Conn),
|
clickhouse:stop(Conn),
|
||||||
Config;
|
[{apps, Apps} | Config];
|
||||||
false ->
|
false ->
|
||||||
case os:getenv("IS_CI") of
|
case os:getenv("IS_CI") of
|
||||||
"yes" ->
|
"yes" ->
|
||||||
|
@ -65,9 +76,10 @@ init_per_suite(Config) ->
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(Config) ->
|
||||||
ok = emqx_common_test_helpers:stop_apps([emqx_conf]),
|
Apps = ?config(apps, Config),
|
||||||
ok = emqx_connector_test_helpers:stop_apps([?APP, emqx_resource]).
|
emqx_cth_suite:stop(Apps),
|
||||||
|
ok.
|
||||||
|
|
||||||
init_per_testcase(_, Config) ->
|
init_per_testcase(_, Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeConfluent.MixProject do
|
defmodule EMQXBridgeConfluent.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_confluent,
|
app: :emqx_bridge_confluent,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,16 +18,16 @@ defmodule EMQXBridgeConfluent.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:wolff, github: "kafka4beam/wolff", tag: "1.10.4"},
|
{:wolff, github: "kafka4beam/wolff", tag: "1.10.4"},
|
||||||
## TODO: remove `mix.exs` from `wolff` and remove this override
|
|
||||||
{:kafka_protocol, github: "kafka4beam/kafka_protocol", tag: "4.1.5", override: true},
|
{:kafka_protocol, github: "kafka4beam/kafka_protocol", tag: "4.1.5", override: true},
|
||||||
{:brod_gssapi, github: "kafka4beam/brod_gssapi", tag: "v0.1.1"},
|
{:brod_gssapi, github: "kafka4beam/brod_gssapi", tag: "v0.1.1"},
|
||||||
{:brod, github: "kafka4beam/brod", tag: "3.18.0"},
|
{:brod, github: "kafka4beam/brod", tag: "3.18.0"},
|
||||||
|
## TODO: remove `mix.exs` from `wolff` and remove this override
|
||||||
## TODO: remove `mix.exs` from `pulsar` and remove this override
|
## TODO: remove `mix.exs` from `pulsar` and remove this override
|
||||||
{:snappyer, "1.2.9", override: true},
|
{:snappyer, "1.2.9", override: true},
|
||||||
{:emqx_connector, in_umbrella: true, runtime: false},
|
{:emqx_connector, in_umbrella: true, runtime: false},
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeDynamo.MixProject do
|
defmodule EMQXBridgeDynamo.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_dynamo,
|
app: :emqx_bridge_dynamo,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeDynamo.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -69,14 +69,18 @@ init_per_group(_Group, Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_group(Group, Config) when Group =:= with_batch; Group =:= without_batch ->
|
end_per_group(Group, Config) when Group =:= with_batch; Group =:= without_batch ->
|
||||||
|
Apps = ?config(apps, Config),
|
||||||
ProxyHost = ?config(proxy_host, Config),
|
ProxyHost = ?config(proxy_host, Config),
|
||||||
ProxyPort = ?config(proxy_port, Config),
|
ProxyPort = ?config(proxy_port, Config),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
|
emqx_cth_suite:stop(Apps),
|
||||||
ok;
|
ok;
|
||||||
end_per_group(Group, Config) when Group =:= flaky ->
|
end_per_group(Group, Config) when Group =:= flaky ->
|
||||||
|
Apps = ?config(apps, Config),
|
||||||
ProxyHost = ?config(proxy_host, Config),
|
ProxyHost = ?config(proxy_host, Config),
|
||||||
ProxyPort = ?config(proxy_port, Config),
|
ProxyPort = ?config(proxy_port, Config),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
|
emqx_cth_suite:stop(Apps),
|
||||||
timer:sleep(1000),
|
timer:sleep(1000),
|
||||||
ok;
|
ok;
|
||||||
end_per_group(_Group, _Config) ->
|
end_per_group(_Group, _Config) ->
|
||||||
|
@ -135,18 +139,23 @@ common_init(ConfigT) ->
|
||||||
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
||||||
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
% Ensure enterprise bridge module is loaded
|
Apps = emqx_cth_suite:start(
|
||||||
ok = emqx_common_test_helpers:start_apps([
|
[
|
||||||
emqx_conf, emqx_resource, emqx_bridge, emqx_rule_engine
|
emqx_conf,
|
||||||
]),
|
emqx_bridge_dynamo,
|
||||||
_ = application:ensure_all_started(erlcloud),
|
emqx_bridge,
|
||||||
_ = emqx_bridge_enterprise:module_info(),
|
emqx_rule_engine,
|
||||||
emqx_mgmt_api_test_util:init_suite(),
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config0)}
|
||||||
|
),
|
||||||
% setup dynamo
|
% setup dynamo
|
||||||
setup_dynamo(Config0),
|
setup_dynamo(Config0),
|
||||||
{Name, TDConf} = dynamo_config(BridgeType, Config0),
|
{Name, TDConf} = dynamo_config(BridgeType, Config0),
|
||||||
Config =
|
Config =
|
||||||
[
|
[
|
||||||
|
{apps, Apps},
|
||||||
{dynamo_config, TDConf},
|
{dynamo_config, TDConf},
|
||||||
{dynamo_bridge_type, BridgeType},
|
{dynamo_bridge_type, BridgeType},
|
||||||
{dynamo_name, Name},
|
{dynamo_name, Name},
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeEs.MixProject do
|
defmodule EMQXBridgeEs.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_es,
|
app: :emqx_bridge_es,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeEs.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeGcpPubsub.MixProject do
|
defmodule EMQXBridgeGcpPubsub.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_gcp_pubsub,
|
app: :emqx_bridge_gcp_pubsub,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeGcpPubsub.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeGreptimedb.MixProject do
|
defmodule EMQXBridgeGreptimedb.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_greptimedb,
|
app: :emqx_bridge_greptimedb,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeGreptimedb.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -25,11 +25,17 @@ init_per_suite(Config) ->
|
||||||
Servers = [{GreptimedbTCPHost, GreptimedbTCPPort}],
|
Servers = [{GreptimedbTCPHost, GreptimedbTCPPort}],
|
||||||
case emqx_common_test_helpers:is_all_tcp_servers_available(Servers) of
|
case emqx_common_test_helpers:is_all_tcp_servers_available(Servers) of
|
||||||
true ->
|
true ->
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_conf]),
|
Apps = emqx_cth_suite:start(
|
||||||
ok = emqx_connector_test_helpers:start_apps([emqx_resource]),
|
[
|
||||||
{ok, _} = application:ensure_all_started(emqx_connector),
|
emqx,
|
||||||
{ok, _} = application:ensure_all_started(greptimedb),
|
emqx_conf,
|
||||||
|
emqx_bridge_greptimedb,
|
||||||
|
emqx_bridge
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
|
),
|
||||||
[
|
[
|
||||||
|
{apps, Apps},
|
||||||
{greptimedb_tcp_host, GreptimedbTCPHost},
|
{greptimedb_tcp_host, GreptimedbTCPHost},
|
||||||
{greptimedb_tcp_port, GreptimedbTCPPort}
|
{greptimedb_tcp_port, GreptimedbTCPPort}
|
||||||
| Config
|
| Config
|
||||||
|
@ -43,11 +49,9 @@ init_per_suite(Config) ->
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(Config) ->
|
||||||
ok = emqx_common_test_helpers:stop_apps([emqx_conf]),
|
Apps = ?config(apps, Config),
|
||||||
ok = emqx_connector_test_helpers:stop_apps([emqx_resource]),
|
emqx_cth_suite:stop(Apps),
|
||||||
_ = application:stop(emqx_connector),
|
|
||||||
_ = application:stop(greptimedb),
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_testcase(_, Config) ->
|
init_per_testcase(_, Config) ->
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeHstreamdb.MixProject do
|
defmodule EMQXBridgeHstreamdb.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_hstreamdb,
|
app: :emqx_bridge_hstreamdb,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeHstreamdb.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
@ -26,7 +28,7 @@ defmodule EMQXBridgeHstreamdb.MixProject do
|
||||||
{:emqx, in_umbrella: true},
|
{:emqx, in_umbrella: true},
|
||||||
{:emqx_utils, in_umbrella: true},
|
{:emqx_utils, in_umbrella: true},
|
||||||
{:emqx_connector, in_umbrella: true, runtime: false},
|
{:emqx_connector, in_umbrella: true, runtime: false},
|
||||||
{:emqx_resource, in_umbrella: true},
|
{:emqx_resource, in_umbrella: true}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -100,10 +100,12 @@ init_per_group(_Group, Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_group(Group, Config) when Group =:= with_batch; Group =:= without_batch ->
|
end_per_group(Group, Config) when Group =:= with_batch; Group =:= without_batch ->
|
||||||
|
Apps = ?config(apps, Config),
|
||||||
connect_and_delete_stream(Config),
|
connect_and_delete_stream(Config),
|
||||||
ProxyHost = ?config(proxy_host, Config),
|
ProxyHost = ?config(proxy_host, Config),
|
||||||
ProxyPort = ?config(proxy_port, Config),
|
ProxyPort = ?config(proxy_port, Config),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
|
emqx_cth_suite:stop(Apps),
|
||||||
ok;
|
ok;
|
||||||
end_per_group(_Group, _Config) ->
|
end_per_group(_Group, _Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
@ -408,11 +410,16 @@ common_init(ConfigT) ->
|
||||||
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
||||||
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
% Ensure EE bridge module is loaded
|
Apps = emqx_cth_suite:start(
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_conf, emqx_resource, emqx_bridge]),
|
[
|
||||||
_ = application:ensure_all_started(hstreamdb_erl),
|
emqx_conf,
|
||||||
_ = emqx_bridge_enterprise:module_info(),
|
emqx_bridge_hstreamdb,
|
||||||
emqx_mgmt_api_test_util:init_suite(),
|
emqx_bridge,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config0)}
|
||||||
|
),
|
||||||
% Connect to hstreamdb directly
|
% Connect to hstreamdb directly
|
||||||
% drop old stream and then create new one
|
% drop old stream and then create new one
|
||||||
connect_and_delete_stream(Config0),
|
connect_and_delete_stream(Config0),
|
||||||
|
@ -420,6 +427,7 @@ common_init(ConfigT) ->
|
||||||
{Name, HStreamDBConf} = hstreamdb_config(BridgeType, Config0),
|
{Name, HStreamDBConf} = hstreamdb_config(BridgeType, Config0),
|
||||||
Config =
|
Config =
|
||||||
[
|
[
|
||||||
|
{apps, Apps},
|
||||||
{hstreamdb_config, HStreamDBConf},
|
{hstreamdb_config, HStreamDBConf},
|
||||||
{hstreamdb_bridge_type, BridgeType},
|
{hstreamdb_bridge_type, BridgeType},
|
||||||
{hstreamdb_name, Name},
|
{hstreamdb_name, Name},
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
defmodule EMQXBridgeHTTP.MixProject do
|
defmodule EMQXBridgeHTTP.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
|
@ -7,7 +8,8 @@ defmodule EMQXBridgeHTTP.MixProject do
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
# config_path: "../../config/config.exs",
|
# config_path: "../../config/config.exs",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -18,15 +20,14 @@ defmodule EMQXBridgeHTTP.MixProject do
|
||||||
|
|
||||||
# Run "mix help compile.app" to learn about applications
|
# Run "mix help compile.app" to learn about applications
|
||||||
def application do
|
def application do
|
||||||
[
|
[extra_applications: UMP.extra_applications()]
|
||||||
extra_applications: []
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:emqx, in_umbrella: true},
|
{:emqx, in_umbrella: true},
|
||||||
{:emqx_resource, in_umbrella: true},
|
{:emqx_resource, in_umbrella: true},
|
||||||
|
{:ehttpc, github: "emqx/ehttpc", tag: "0.4.13"}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeInfluxdb.MixProject do
|
defmodule EMQXBridgeInfluxdb.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_influxdb,
|
app: :emqx_bridge_influxdb,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeInfluxdb.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -53,12 +53,6 @@ init_per_suite(Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(_Config) ->
|
||||||
delete_all_bridges(),
|
|
||||||
emqx_mgmt_api_test_util:end_suite(),
|
|
||||||
ok = emqx_connector_test_helpers:stop_apps([
|
|
||||||
emqx_conf, emqx_bridge, emqx_resource, emqx_rule_engine
|
|
||||||
]),
|
|
||||||
_ = application:stop(emqx_connector),
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_group(InfluxDBType, Config0) when
|
init_per_group(InfluxDBType, Config0) when
|
||||||
|
@ -92,10 +86,18 @@ init_per_group(InfluxDBType, Config0) when
|
||||||
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
||||||
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
ok = start_apps(),
|
Apps = emqx_cth_suite:start(
|
||||||
{ok, _} = application:ensure_all_started(emqx_connector),
|
[
|
||||||
emqx_mgmt_api_test_util:init_suite(),
|
emqx_conf,
|
||||||
Config = [{use_tls, UseTLS} | Config0],
|
emqx_bridge_influxdb,
|
||||||
|
emqx_bridge,
|
||||||
|
emqx_rule_engine,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config0)}
|
||||||
|
),
|
||||||
|
Config = [{apps, Apps}, {use_tls, UseTLS} | Config0],
|
||||||
{Name, ConfigString, InfluxDBConfig} = influxdb_config(
|
{Name, ConfigString, InfluxDBConfig} = influxdb_config(
|
||||||
apiv1, InfluxDBHost, InfluxDBPort, Config
|
apiv1, InfluxDBHost, InfluxDBPort, Config
|
||||||
),
|
),
|
||||||
|
@ -164,10 +166,18 @@ init_per_group(InfluxDBType, Config0) when
|
||||||
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
||||||
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
ok = start_apps(),
|
Apps = emqx_cth_suite:start(
|
||||||
{ok, _} = application:ensure_all_started(emqx_connector),
|
[
|
||||||
emqx_mgmt_api_test_util:init_suite(),
|
emqx_conf,
|
||||||
Config = [{use_tls, UseTLS} | Config0],
|
emqx_bridge_influxdb,
|
||||||
|
emqx_bridge,
|
||||||
|
emqx_rule_engine,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config0)}
|
||||||
|
),
|
||||||
|
Config = [{apps, Apps}, {use_tls, UseTLS} | Config0],
|
||||||
{Name, ConfigString, InfluxDBConfig} = influxdb_config(
|
{Name, ConfigString, InfluxDBConfig} = influxdb_config(
|
||||||
apiv2, InfluxDBHost, InfluxDBPort, Config
|
apiv2, InfluxDBHost, InfluxDBPort, Config
|
||||||
),
|
),
|
||||||
|
@ -222,12 +232,13 @@ end_per_group(Group, Config) when
|
||||||
Group =:= apiv2_tcp;
|
Group =:= apiv2_tcp;
|
||||||
Group =:= apiv2_tls
|
Group =:= apiv2_tls
|
||||||
->
|
->
|
||||||
|
Apps = ?config(apps, Config),
|
||||||
ProxyHost = ?config(proxy_host, Config),
|
ProxyHost = ?config(proxy_host, Config),
|
||||||
ProxyPort = ?config(proxy_port, Config),
|
ProxyPort = ?config(proxy_port, Config),
|
||||||
EHttpcPoolName = ?config(ehttpc_pool_name, Config),
|
EHttpcPoolName = ?config(ehttpc_pool_name, Config),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
ehttpc_sup:stop_pool(EHttpcPoolName),
|
ehttpc_sup:stop_pool(EHttpcPoolName),
|
||||||
delete_bridge(Config),
|
emqx_cth_suite:stop(Apps),
|
||||||
ok;
|
ok;
|
||||||
end_per_group(_Group, _Config) ->
|
end_per_group(_Group, _Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
@ -250,14 +261,6 @@ end_per_testcase(_Testcase, Config) ->
|
||||||
%% Helper fns
|
%% Helper fns
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
||||||
start_apps() ->
|
|
||||||
%% some configs in emqx_conf app are mandatory
|
|
||||||
%% we want to make sure they are loaded before
|
|
||||||
%% ekka start in emqx_common_test_helpers:start_apps/1
|
|
||||||
emqx_common_test_helpers:render_and_load_app_config(emqx_conf),
|
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_conf]),
|
|
||||||
ok = emqx_connector_test_helpers:start_apps([emqx_resource, emqx_bridge, emqx_rule_engine]).
|
|
||||||
|
|
||||||
example_write_syntax() ->
|
example_write_syntax() ->
|
||||||
%% N.B.: this single space character is relevant
|
%% N.B.: this single space character is relevant
|
||||||
<<"${topic},clientid=${clientid}", " ", "payload=${payload},",
|
<<"${topic},clientid=${clientid}", " ", "payload=${payload},",
|
||||||
|
|
|
@ -27,10 +27,16 @@ init_per_suite(Config) ->
|
||||||
Servers = [{InfluxDBTCPHost, InfluxDBTCPPort}, {InfluxDBTLSHost, InfluxDBTLSPort}],
|
Servers = [{InfluxDBTCPHost, InfluxDBTCPPort}, {InfluxDBTLSHost, InfluxDBTLSPort}],
|
||||||
case emqx_common_test_helpers:is_all_tcp_servers_available(Servers) of
|
case emqx_common_test_helpers:is_all_tcp_servers_available(Servers) of
|
||||||
true ->
|
true ->
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_conf]),
|
Apps = emqx_cth_suite:start(
|
||||||
ok = emqx_connector_test_helpers:start_apps([emqx_resource]),
|
[
|
||||||
{ok, _} = application:ensure_all_started(emqx_connector),
|
emqx_conf,
|
||||||
|
emqx_bridge_influxdb,
|
||||||
|
emqx_bridge
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
|
),
|
||||||
[
|
[
|
||||||
|
{apps, Apps},
|
||||||
{influxdb_tcp_host, InfluxDBTCPHost},
|
{influxdb_tcp_host, InfluxDBTCPHost},
|
||||||
{influxdb_tcp_port, InfluxDBTCPPort},
|
{influxdb_tcp_port, InfluxDBTCPPort},
|
||||||
{influxdb_tls_host, InfluxDBTLSHost},
|
{influxdb_tls_host, InfluxDBTLSHost},
|
||||||
|
@ -46,10 +52,10 @@ init_per_suite(Config) ->
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(Config) ->
|
||||||
ok = emqx_common_test_helpers:stop_apps([emqx_conf]),
|
Apps = ?config(apps, Config),
|
||||||
ok = emqx_connector_test_helpers:stop_apps([emqx_resource]),
|
emqx_cth_suite:stop(Apps),
|
||||||
_ = application:stop(emqx_connector).
|
ok.
|
||||||
|
|
||||||
init_per_testcase(_, Config) ->
|
init_per_testcase(_, Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeIotdb.MixProject do
|
defmodule EMQXBridgeIotdb.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_iotdb,
|
app: :emqx_bridge_iotdb,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeIotdb.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
||||||
|
|
||||||
-define(BRIDGE_TYPE_BIN, <<"iotdb">>).
|
-define(BRIDGE_TYPE_BIN, <<"iotdb">>).
|
||||||
-define(APPS, [emqx_bridge, emqx_resource, emqx_rule_engine, emqx_bridge_iotdb]).
|
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% CT boilerplate
|
%% CT boilerplate
|
||||||
|
@ -34,7 +33,19 @@ groups() ->
|
||||||
].
|
].
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
emqx_bridge_v2_testlib:init_per_suite(Config, ?APPS).
|
emqx_bridge_v2_testlib:init_per_suite(
|
||||||
|
Config,
|
||||||
|
[
|
||||||
|
emqx,
|
||||||
|
emqx_conf,
|
||||||
|
emqx_bridge_iotdb,
|
||||||
|
emqx_connector,
|
||||||
|
emqx_bridge,
|
||||||
|
emqx_rule_engine,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
]
|
||||||
|
).
|
||||||
|
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
emqx_bridge_v2_testlib:end_per_suite(Config).
|
emqx_bridge_v2_testlib:end_per_suite(Config).
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeKafka.MixProject do
|
defmodule EMQXBridgeKafka.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_kafka,
|
app: :emqx_bridge_kafka,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,16 +18,16 @@ defmodule EMQXBridgeKafka.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:wolff, github: "kafka4beam/wolff", tag: "1.10.4"},
|
{:wolff, github: "kafka4beam/wolff", tag: "1.10.4"},
|
||||||
## TODO: remove `mix.exs` from `wolff` and remove this override
|
|
||||||
{:kafka_protocol, github: "kafka4beam/kafka_protocol", tag: "4.1.5", override: true},
|
{:kafka_protocol, github: "kafka4beam/kafka_protocol", tag: "4.1.5", override: true},
|
||||||
{:brod_gssapi, github: "kafka4beam/brod_gssapi", tag: "v0.1.1"},
|
{:brod_gssapi, github: "kafka4beam/brod_gssapi", tag: "v0.1.1"},
|
||||||
{:brod, github: "kafka4beam/brod", tag: "3.18.0"},
|
{:brod, github: "kafka4beam/brod", tag: "3.18.0"},
|
||||||
|
## TODO: remove `mix.exs` from `wolff` and remove this override
|
||||||
## TODO: remove `mix.exs` from `pulsar` and remove this override
|
## TODO: remove `mix.exs` from `pulsar` and remove this override
|
||||||
{:snappyer, "1.2.9", override: true},
|
{:snappyer, "1.2.9", override: true},
|
||||||
{:emqx_connector, in_umbrella: true, runtime: false},
|
{:emqx_connector, in_umbrella: true, runtime: false},
|
||||||
|
|
|
@ -94,7 +94,7 @@ end_per_testcase(TestCase, Config) when
|
||||||
TestCase =:= t_ancient_v1_config_migration_without_local_topic
|
TestCase =:= t_ancient_v1_config_migration_without_local_topic
|
||||||
->
|
->
|
||||||
Cluster = ?config(cluster, Config),
|
Cluster = ?config(cluster, Config),
|
||||||
emqx_cth_cluster:stop(Cluster),
|
ok = emqx_cth_cluster:stop(Cluster),
|
||||||
ok;
|
ok;
|
||||||
end_per_testcase(_TestCase, Config) ->
|
end_per_testcase(_TestCase, Config) ->
|
||||||
ProxyHost = ?config(proxy_host, Config),
|
ProxyHost = ?config(proxy_host, Config),
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeKinesis.MixProject do
|
defmodule EMQXBridgeKinesis.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_kinesis,
|
app: :emqx_bridge_kinesis,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeKinesis.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -42,11 +42,21 @@ init_per_suite(Config) ->
|
||||||
ProxyName = "kinesis",
|
ProxyName = "kinesis",
|
||||||
SecretFile = filename:join(?config(priv_dir, Config), "secret"),
|
SecretFile = filename:join(?config(priv_dir, Config), "secret"),
|
||||||
ok = file:write_file(SecretFile, <<?KINESIS_SECRET_KEY>>),
|
ok = file:write_file(SecretFile, <<?KINESIS_SECRET_KEY>>),
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_conf]),
|
Apps = emqx_cth_suite:start(
|
||||||
ok = emqx_connector_test_helpers:start_apps([emqx_resource, emqx_bridge, emqx_rule_engine]),
|
[
|
||||||
{ok, _} = application:ensure_all_started(emqx_connector),
|
emqx,
|
||||||
emqx_mgmt_api_test_util:init_suite(),
|
emqx_conf,
|
||||||
|
emqx_bridge_kinesis,
|
||||||
|
emqx_connector,
|
||||||
|
emqx_bridge,
|
||||||
|
emqx_rule_engine,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
|
),
|
||||||
[
|
[
|
||||||
|
{apps, Apps},
|
||||||
{proxy_host, ProxyHost},
|
{proxy_host, ProxyHost},
|
||||||
{proxy_port, ProxyPort},
|
{proxy_port, ProxyPort},
|
||||||
{kinesis_port, list_to_integer(os:getenv("KINESIS_PORT", integer_to_list(?KINESIS_PORT)))},
|
{kinesis_port, list_to_integer(os:getenv("KINESIS_PORT", integer_to_list(?KINESIS_PORT)))},
|
||||||
|
@ -55,11 +65,9 @@ init_per_suite(Config) ->
|
||||||
| Config
|
| Config
|
||||||
].
|
].
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(Config) ->
|
||||||
emqx_mgmt_api_test_util:end_suite(),
|
Apps = ?config(apps, Config),
|
||||||
ok = emqx_common_test_helpers:stop_apps([emqx_conf]),
|
emqx_cth_suite:stop(Apps),
|
||||||
ok = emqx_connector_test_helpers:stop_apps([emqx_bridge, emqx_resource, emqx_rule_engine]),
|
|
||||||
_ = application:stop(emqx_connector),
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_group(with_batch, Config) ->
|
init_per_group(with_batch, Config) ->
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeMatrix.MixProject do
|
defmodule EMQXBridgeMatrix.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_matrix,
|
app: :emqx_bridge_matrix,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeMatrix.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeMongodb.MixProject do
|
defmodule EMQXBridgeMongodb.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_mongodb,
|
app: :emqx_bridge_mongodb,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeMongodb.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
defmodule EMQXBridgeMQTT.MixProject do
|
defmodule EMQXBridgeMQTT.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
|
@ -7,7 +8,8 @@ defmodule EMQXBridgeMQTT.MixProject do
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
# config_path: "../../config/config.exs",
|
# config_path: "../../config/config.exs",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -18,15 +20,14 @@ defmodule EMQXBridgeMQTT.MixProject do
|
||||||
|
|
||||||
# Run "mix help compile.app" to learn about applications
|
# Run "mix help compile.app" to learn about applications
|
||||||
def application do
|
def application do
|
||||||
[
|
[extra_applications: UMP.extra_applications()]
|
||||||
extra_applications: []
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:emqx, in_umbrella: true},
|
{:emqx, in_umbrella: true},
|
||||||
{:emqx_resource, in_umbrella: true},
|
{:emqx_resource, in_umbrella: true},
|
||||||
|
{:emqtt, github: "emqx/emqtt", tag: "1.10.1", system_env: UMP.maybe_no_quic_env()}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
|
|
||||||
-import(emqx_dashboard_api_test_helpers, [request/4, uri/1]).
|
-import(emqx_dashboard_api_test_helpers, [request/4, uri/1]).
|
||||||
|
|
||||||
-include("emqx/include/emqx.hrl").
|
-include_lib("emqx/include/emqx.hrl").
|
||||||
-include("emqx/include/emqx_hooks.hrl").
|
-include_lib("emqx/include/emqx_hooks.hrl").
|
||||||
-include("emqx/include/asserts.hrl").
|
-include_lib("emqx/include/asserts.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
||||||
|
@ -214,6 +214,7 @@ t_conf_bridge_authn_password(_) ->
|
||||||
).
|
).
|
||||||
|
|
||||||
t_conf_bridge_authn_passfile(Config) ->
|
t_conf_bridge_authn_passfile(Config) ->
|
||||||
|
%% test_server_ctrl:run_test_cases_loop
|
||||||
DataDir = ?config(data_dir, Config),
|
DataDir = ?config(data_dir, Config),
|
||||||
Username2 = <<"user2">>,
|
Username2 = <<"user2">>,
|
||||||
PasswordFilename = filename:join(DataDir, "password"),
|
PasswordFilename = filename:join(DataDir, "password"),
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeMysql.MixProject do
|
defmodule EMQXBridgeMysql.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_mysql,
|
app: :emqx_bridge_mysql,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeMysql.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -105,10 +105,12 @@ init_per_group(_Group, Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_group(Group, Config) when Group =:= with_batch; Group =:= without_batch ->
|
end_per_group(Group, Config) when Group =:= with_batch; Group =:= without_batch ->
|
||||||
|
Apps = ?config(apps, Config),
|
||||||
connect_and_drop_table(Config),
|
connect_and_drop_table(Config),
|
||||||
ProxyHost = ?config(proxy_host, Config),
|
ProxyHost = ?config(proxy_host, Config),
|
||||||
ProxyPort = ?config(proxy_port, Config),
|
ProxyPort = ?config(proxy_port, Config),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
|
emqx_cth_suite:stop(Apps),
|
||||||
ok;
|
ok;
|
||||||
end_per_group(_Group, _Config) ->
|
end_per_group(_Group, _Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
@ -150,15 +152,25 @@ common_init(Config0) ->
|
||||||
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
||||||
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
% Ensure enterprise bridge module is loaded
|
Apps = emqx_cth_suite:start(
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_conf, emqx_bridge, emqx_rule_engine]),
|
[
|
||||||
_ = emqx_bridge_enterprise:module_info(),
|
emqx,
|
||||||
emqx_mgmt_api_test_util:init_suite(),
|
emqx_conf,
|
||||||
|
emqx_connector,
|
||||||
|
emqx_bridge,
|
||||||
|
emqx_bridge_mysql,
|
||||||
|
emqx_rule_engine,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config0)}
|
||||||
|
),
|
||||||
% Connect to mysql directly and create the table
|
% Connect to mysql directly and create the table
|
||||||
connect_and_create_table(Config0),
|
connect_and_create_table(Config0),
|
||||||
{Name, MysqlConfig} = mysql_config(BridgeType, Config0),
|
{Name, MysqlConfig} = mysql_config(BridgeType, Config0),
|
||||||
Config =
|
Config =
|
||||||
[
|
[
|
||||||
|
{apps, Apps},
|
||||||
{mysql_config, MysqlConfig},
|
{mysql_config, MysqlConfig},
|
||||||
{mysql_bridge_type, BridgeType},
|
{mysql_bridge_type, BridgeType},
|
||||||
{mysql_name, Name},
|
{mysql_name, Name},
|
||||||
|
@ -171,7 +183,12 @@ common_init(Config0) ->
|
||||||
],
|
],
|
||||||
Config;
|
Config;
|
||||||
false ->
|
false ->
|
||||||
{skip, no_mysql}
|
case os:getenv("IS_CI") of
|
||||||
|
"yes" ->
|
||||||
|
throw(no_mysql);
|
||||||
|
_ ->
|
||||||
|
{skip, no_mysql}
|
||||||
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
mysql_config(BridgeType, Config) ->
|
mysql_config(BridgeType, Config) ->
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeOpents.MixProject do
|
defmodule EMQXBridgeOpents.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_opents,
|
app: :emqx_bridge_opents,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeOpents.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
|
|
||||||
% DB defaults
|
% DB defaults
|
||||||
-define(BRIDGE_TYPE_BIN, <<"opents">>).
|
-define(BRIDGE_TYPE_BIN, <<"opents">>).
|
||||||
-define(APPS, [opentsdb, emqx_bridge, emqx_resource, emqx_rule_engine, emqx_bridge_opents_SUITE]).
|
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% CT boilerplate
|
%% CT boilerplate
|
||||||
|
@ -31,7 +30,16 @@ groups() ->
|
||||||
].
|
].
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
emqx_bridge_v2_testlib:init_per_suite(Config, ?APPS).
|
emqx_bridge_v2_testlib:init_per_suite(Config, [
|
||||||
|
emqx,
|
||||||
|
emqx_conf,
|
||||||
|
emqx_bridge_opents,
|
||||||
|
emqx_connector,
|
||||||
|
emqx_bridge,
|
||||||
|
emqx_rule_engine,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
]).
|
||||||
|
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
emqx_bridge_v2_testlib:end_per_suite(Config).
|
emqx_bridge_v2_testlib:end_per_suite(Config).
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeOracle.MixProject do
|
defmodule EMQXBridgeOracle.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_oracle,
|
app: :emqx_bridge_oracle,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeOracle.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
-import(emqx_common_test_helpers, [on_exit/1]).
|
-import(emqx_common_test_helpers, [on_exit/1]).
|
||||||
|
|
||||||
-define(BRIDGE_TYPE_BIN, <<"oracle">>).
|
-define(BRIDGE_TYPE_BIN, <<"oracle">>).
|
||||||
-define(APPS, [emqx_bridge, emqx_resource, emqx_rule_engine, emqx_oracle, emqx_bridge_oracle]).
|
|
||||||
-define(SID, "XE").
|
-define(SID, "XE").
|
||||||
-define(RULE_TOPIC, "mqtt/rule").
|
-define(RULE_TOPIC, "mqtt/rule").
|
||||||
|
|
||||||
|
@ -36,10 +35,6 @@ init_per_suite(Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(_Config) ->
|
||||||
emqx_mgmt_api_test_util:end_suite(),
|
|
||||||
ok = emqx_common_test_helpers:stop_apps([emqx_conf]),
|
|
||||||
ok = emqx_connector_test_helpers:stop_apps(lists:reverse(?APPS)),
|
|
||||||
_ = application:stop(emqx_connector),
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_group(plain = Type, Config) ->
|
init_per_group(plain = Type, Config) ->
|
||||||
|
@ -48,7 +43,7 @@ init_per_group(plain = Type, Config) ->
|
||||||
ProxyName = "oracle",
|
ProxyName = "oracle",
|
||||||
case emqx_common_test_helpers:is_tcp_server_available(OracleHost, OraclePort) of
|
case emqx_common_test_helpers:is_tcp_server_available(OracleHost, OraclePort) of
|
||||||
true ->
|
true ->
|
||||||
Config1 = common_init_per_group(),
|
Config1 = common_init_per_group(Config),
|
||||||
[
|
[
|
||||||
{proxy_name, ProxyName},
|
{proxy_name, ProxyName},
|
||||||
{oracle_host, OracleHost},
|
{oracle_host, OracleHost},
|
||||||
|
@ -71,23 +66,33 @@ end_per_group(Group, Config) when
|
||||||
Group =:= plain
|
Group =:= plain
|
||||||
->
|
->
|
||||||
common_end_per_group(Config),
|
common_end_per_group(Config),
|
||||||
|
Apps = ?config(apps, Config),
|
||||||
|
emqx_cth_suite:stop(Apps),
|
||||||
ok;
|
ok;
|
||||||
end_per_group(_Group, _Config) ->
|
end_per_group(_Group, _Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
common_init_per_group() ->
|
common_init_per_group(Config) ->
|
||||||
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
||||||
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
%% Ensure enterprise bridge module is loaded
|
%% Ensure enterprise bridge module is loaded
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_conf, emqx_bridge]),
|
Apps = emqx_cth_suite:start(
|
||||||
_ = emqx_bridge_enterprise:module_info(),
|
[
|
||||||
ok = emqx_connector_test_helpers:start_apps(?APPS),
|
emqx_conf,
|
||||||
{ok, _} = application:ensure_all_started(emqx_connector),
|
emqx_oracle,
|
||||||
emqx_mgmt_api_test_util:init_suite(),
|
emqx_bridge_oracle,
|
||||||
|
emqx_bridge,
|
||||||
|
emqx_rule_engine,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
|
),
|
||||||
UniqueNum = integer_to_binary(erlang:unique_integer()),
|
UniqueNum = integer_to_binary(erlang:unique_integer()),
|
||||||
MQTTTopic = <<"mqtt/topic/", UniqueNum/binary>>,
|
MQTTTopic = <<"mqtt/topic/", UniqueNum/binary>>,
|
||||||
[
|
[
|
||||||
|
{apps, Apps},
|
||||||
{proxy_host, ProxyHost},
|
{proxy_host, ProxyHost},
|
||||||
{proxy_port, ProxyPort},
|
{proxy_port, ProxyPort},
|
||||||
{mqtt_topic, MQTTTopic}
|
{mqtt_topic, MQTTTopic}
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgePgsql.MixProject do
|
defmodule EMQXBridgePgsql.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_pgsql,
|
app: :emqx_bridge_pgsql,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgePgsql.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
||||||
-include("emqx_resource_errors.hrl").
|
-include("../../emqx_resource/include/emqx_resource_errors.hrl").
|
||||||
|
|
||||||
% SQL definitions
|
% SQL definitions
|
||||||
-define(SQL_BRIDGE,
|
-define(SQL_BRIDGE,
|
||||||
|
|
|
@ -61,14 +61,12 @@ init_per_suite(Config) ->
|
||||||
emqx_bridge_pgsql,
|
emqx_bridge_pgsql,
|
||||||
emqx_rule_engine,
|
emqx_rule_engine,
|
||||||
emqx_management,
|
emqx_management,
|
||||||
{emqx_dashboard, "dashboard.listeners.http { enable = true, bind = 18083 }"}
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
],
|
],
|
||||||
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
),
|
),
|
||||||
{ok, Api} = emqx_common_test_http:create_default_app(),
|
|
||||||
NConfig = [
|
NConfig = [
|
||||||
{apps, Apps},
|
{apps, Apps},
|
||||||
{api, Api},
|
|
||||||
{pgsql_host, PostgresHost},
|
{pgsql_host, PostgresHost},
|
||||||
{pgsql_port, PostgresPort},
|
{pgsql_port, PostgresPort},
|
||||||
{enable_tls, false},
|
{enable_tls, false},
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgePulsar.MixProject do
|
defmodule EMQXBridgePulsar.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_pulsar,
|
app: :emqx_bridge_pulsar,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,14 +18,14 @@ defmodule EMQXBridgePulsar.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
## TODO: remove `mix.exs` from `pulsar` and remove this override
|
|
||||||
{:crc32cer, git: "https://github.com/zmstone/crc32cer", tag: "0.1.8", override: true},
|
{:crc32cer, git: "https://github.com/zmstone/crc32cer", tag: "0.1.8", override: true},
|
||||||
## TODO: remove `mix.exs` from `pulsar` and remove this override
|
## TODO: remove `mix.exs` from `pulsar` and remove this override
|
||||||
|
## TODO: remove `mix.exs` from `pulsar` and remove this override
|
||||||
{:snappyer, "1.2.9", override: true},
|
{:snappyer, "1.2.9", override: true},
|
||||||
{:pulsar, github: "emqx/pulsar-client-erl", tag: "0.8.3"},
|
{:pulsar, github: "emqx/pulsar-client-erl", tag: "0.8.3"},
|
||||||
{:emqx_connector, in_umbrella: true, runtime: false},
|
{:emqx_connector, in_umbrella: true, runtime: false},
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeRabbitmq.MixProject do
|
defmodule EMQXBridgeRabbitmq.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_rabbitmq,
|
app: :emqx_bridge_rabbitmq,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,18 +18,19 @@ defmodule EMQXBridgeRabbitmq.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: [], mod: {:emqx_bridge_rabbitmq_app, []}]
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_bridge_rabbitmq_app, []}]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:thoas, github: "emqx/thoas", tag: "v1.0.0", override: true},
|
{:thoas, github: "emqx/thoas", tag: "v1.0.0", override: true},
|
||||||
{:credentials_obfuscation, github: "emqx/credentials-obfuscation", tag: "v3.2.0", override: true},
|
{:credentials_obfuscation,
|
||||||
|
github: "emqx/credentials-obfuscation", tag: "v3.2.0", override: true},
|
||||||
{:rabbit_common,
|
{:rabbit_common,
|
||||||
github: "emqx/rabbitmq-server", tag: "v3.11.13.2",
|
github: "emqx/rabbitmq-server",
|
||||||
|
tag: "v3.11.13.2",
|
||||||
sparse: "deps/rabbit_common",
|
sparse: "deps/rabbit_common",
|
||||||
override: true
|
override: true},
|
||||||
},
|
|
||||||
{:amqp_client,
|
{:amqp_client,
|
||||||
github: "emqx/rabbitmq-server", tag: "v3.11.13.2", sparse: "deps/amqp_client"},
|
github: "emqx/rabbitmq-server", tag: "v3.11.13.2", sparse: "deps/amqp_client"},
|
||||||
{:emqx_connector, in_umbrella: true, runtime: false},
|
{:emqx_connector, in_umbrella: true, runtime: false},
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include("emqx_connector.hrl").
|
-include("../../emqx_connector/include/emqx_connector.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("stdlib/include/assert.hrl").
|
-include_lib("stdlib/include/assert.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
|
|
|
@ -9,16 +9,21 @@
|
||||||
|
|
||||||
-include_lib("emqx_connector/include/emqx_connector.hrl").
|
-include_lib("emqx_connector/include/emqx_connector.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
-include_lib("common_test/include/ct.hrl").
|
||||||
-include_lib("stdlib/include/assert.hrl").
|
-include_lib("stdlib/include/assert.hrl").
|
||||||
-include_lib("amqp_client/include/amqp_client.hrl").
|
-include_lib("amqp_client/include/amqp_client.hrl").
|
||||||
|
|
||||||
init_per_group(tcp, Config) ->
|
init_per_group(tcp = Group, Config) ->
|
||||||
RabbitMQHost = os:getenv("RABBITMQ_PLAIN_HOST", "rabbitmq"),
|
RabbitMQHost = os:getenv("RABBITMQ_PLAIN_HOST", "rabbitmq"),
|
||||||
RabbitMQPort = list_to_integer(os:getenv("RABBITMQ_PLAIN_PORT", "5672")),
|
RabbitMQPort = list_to_integer(os:getenv("RABBITMQ_PLAIN_PORT", "5672")),
|
||||||
case emqx_common_test_helpers:is_tcp_server_available(RabbitMQHost, RabbitMQPort) of
|
case emqx_common_test_helpers:is_tcp_server_available(RabbitMQHost, RabbitMQPort) of
|
||||||
true ->
|
true ->
|
||||||
Config1 = common_init_per_group(#{
|
Config1 = common_init_per_group(#{
|
||||||
host => RabbitMQHost, port => RabbitMQPort, tls => false
|
group => Group,
|
||||||
|
tc_config => Config,
|
||||||
|
host => RabbitMQHost,
|
||||||
|
port => RabbitMQPort,
|
||||||
|
tls => false
|
||||||
}),
|
}),
|
||||||
Config1 ++ Config;
|
Config1 ++ Config;
|
||||||
false ->
|
false ->
|
||||||
|
@ -29,13 +34,17 @@ init_per_group(tcp, Config) ->
|
||||||
{skip, no_rabbitmq}
|
{skip, no_rabbitmq}
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
init_per_group(tls, Config) ->
|
init_per_group(tls = Group, Config) ->
|
||||||
RabbitMQHost = os:getenv("RABBITMQ_TLS_HOST", "rabbitmq"),
|
RabbitMQHost = os:getenv("RABBITMQ_TLS_HOST", "rabbitmq"),
|
||||||
RabbitMQPort = list_to_integer(os:getenv("RABBITMQ_TLS_PORT", "5671")),
|
RabbitMQPort = list_to_integer(os:getenv("RABBITMQ_TLS_PORT", "5671")),
|
||||||
case emqx_common_test_helpers:is_tcp_server_available(RabbitMQHost, RabbitMQPort) of
|
case emqx_common_test_helpers:is_tcp_server_available(RabbitMQHost, RabbitMQPort) of
|
||||||
true ->
|
true ->
|
||||||
Config1 = common_init_per_group(#{
|
Config1 = common_init_per_group(#{
|
||||||
host => RabbitMQHost, port => RabbitMQPort, tls => true
|
group => Group,
|
||||||
|
tc_config => Config,
|
||||||
|
host => RabbitMQHost,
|
||||||
|
port => RabbitMQPort,
|
||||||
|
tls => true
|
||||||
}),
|
}),
|
||||||
Config1 ++ Config;
|
Config1 ++ Config;
|
||||||
false ->
|
false ->
|
||||||
|
@ -50,17 +59,24 @@ init_per_group(_Group, Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
common_init_per_group(Opts) ->
|
common_init_per_group(Opts) ->
|
||||||
emqx_common_test_helpers:render_and_load_app_config(emqx_conf),
|
#{group := Group, tc_config := Config} = Opts,
|
||||||
ok = emqx_common_test_helpers:start_apps([
|
Apps = emqx_cth_suite:start(
|
||||||
emqx_conf, emqx_bridge, emqx_bridge_rabbitmq, emqx_rule_engine, emqx_modules
|
[
|
||||||
]),
|
emqx,
|
||||||
ok = emqx_connector_test_helpers:start_apps([emqx_resource]),
|
emqx_conf,
|
||||||
{ok, _} = application:ensure_all_started(emqx_connector),
|
emqx_connector,
|
||||||
{ok, _} = application:ensure_all_started(amqp_client),
|
emqx_bridge_rabbitmq,
|
||||||
emqx_mgmt_api_test_util:init_suite(),
|
emqx_bridge,
|
||||||
|
emqx_rule_engine,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Group, Config)}
|
||||||
|
),
|
||||||
#{host := Host, port := Port, tls := UseTLS} = Opts,
|
#{host := Host, port := Port, tls := UseTLS} = Opts,
|
||||||
ChannelConnection = setup_rabbit_mq_exchange_and_queue(Host, Port, UseTLS),
|
ChannelConnection = setup_rabbit_mq_exchange_and_queue(Host, Port, UseTLS),
|
||||||
[
|
[
|
||||||
|
{apps, Apps},
|
||||||
{channel_connection, ChannelConnection},
|
{channel_connection, ChannelConnection},
|
||||||
{rabbitmq, #{server => Host, port => Port, tls => UseTLS}}
|
{rabbitmq, #{server => Host, port => Port, tls => UseTLS}}
|
||||||
].
|
].
|
||||||
|
@ -115,13 +131,8 @@ end_per_group(_Group, Config) ->
|
||||||
channel := Channel
|
channel := Channel
|
||||||
} = get_channel_connection(Config),
|
} = get_channel_connection(Config),
|
||||||
amqp_channel:call(Channel, #'queue.purge'{queue = rabbit_mq_queue()}),
|
amqp_channel:call(Channel, #'queue.purge'{queue = rabbit_mq_queue()}),
|
||||||
emqx_mgmt_api_test_util:end_suite(),
|
Apps = ?config(apps, Config),
|
||||||
ok = emqx_common_test_helpers:stop_apps([
|
emqx_cth_suite:stop(Apps),
|
||||||
emqx_conf, emqx_bridge_rabbitmq, emqx_rule_engine, emqx_modules
|
|
||||||
]),
|
|
||||||
ok = emqx_connector_test_helpers:stop_apps([emqx_resource]),
|
|
||||||
_ = application:stop(emqx_connector),
|
|
||||||
_ = application:stop(emqx_bridge),
|
|
||||||
%% Close the channel
|
%% Close the channel
|
||||||
ok = amqp_channel:close(Channel),
|
ok = amqp_channel:close(Channel),
|
||||||
%% Close the connection
|
%% Close the connection
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeRedis.MixProject do
|
defmodule EMQXBridgeRedis.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_redis,
|
app: :emqx_bridge_redis,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeRedis.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeRocketmq.MixProject do
|
defmodule EMQXBridgeRocketmq.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_rocketmq,
|
app: :emqx_bridge_rocketmq,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeRocketmq.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -73,8 +73,6 @@ init_per_suite(Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(_Config) ->
|
||||||
emqx_mgmt_api_test_util:end_suite(),
|
|
||||||
ok = emqx_common_test_helpers:stop_apps([emqx_bridge, emqx_conf]),
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_testcase(_Testcase, Config) ->
|
init_per_testcase(_Testcase, Config) ->
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeS3.MixProject do
|
defmodule EMQXBridgeS3.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_s3,
|
app: :emqx_bridge_s3,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,14 +18,14 @@ defmodule EMQXBridgeS3.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: [], mod: {:emqx_bridge_s3_app, []}]
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_bridge_s3_app, []}]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:emqx_resource, in_umbrella: true},
|
{:emqx_resource, in_umbrella: true},
|
||||||
{:emqx_connector_aggregator, in_umbrella: true},
|
{:emqx_connector_aggregator, in_umbrella: true},
|
||||||
{:emqx_s3, in_umbrella: true},
|
{:emqx_s3, in_umbrella: true}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeSqlserver.MixProject do
|
defmodule EMQXBridgeSqlserver.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_sqlserver,
|
app: :emqx_bridge_sqlserver,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeSqlserver.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: [:odbc] ++ UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include("emqx_bridge_sqlserver/include/emqx_bridge_sqlserver.hrl").
|
-include("../include/emqx_bridge_sqlserver.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
||||||
|
@ -122,9 +122,11 @@ init_per_group(_Group, Config) ->
|
||||||
end_per_group(Group, Config) when Group =:= with_batch; Group =:= without_batch ->
|
end_per_group(Group, Config) when Group =:= with_batch; Group =:= without_batch ->
|
||||||
connect_and_drop_table(Config),
|
connect_and_drop_table(Config),
|
||||||
connect_and_drop_db(Config),
|
connect_and_drop_db(Config),
|
||||||
|
Apps = ?config(apps, Config),
|
||||||
ProxyHost = ?config(proxy_host, Config),
|
ProxyHost = ?config(proxy_host, Config),
|
||||||
ProxyPort = ?config(proxy_port, Config),
|
ProxyPort = ?config(proxy_port, Config),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
|
emqx_cth_suite:stop(Apps),
|
||||||
ok;
|
ok;
|
||||||
end_per_group(_Group, _Config) ->
|
end_per_group(_Group, _Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
@ -135,8 +137,6 @@ init_per_suite(Config) ->
|
||||||
[{sqlserver_passfile, Passfile} | Config].
|
[{sqlserver_passfile, Passfile} | Config].
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(_Config) ->
|
||||||
emqx_mgmt_api_test_util:end_suite(),
|
|
||||||
ok = emqx_common_test_helpers:stop_apps([emqx_bridge, emqx_conf]),
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_testcase(_Testcase, Config) ->
|
init_per_testcase(_Testcase, Config) ->
|
||||||
|
@ -422,16 +422,23 @@ common_init(ConfigT) ->
|
||||||
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
ProxyHost = os:getenv("PROXY_HOST", "toxiproxy"),
|
||||||
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
ProxyPort = list_to_integer(os:getenv("PROXY_PORT", "8474")),
|
||||||
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
emqx_common_test_helpers:reset_proxy(ProxyHost, ProxyPort),
|
||||||
% Ensure enterprise bridge module is loaded
|
Apps = emqx_cth_suite:start(
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_conf, emqx_bridge, odbc]),
|
[
|
||||||
_ = emqx_bridge_enterprise:module_info(),
|
emqx_conf,
|
||||||
emqx_mgmt_api_test_util:init_suite(),
|
emqx_bridge_sqlserver,
|
||||||
|
emqx_bridge,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
],
|
||||||
|
#{work_dir => emqx_cth_suite:work_dir(Config0)}
|
||||||
|
),
|
||||||
% Connect to sqlserver directly
|
% Connect to sqlserver directly
|
||||||
% drop old db and table, and then create new ones
|
% drop old db and table, and then create new ones
|
||||||
connect_and_create_db_and_table(Config0),
|
connect_and_create_db_and_table(Config0),
|
||||||
{Name, SQLServerConf} = sqlserver_config(BridgeType, Config0),
|
{Name, SQLServerConf} = sqlserver_config(BridgeType, Config0),
|
||||||
Config =
|
Config =
|
||||||
[
|
[
|
||||||
|
{apps, Apps},
|
||||||
{sqlserver_config, SQLServerConf},
|
{sqlserver_config, SQLServerConf},
|
||||||
{sqlserver_bridge_type, BridgeType},
|
{sqlserver_bridge_type, BridgeType},
|
||||||
{sqlserver_name, Name},
|
{sqlserver_name, Name},
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeSyskeeper.MixProject do
|
defmodule EMQXBridgeSyskeeper.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_syskeeper,
|
app: :emqx_bridge_syskeeper,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeSyskeeper.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeTdengine.MixProject do
|
defmodule EMQXBridgeTdengine.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_tdengine,
|
app: :emqx_bridge_tdengine,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeTdengine.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -55,9 +55,6 @@
|
||||||
).
|
).
|
||||||
|
|
||||||
-define(BRIDGE_TYPE_BIN, <<"tdengine">>).
|
-define(BRIDGE_TYPE_BIN, <<"tdengine">>).
|
||||||
-define(APPS, [
|
|
||||||
hackney, tdengine, emqx_bridge, emqx_resource, emqx_rule_engine, emqx_bridge_tdengine
|
|
||||||
]).
|
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% CT boilerplate
|
%% CT boilerplate
|
||||||
|
@ -81,7 +78,19 @@ groups() ->
|
||||||
].
|
].
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
emqx_bridge_v2_testlib:init_per_suite(Config, ?APPS).
|
emqx_bridge_v2_testlib:init_per_suite(
|
||||||
|
Config,
|
||||||
|
[
|
||||||
|
emqx,
|
||||||
|
emqx_conf,
|
||||||
|
emqx_bridge_tdengine,
|
||||||
|
emqx_connector,
|
||||||
|
emqx_bridge,
|
||||||
|
emqx_rule_engine,
|
||||||
|
emqx_management,
|
||||||
|
emqx_mgmt_api_test_util:emqx_dashboard()
|
||||||
|
]
|
||||||
|
).
|
||||||
|
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
emqx_bridge_v2_testlib:end_per_suite(Config).
|
emqx_bridge_v2_testlib:end_per_suite(Config).
|
||||||
|
@ -99,7 +108,10 @@ init_per_group(without_batch, Config0) ->
|
||||||
init_per_group(_Group, Config) ->
|
init_per_group(_Group, Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_group(default, Config) ->
|
end_per_group(Group, Config) when
|
||||||
|
Group =:= with_batch;
|
||||||
|
Group =:= without_batch
|
||||||
|
->
|
||||||
emqx_bridge_v2_testlib:end_per_group(Config),
|
emqx_bridge_v2_testlib:end_per_group(Config),
|
||||||
ok;
|
ok;
|
||||||
end_per_group(_Group, _Config) ->
|
end_per_group(_Group, _Config) ->
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXBridgeTimescale.MixProject do
|
defmodule EMQXBridgeTimescale.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_bridge_timescale,
|
app: :emqx_bridge_timescale,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,7 +18,7 @@ defmodule EMQXBridgeTimescale.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: []]
|
[extra_applications: UMP.extra_applications()]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
defmodule EMQXClusterLink.MixProject do
|
defmodule EMQXClusterLink.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :emqx_cluster_link,
|
app: :emqx_cluster_link,
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -16,10 +18,15 @@ defmodule EMQXClusterLink.MixProject do
|
||||||
end
|
end
|
||||||
|
|
||||||
def application do
|
def application do
|
||||||
[extra_applications: [], mod: {:emqx_cluster_link_app, []}]
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_cluster_link_app, []}]
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[{:emqx, in_umbrella: true}, {:emqx_resource, in_umbrella: true}]
|
[
|
||||||
|
{:emqx, in_umbrella: true},
|
||||||
|
{:emqx_resource, in_umbrella: true},
|
||||||
|
{:emqtt,
|
||||||
|
github: "emqx/emqtt", tag: "1.10.1", override: true, system_env: UMP.maybe_no_quic_env()}
|
||||||
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
defmodule EMQXConf.MixProject do
|
defmodule EMQXConf.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
alias EMQXUmbrella.MixProject, as: UMP
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
|
@ -7,7 +8,8 @@ defmodule EMQXConf.MixProject do
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
build_path: "../../_build",
|
build_path: "../../_build",
|
||||||
# config_path: "../../config/config.exs",
|
# config_path: "../../config/config.exs",
|
||||||
erlc_options: EMQXUmbrella.MixProject.erlc_options(),
|
erlc_options: UMP.erlc_options(),
|
||||||
|
erlc_paths: UMP.erlc_paths(),
|
||||||
deps_path: "../../deps",
|
deps_path: "../../deps",
|
||||||
lockfile: "../../mix.lock",
|
lockfile: "../../mix.lock",
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
|
@ -18,16 +20,13 @@ defmodule EMQXConf.MixProject do
|
||||||
|
|
||||||
# Run "mix help compile.app" to learn about applications
|
# Run "mix help compile.app" to learn about applications
|
||||||
def application do
|
def application do
|
||||||
[
|
[extra_applications: UMP.extra_applications(), mod: {:emqx_conf_app, []}]
|
||||||
extra_applications: [],
|
|
||||||
mod: {:emqx_conf_app, []}
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps() do
|
def deps() do
|
||||||
[
|
[
|
||||||
{:emqx, in_umbrella: true, runtime: false},
|
{:emqx, in_umbrella: true, runtime: false},
|
||||||
{:emqx_auth, in_umbrella: true, runtime: false},
|
{:emqx_auth, in_umbrella: true, runtime: false}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1428,8 +1428,6 @@ to_atom(Bin) when is_binary(Bin) ->
|
||||||
binary_to_atom(Bin, utf8).
|
binary_to_atom(Bin, utf8).
|
||||||
|
|
||||||
roots(Module) ->
|
roots(Module) ->
|
||||||
%% io:format(user, "\n\n>>>>>>>>>>>>>>>\n ~p\n\n", [#{e => emqx_release:edition(), m => Module}]),
|
|
||||||
%% error({Module, emqx_release:edition()}),
|
|
||||||
lists:map(fun({_BinName, Root}) -> Root end, hocon_schema:roots(Module)).
|
lists:map(fun({_BinName, Root}) -> Root end, hocon_schema:roots(Module)).
|
||||||
|
|
||||||
%% Like authentication schema, authorization schema is incomplete in emqx_schema
|
%% Like authentication schema, authorization schema is incomplete in emqx_schema
|
||||||
|
|
|
@ -57,7 +57,6 @@ t_copy_conf_override_on_restarts(Config) ->
|
||||||
|
|
||||||
t_copy_new_data_dir(Config) ->
|
t_copy_new_data_dir(Config) ->
|
||||||
ct:timetrap({seconds, 120}),
|
ct:timetrap({seconds, 120}),
|
||||||
snabbkaffe:fix_ct_logging(),
|
|
||||||
Cluster = cluster(
|
Cluster = cluster(
|
||||||
?FUNCTION_NAME,
|
?FUNCTION_NAME,
|
||||||
[cluster_spec({core, 4}), cluster_spec({core, 5}), cluster_spec({core, 6})],
|
[cluster_spec({core, 4}), cluster_spec({core, 5}), cluster_spec({core, 6})],
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
|
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
-include_lib("common_test/include/ct.hrl").
|
||||||
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
||||||
-include("emqx_conf.hrl").
|
-include("emqx_conf.hrl").
|
||||||
-import(emqx_config_SUITE, [prepare_conf_file/3]).
|
-import(emqx_config_SUITE, [prepare_conf_file/3]).
|
||||||
|
@ -27,15 +28,34 @@ all() ->
|
||||||
emqx_common_test_helpers:all(?MODULE).
|
emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
emqx_mgmt_api_test_util:init_suite([emqx_conf, emqx_auth, emqx_auth_redis]),
|
Apps = emqx_cth_suite:start(
|
||||||
Config.
|
[
|
||||||
|
emqx_conf,
|
||||||
|
emqx_auth_redis,
|
||||||
|
emqx_auth,
|
||||||
|
emqx_management
|
||||||
|
],
|
||||||
|
#{
|
||||||
|
%% N.B.: This is needed to avoid `emqx_cth_suite' default behavior of setting
|
||||||
|
%% `authorization.sources = []'.
|
||||||
|
emqx_conf_shared_apps => [emqx],
|
||||||
|
work_dir => emqx_cth_suite:work_dir(Config)
|
||||||
|
}
|
||||||
|
),
|
||||||
|
[{apps, Apps} | Config].
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(Config) ->
|
||||||
emqx_mgmt_api_test_util:end_suite([emqx_conf, emqx_auth, emqx_auth_redis]).
|
Apps = ?config(apps, Config),
|
||||||
|
emqx_cth_suite:stop(Apps),
|
||||||
|
ok.
|
||||||
|
|
||||||
t_load_config(Config) ->
|
t_load_config(Config) ->
|
||||||
Authz = authorization,
|
Authz = authorization,
|
||||||
Conf = emqx_conf:get_raw([Authz]),
|
Conf = emqx_conf:get_raw([Authz]),
|
||||||
|
?assertEqual(
|
||||||
|
[emqx_authz_schema:default_authz()],
|
||||||
|
maps:get(<<"sources">>, Conf)
|
||||||
|
),
|
||||||
%% set sources to []
|
%% set sources to []
|
||||||
ConfBin = hocon_pp:do(#{<<"authorization">> => #{<<"sources">> => []}}, #{}),
|
ConfBin = hocon_pp:do(#{<<"authorization">> => #{<<"sources">> => []}}, #{}),
|
||||||
ConfFile = prepare_conf_file(?FUNCTION_NAME, ConfBin, Config),
|
ConfFile = prepare_conf_file(?FUNCTION_NAME, ConfBin, Config),
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue