fix: emqx_auth_postgresql test suites

This commit is contained in:
Kjell Winblad 2023-11-24 11:01:44 +01:00
parent 6ef9c6fe4a
commit c5e281b84b
2 changed files with 19 additions and 12 deletions

View File

@ -798,17 +798,24 @@ parse_id(Id) ->
end. end.
get_channels_for_connector(ConnectorId) -> get_channels_for_connector(ConnectorId) ->
{ConnectorType, ConnectorName} = emqx_connector_resource:parse_connector_id(ConnectorId), try emqx_connector_resource:parse_connector_id(ConnectorId) of
RootConf = maps:keys(emqx:get_config([?ROOT_KEY], #{})), {ConnectorType, ConnectorName} ->
RelevantBridgeV2Types = [ RootConf = maps:keys(emqx:get_config([?ROOT_KEY], #{})),
Type RelevantBridgeV2Types = [
|| Type <- RootConf, Type
connector_type(Type) =:= ConnectorType || Type <- RootConf,
], connector_type(Type) =:= ConnectorType
lists:flatten([ ],
get_channels_for_connector(ConnectorName, BridgeV2Type) lists:flatten([
|| BridgeV2Type <- RelevantBridgeV2Types get_channels_for_connector(ConnectorName, BridgeV2Type)
]). || BridgeV2Type <- RelevantBridgeV2Types
])
catch
_:_ ->
%% ConnectorId is not a valid connector id so we assume the connector
%% has no channels (e.g. it is a a connector for authn or authz)
[]
end.
get_channels_for_connector(ConnectorName, BridgeV2Type) -> get_channels_for_connector(ConnectorName, BridgeV2Type) ->
BridgeV2s = emqx:get_config([?ROOT_KEY, BridgeV2Type], #{}), BridgeV2s = emqx:get_config([?ROOT_KEY, BridgeV2Type], #{}),

View File

@ -61,7 +61,7 @@ end_per_testcase(_, _Config) ->
t_lifecycle(_Config) -> t_lifecycle(_Config) ->
perform_lifecycle_check( perform_lifecycle_check(
<<"connector:pgsql:emqx_postgresql_SUITE">>, <<"emqx_postgresql_SUITE">>,
pgsql_config() pgsql_config()
). ).