test: wait for redis
This commit is contained in:
parent
5f12cdff6c
commit
7a4e7a6de9
|
@ -36,22 +36,16 @@ groups() ->
|
||||||
[].
|
[].
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
case
|
Checks =
|
||||||
emqx_common_test_helpers:is_all_tcp_servers_available(
|
case os:getenv("IS_CI") of
|
||||||
[
|
"yes" -> 10;
|
||||||
{?REDIS_SINGLE_HOST, ?REDIS_SINGLE_PORT},
|
_ -> 1
|
||||||
{?REDIS_SENTINEL_HOST, ?REDIS_SENTINEL_PORT}
|
end,
|
||||||
]
|
ok = wait_for_redis(Checks),
|
||||||
)
|
ok = emqx_common_test_helpers:start_apps([emqx_conf]),
|
||||||
of
|
ok = emqx_connector_test_helpers:start_apps([emqx_resource]),
|
||||||
true ->
|
{ok, _} = application:ensure_all_started(emqx_connector),
|
||||||
ok = emqx_common_test_helpers:start_apps([emqx_conf]),
|
Config.
|
||||||
ok = emqx_connector_test_helpers:start_apps([emqx_resource]),
|
|
||||||
{ok, _} = application:ensure_all_started(emqx_connector),
|
|
||||||
Config;
|
|
||||||
false ->
|
|
||||||
assert_ci()
|
|
||||||
end.
|
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(_Config) ->
|
||||||
ok = emqx_common_test_helpers:stop_apps([emqx_resource]),
|
ok = emqx_common_test_helpers:stop_apps([emqx_resource]),
|
||||||
|
@ -63,13 +57,24 @@ init_per_testcase(_, Config) ->
|
||||||
end_per_testcase(_, _Config) ->
|
end_per_testcase(_, _Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
assert_ci() ->
|
wait_for_redis(0) ->
|
||||||
case os:getenv("IS_CI") of
|
throw(timeout);
|
||||||
"yes" ->
|
wait_for_redis(Checks) ->
|
||||||
throw(no_redis);
|
case
|
||||||
_ ->
|
emqx_common_test_helpers:is_all_tcp_servers_available(
|
||||||
{skip, no_redis}
|
[
|
||||||
|
{?REDIS_SINGLE_HOST, ?REDIS_SINGLE_PORT},
|
||||||
|
{?REDIS_SENTINEL_HOST, ?REDIS_SENTINEL_PORT}
|
||||||
|
]
|
||||||
|
)
|
||||||
|
of
|
||||||
|
true ->
|
||||||
|
ok;
|
||||||
|
false ->
|
||||||
|
timer:sleep(1000),
|
||||||
|
wait_for_redis(Checks - 1)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
% %%------------------------------------------------------------------------------
|
% %%------------------------------------------------------------------------------
|
||||||
% %% Testcases
|
% %% Testcases
|
||||||
% %%------------------------------------------------------------------------------
|
% %%------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue