test(connector): avoid define macro duplicate

This commit is contained in:
JimMoen 2022-02-15 00:56:07 +08:00
parent 0e5105db6e
commit 23c6a404b9
3 changed files with 10 additions and 10 deletions

View File

@ -18,12 +18,12 @@
-compile(nowarn_export_all). -compile(nowarn_export_all).
-compile(export_all). -compile(export_all).
-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").
-define(MONGO_HOST, "mongo"). -define(MONGO_HOST, "mongo").
-define(MONGO_PORT, 27017).
-define(MONGO_CLIENT, 'emqx_connector_mongo_SUITE_client'). -define(MONGO_CLIENT, 'emqx_connector_mongo_SUITE_client').
all() -> all() ->
@ -33,7 +33,7 @@ groups() ->
[]. [].
init_per_suite(Config) -> init_per_suite(Config) ->
case emqx_common_test_helpers:is_tcp_server_available(?MONGO_HOST, ?MONGO_PORT) of case emqx_common_test_helpers:is_tcp_server_available(?MONGO_HOST, ?MONGO_DEFAULT_PORT) of
true -> true ->
ok = emqx_connector_test_helpers:start_apps([ecpool, mongodb]), ok = emqx_connector_test_helpers:start_apps([ecpool, mongodb]),
Config; Config;
@ -129,5 +129,5 @@ mongo_config() ->
pool_size => 8, pool_size => 8,
ssl => #{enable => false}, ssl => #{enable => false},
srv_record => false, srv_record => false,
servers => <<"127.0.0.1:27017">> server => {<<?MONGO_HOST>>, ?MONGO_DEFAULT_PORT}
}. }.

View File

@ -18,12 +18,12 @@
-compile(nowarn_export_all). -compile(nowarn_export_all).
-compile(export_all). -compile(export_all).
-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").
-define(MYSQL_HOST, "mysql"). -define(MYSQL_HOST, "mysql").
-define(MYSQL_PORT, 3306).
all() -> all() ->
emqx_common_test_helpers:all(?MODULE). emqx_common_test_helpers:all(?MODULE).
@ -32,7 +32,7 @@ groups() ->
[]. [].
init_per_suite(Config) -> init_per_suite(Config) ->
case emqx_common_test_helpers:is_tcp_server_available(?MYSQL_HOST, ?MYSQL_PORT) of case emqx_common_test_helpers:is_tcp_server_available(?MYSQL_HOST, ?MYSQL_DEFAULT_PORT) of
true -> true ->
Config; Config;
false -> false ->
@ -124,7 +124,7 @@ mysql_config() ->
username => <<"root">>, username => <<"root">>,
password => <<"public">>, password => <<"public">>,
pool_size => 8, pool_size => 8,
server => {?MYSQL_HOST, ?MYSQL_PORT}, server => {?MYSQL_HOST, ?MYSQL_DEFAULT_PORT},
ssl => #{enable => false} ssl => #{enable => false}
}. }.

View File

@ -18,12 +18,12 @@
-compile(nowarn_export_all). -compile(nowarn_export_all).
-compile(export_all). -compile(export_all).
-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").
-define(PGSQL_HOST, "pgsql"). -define(PGSQL_HOST, "pgsql").
-define(PGSQL_PORT, 5432).
all() -> all() ->
emqx_common_test_helpers:all(?MODULE). emqx_common_test_helpers:all(?MODULE).
@ -32,7 +32,7 @@ groups() ->
[]. [].
init_per_suite(Config) -> init_per_suite(Config) ->
case emqx_common_test_helpers:is_tcp_server_available(?PGSQL_HOST, ?PGSQL_PORT) of case emqx_common_test_helpers:is_tcp_server_available(?PGSQL_HOST, ?PGSQL_DEFAULT_PORT) of
true -> true ->
Config; Config;
false -> false ->
@ -124,7 +124,7 @@ pgsql_config() ->
username => <<"root">>, username => <<"root">>,
password => <<"public">>, password => <<"public">>,
pool_size => 8, pool_size => 8,
server => {?PGSQL_HOST, ?PGSQL_PORT}, server => {?PGSQL_HOST, ?PGSQL_DEFAULT_PORT},
ssl => #{enable => false} ssl => #{enable => false}
}. }.
@ -135,7 +135,7 @@ pgsql_bad_config() ->
username => <<"bad_root">>, username => <<"bad_root">>,
password => <<"bad_public">>, password => <<"bad_public">>,
pool_size => 8, pool_size => 8,
server => {?PGSQL_HOST, ?PGSQL_PORT}, server => {?PGSQL_HOST, ?PGSQL_DEFAULT_PORT},
ssl => #{enable => false} ssl => #{enable => false}
}. }.