|
|
@@ -222,7 +222,7 @@ t_dashboard(_Config) ->
|
|
|
{ok, Dashboard = #{<<"listeners">> := Listeners}} = get_config("dashboard"),
|
|
|
Https1 = #{enable => true, bind => 18084},
|
|
|
?assertMatch(
|
|
|
- {error, {"HTTP/1.1", 400, _}},
|
|
|
+ {ok, _},
|
|
|
update_config("dashboard", Dashboard#{<<"listeners">> => Listeners#{<<"https">> => Https1}})
|
|
|
),
|
|
|
|
|
|
@@ -241,17 +241,20 @@ t_dashboard(_Config) ->
|
|
|
update_config("dashboard", Dashboard2)
|
|
|
),
|
|
|
|
|
|
- KeyFile = emqx_common_test_helpers:app_path(emqx, filename:join(["etc", "certs", "key.pem"])),
|
|
|
- CertFile = emqx_common_test_helpers:app_path(emqx, filename:join(["etc", "certs", "cert.pem"])),
|
|
|
- CacertFile = emqx_common_test_helpers:app_path(
|
|
|
- emqx, filename:join(["etc", "certs", "cacert.pem"])
|
|
|
- ),
|
|
|
+ FilePath = fun(Name) ->
|
|
|
+ iolist_to_binary(
|
|
|
+ emqx_common_test_helpers:app_path(emqx, filename:join(["etc", "certs", Name]))
|
|
|
+ )
|
|
|
+ end,
|
|
|
+ KeyFile = FilePath("key.pem"),
|
|
|
+ CertFile = FilePath("cert.pem"),
|
|
|
+ CacertFile = FilePath("cacert.pem"),
|
|
|
Https3 = #{
|
|
|
<<"bind">> => 18084,
|
|
|
<<"ssl_options">> => #{
|
|
|
- <<"keyfile">> => list_to_binary(KeyFile),
|
|
|
- <<"cacertfile">> => list_to_binary(CacertFile),
|
|
|
- <<"certfile">> => list_to_binary(CertFile)
|
|
|
+ <<"keyfile">> => KeyFile,
|
|
|
+ <<"cacertfile">> => CacertFile,
|
|
|
+ <<"certfile">> => CertFile
|
|
|
}
|
|
|
},
|
|
|
Dashboard3 = Dashboard#{<<"listeners">> => Listeners#{<<"https">> => Https3}},
|
|
|
@@ -260,16 +263,23 @@ t_dashboard(_Config) ->
|
|
|
Dashboard4 = Dashboard#{<<"listeners">> => Listeners#{<<"https">> => #{<<"bind">> => 0}}},
|
|
|
?assertMatch({ok, _}, update_config("dashboard", Dashboard4)),
|
|
|
{ok, Dashboard41} = get_config("dashboard"),
|
|
|
- ?assertEqual(
|
|
|
- Https3#{<<"bind">> => 0},
|
|
|
+ ?assertMatch(
|
|
|
+ #{
|
|
|
+ <<"bind">> := 0,
|
|
|
+ <<"ssl_options">> :=
|
|
|
+ #{
|
|
|
+ <<"keyfile">> := KeyFile,
|
|
|
+ <<"cacertfile">> := CacertFile,
|
|
|
+ <<"certfile">> := CertFile
|
|
|
+ }
|
|
|
+ },
|
|
|
read_conf([<<"dashboard">>, <<"listeners">>, <<"https">>]),
|
|
|
Dashboard41
|
|
|
),
|
|
|
|
|
|
?assertMatch({ok, _}, update_config("dashboard", Dashboard)),
|
|
|
-
|
|
|
{ok, Dashboard1} = get_config("dashboard"),
|
|
|
- ?assertNotEqual(Dashboard, Dashboard1),
|
|
|
+ ?assertEqual(Dashboard, Dashboard1),
|
|
|
timer:sleep(1500),
|
|
|
ok.
|
|
|
|