From 8ee78ad6b4d624ed9fc071b604243d6b0263f7c2 Mon Sep 17 00:00:00 2001 From: William Yang Date: Thu, 25 May 2023 09:57:18 +0200 Subject: [PATCH] test: fix emqx_mgmt_api_configs_SUITE --- .../test/emqx_mgmt_api_configs_SUITE.erl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/emqx_management/test/emqx_mgmt_api_configs_SUITE.erl b/apps/emqx_management/test/emqx_mgmt_api_configs_SUITE.erl index 2805d260d..5fca80db2 100644 --- a/apps/emqx_management/test/emqx_mgmt_api_configs_SUITE.erl +++ b/apps/emqx_management/test/emqx_mgmt_api_configs_SUITE.erl @@ -137,9 +137,14 @@ t_global_zone(_Config) -> ), ?assertEqual(lists:usort(ZonesKeys), lists:usort(maps:keys(Zones))), ?assertEqual( - emqx_config:get_zone_conf(no_default, [mqtt, max_qos_allowed]), + emqx_config:get_zone_conf(default, [mqtt, max_qos_allowed]), emqx_utils_maps:deep_get([<<"mqtt">>, <<"max_qos_allowed">>], Zones) ), + ?assertError( + {config_not_found, [zones, no_default, mqtt, max_qos_allowed]}, + emqx_config:get_zone_conf(no_default, [mqtt, max_qos_allowed]) + ), + NewZones1 = emqx_utils_maps:deep_put([<<"mqtt">>, <<"max_qos_allowed">>], Zones, 1), NewZones2 = emqx_utils_maps:deep_remove([<<"mqtt">>, <<"peer_cert_as_clientid">>], NewZones1), {ok, #{<<"mqtt">> := Res}} = update_global_zone(NewZones2), @@ -151,7 +156,11 @@ t_global_zone(_Config) -> }, Res ), - ?assertEqual(1, emqx_config:get_zone_conf(no_default, [mqtt, max_qos_allowed])), + ?assertEqual(1, emqx_config:get_zone_conf(default, [mqtt, max_qos_allowed])), + ?assertError( + {config_not_found, [zones, no_default, mqtt, max_qos_allowed]}, + emqx_config:get_zone_conf(no_default, [mqtt, max_qos_allowed]) + ), %% Make sure the override config is updated, and remove the default value. ?assertMatch(#{<<"max_qos_allowed">> := 1}, read_conf(<<"mqtt">>)),