Explorar o código

test: fix another broken test

Thales Macedo Garitezi %!s(int64=2) %!d(string=hai) anos
pai
achega
7fc069da46
Modificáronse 1 ficheiros con 16 adicións e 5 borrados
  1. 16 5
      apps/emqx_bridge/test/emqx_bridge_SUITE.erl

+ 16 - 5
apps/emqx_bridge/test/emqx_bridge_SUITE.erl

@@ -32,7 +32,9 @@ init_per_suite(Config) ->
             emqx_conf,
             emqx_connector,
             emqx_bridge_http,
-            emqx_bridge
+            emqx_bridge_mqtt,
+            emqx_bridge,
+            emqx_rule_engine
         ],
         #{work_dir => ?config(priv_dir, Config)}
     ),
@@ -154,14 +156,18 @@ setup_fake_telemetry_data() ->
     ok.
 
 t_update_ssl_conf(Config) ->
-    Path = proplists:get_value(config_path, Config),
-    CertDir = filename:join([emqx:mutable_certs_dir() | Path]),
+    [_Root, Type, Name] = proplists:get_value(config_path, Config),
+    CertDir = filename:join([emqx:mutable_certs_dir(), connectors, Type, Name]),
     EnableSSLConf = #{
         <<"bridge_mode">> => false,
         <<"clean_start">> => true,
         <<"keepalive">> => <<"60s">>,
         <<"proto_ver">> => <<"v4">>,
         <<"server">> => <<"127.0.0.1:1883">>,
+        <<"egress">> => #{
+            <<"local">> => #{<<"topic">> => <<"t">>},
+            <<"remote">> => #{<<"topic">> => <<"remote/t">>}
+        },
         <<"ssl">> =>
             #{
                 <<"cacertfile">> => cert_file("cafile"),
@@ -171,10 +177,15 @@ t_update_ssl_conf(Config) ->
                 <<"verify">> => <<"verify_peer">>
             }
     },
-    {ok, _} = emqx:update_config(Path, EnableSSLConf),
+    CreateCfg = [
+        {bridge_name, Name},
+        {bridge_type, Type},
+        {bridge_config, #{}}
+    ],
+    {ok, _} = emqx_bridge_testlib:create_bridge_api(CreateCfg, EnableSSLConf),
     ?assertMatch({ok, [_, _, _]}, file:list_dir(CertDir)),
     NoSSLConf = EnableSSLConf#{<<"ssl">> := #{<<"enable">> => false}},
-    {ok, _} = emqx:update_config(Path, NoSSLConf),
+    {ok, _} = emqx_bridge_testlib:update_bridge_api(CreateCfg, NoSSLConf),
     {ok, _} = emqx_tls_certfile_gc:force(),
     ?assertMatch({error, enoent}, file:list_dir(CertDir)),
     ok.