diff --git a/apps/emqx_connector/README.md b/apps/emqx_connector/README.md index 265712285..7ef3a8c4a 100644 --- a/apps/emqx_connector/README.md +++ b/apps/emqx_connector/README.md @@ -21,7 +21,7 @@ An MySQL connector can be used as following: ssl => false,user => "root",verify => false}, id => <<"mysql-abc">>,mod => emqx_connector_mysql, state => #{poolname => 'mysql-abc'}, - status => started}] + status => connected}] (emqx@127.0.0.1)6> emqx_resource:query(<<"mysql-abc">>, {sql, <<"SELECT count(1)">>}). {ok,[<<"count(1)">>],[[1]]} ``` diff --git a/apps/emqx_connector/test/emqx_connector_api_SUITE.erl b/apps/emqx_connector/test/emqx_connector_api_SUITE.erl index 5684611be..7c83671a9 100644 --- a/apps/emqx_connector/test/emqx_connector_api_SUITE.erl +++ b/apps/emqx_connector/test/emqx_connector_api_SUITE.erl @@ -695,7 +695,7 @@ wait_for_resource_ready(InstId, 0) -> ct:fail(wait_resource_timeout); wait_for_resource_ready(InstId, Retry) -> case emqx_bridge:lookup(InstId) of - {ok, #{resource_data := #{status := started}}} -> ok; + {ok, #{resource_data := #{status := connected}}} -> ok; _ -> timer:sleep(100), wait_for_resource_ready(InstId, Retry-1) diff --git a/apps/emqx_connector/test/emqx_connector_mysql_SUITE.erl b/apps/emqx_connector/test/emqx_connector_mysql_SUITE.erl index d4e10e487..b38cee3eb 100644 --- a/apps/emqx_connector/test/emqx_connector_mysql_SUITE.erl +++ b/apps/emqx_connector/test/emqx_connector_mysql_SUITE.erl @@ -70,7 +70,7 @@ perform_lifecycle_check(PoolName, InitialConfig) -> ?MYSQL_RESOURCE_MOD, CheckedConfig ), - ?assertEqual(InitialStatus, started), + ?assertEqual(InitialStatus, connected), % Instance should match the state and status of the just started resource {ok, ?CONNECTOR_RESOURCE_GROUP, #{state := State, status := InitialStatus}} = emqx_resource:get_instance(PoolName), ?assertEqual(ok, emqx_resource:health_check(PoolName)), @@ -82,7 +82,7 @@ perform_lifecycle_check(PoolName, InitialConfig) -> % Resource will be listed still, but state will be changed and healthcheck will fail % as the worker no longer exists. {ok, ?CONNECTOR_RESOURCE_GROUP, #{state := State, status := StoppedStatus}} = emqx_resource:get_instance(PoolName), - ?assertEqual(StoppedStatus, stopped), + ?assertEqual(StoppedStatus, disconnected), ?assertEqual({error,health_check_failed}, emqx_resource:health_check(PoolName)), % Resource healthcheck shortcuts things by checking ets. Go deeper by checking pool itself. ?assertEqual({error, not_found}, ecpool:stop_sup_pool(ReturnedPoolName)), diff --git a/apps/emqx_connector/test/emqx_connector_pgsql_SUITE.erl b/apps/emqx_connector/test/emqx_connector_pgsql_SUITE.erl index 920150dd2..331283c59 100644 --- a/apps/emqx_connector/test/emqx_connector_pgsql_SUITE.erl +++ b/apps/emqx_connector/test/emqx_connector_pgsql_SUITE.erl @@ -70,7 +70,7 @@ perform_lifecycle_check(PoolName, InitialConfig) -> ?PGSQL_RESOURCE_MOD, CheckedConfig ), - ?assertEqual(InitialStatus, started), + ?assertEqual(InitialStatus, connected), % Instance should match the state and status of the just started resource {ok, ?CONNECTOR_RESOURCE_GROUP, #{state := State, status := InitialStatus}} = emqx_resource:get_instance(PoolName), ?assertEqual(ok, emqx_resource:health_check(PoolName)), @@ -81,7 +81,7 @@ perform_lifecycle_check(PoolName, InitialConfig) -> % Resource will be listed still, but state will be changed and healthcheck will fail % as the worker no longer exists. {ok, ?CONNECTOR_RESOURCE_GROUP, #{state := State, status := StoppedStatus}} = emqx_resource:get_instance(PoolName), - ?assertEqual(StoppedStatus, stopped), + ?assertEqual(StoppedStatus, disconnected), ?assertEqual({error,health_check_failed}, emqx_resource:health_check(PoolName)), % Resource healthcheck shortcuts things by checking ets. Go deeper by checking pool itself. ?assertEqual({error, not_found}, ecpool:stop_sup_pool(ReturnedPoolName)), diff --git a/apps/emqx_connector/test/emqx_connector_redis_SUITE.erl b/apps/emqx_connector/test/emqx_connector_redis_SUITE.erl index 6c0234bec..45fc17d9a 100644 --- a/apps/emqx_connector/test/emqx_connector_redis_SUITE.erl +++ b/apps/emqx_connector/test/emqx_connector_redis_SUITE.erl @@ -85,7 +85,7 @@ perform_lifecycle_check(PoolName, InitialConfig, RedisCommand) -> ?REDIS_RESOURCE_MOD, CheckedConfig ), - ?assertEqual(InitialStatus, started), + ?assertEqual(InitialStatus, connected), % Instance should match the state and status of the just started resource {ok, ?CONNECTOR_RESOURCE_GROUP, #{state := State, status := InitialStatus}} = emqx_resource:get_instance(PoolName), ?assertEqual(ok, emqx_resource:health_check(PoolName)), @@ -95,7 +95,7 @@ perform_lifecycle_check(PoolName, InitialConfig, RedisCommand) -> % Resource will be listed still, but state will be changed and healthcheck will fail % as the worker no longer exists. {ok, ?CONNECTOR_RESOURCE_GROUP, #{state := State, status := StoppedStatus}} = emqx_resource:get_instance(PoolName), - ?assertEqual(StoppedStatus, stopped), + ?assertEqual(StoppedStatus, disconnected), ?assertEqual({error,health_check_failed}, emqx_resource:health_check(PoolName)), % Resource healthcheck shortcuts things by checking ets. Go deeper by checking pool itself. ?assertEqual({error, not_found}, ecpool:stop_sup_pool(ReturnedPoolName)),