From 2ff0a8e47346e6303e97812a6c3a789bee920f2d Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 9 Jul 2024 18:14:51 +0200 Subject: [PATCH 1/6] [snmp|test] Tweaked factor calculation (for docker) --- lib/snmp/test/snmp_test_lib.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl index 97b69dcfa5a9..88be9643c103 100644 --- a/lib/snmp/test/snmp_test_lib.erl +++ b/lib/snmp/test/snmp_test_lib.erl @@ -1468,7 +1468,7 @@ analyze_and_print_linux_host_info(Version) -> _ -> 5 end, - AddLabelFactor = label2factor(Label), + AddLabelFactor = label2factor(simplify_label(Label)), %% Check if we need to adjust the factor because of the memory AddMemFactor = try linux_which_meminfo() catch _:_:_ -> 0 From 58d524f41c1565e548f8694f080eb8d25f67842a Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 10 Jul 2024 15:16:46 +0200 Subject: [PATCH 2/6] [snmp|test] Label analyzis --- lib/snmp/test/snmp_test_lib.erl | 387 +++++++++++++++++++------------- 1 file changed, 228 insertions(+), 159 deletions(-) diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl index 88be9643c103..acaa383c7a69 100644 --- a/lib/snmp/test/snmp_test_lib.erl +++ b/lib/snmp/test/snmp_test_lib.erl @@ -1063,17 +1063,20 @@ do_linux_which_distro_os_release(Version, Label) -> Info = linux_process_os_release(), {value, {_, DistroStr}} = lists:keysearch(name, 1, Info), {value, {_, VersionNo}} = lists:keysearch(version, 1, Info), - io:format("Linux: ~s" - "~n Distro: ~s" - "~n Distro Version: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, DistroStr, VersionNo, Label, - linux_product_name()]), + %% SLabel = simplify_label(Label), + %% io:format("Linux: ~s" + %% "~n Distro: ~s" + %% "~n Distro Version: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, DistroStr, VersionNo, Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + DistroStr, VersionNo, Label), throw({distro, {linux_distro_str_to_distro_id(DistroStr), - simplify_label(Label)}}) + SLabel}}) end catch throw:{distro, _} = DISTRO -> @@ -1084,7 +1087,29 @@ do_linux_which_distro_os_release(Version, Label) -> _ -> retry end. - + + +linux_distro_release(Version, Distro, Label) -> + SLabel = simplify_label(Label), + io:format("Linux: ~s" + "~n Distro: ~s" + "~n TS Extra Platform Label: ~s (~p)" + "~n Product Name: ~s" + "~n", + [Version, Distro, Label, SLabel, linux_product_name()]), + SLabel. + +linux_distro_release(Version, Distro, DVersion, Label) -> + SLabel = simplify_label(Label), + io:format("Linux: ~s" + "~n Distro: ~s" + "~n Distro Version: ~s" + "~n TS Extra Platform Label: ~s (~p)" + "~n Product Name: ~s" + "~n", + [Version, Distro, DVersion, Label, SLabel, linux_product_name()]), + SLabel. + linux_process_os_release() -> %% Read the "raw" file @@ -1174,27 +1199,30 @@ do_linux_which_distro_fedora_release(Version, Label) -> %% Check if fedora case file:read_file_info("/etc/fedora-release") of {ok, _} -> - case [string:trim(S) || - S <- string:tokens(os:cmd("cat /etc/fedora-release"), - [$\n])] of - [DistroStr | _] -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, DistroStr, Label, - linux_product_name()]); - _ -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, "Fedora", Label, - linux_product_name()]) + SLabel = + case [string:trim(S) || + S <- string:tokens(os:cmd("cat /etc/fedora-release"), + [$\n])] of + [DistroStr | _] -> + %% io:format("Linux: ~s" + %% "~n Distro: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, DistroStr, Label, SLabel, + %% linux_product_name()]); + linux_distro_release(Version, DistroStr, Label); + _ -> + %% io:format("Linux: ~s" + %% "~n Distro: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, "Fedora", Label, SLabel + %% linux_product_name()]) + linux_distro_release(Version, "Fedora", Label) end, - throw({distro, {fedora, simplify_label(Label)}}); + throw({distro, {fedora, SLabel}}); _ -> throw({error, not_found}) end. @@ -1209,32 +1237,41 @@ do_linux_which_distro_suse_release(Version, Label) -> S <- string:tokens(os:cmd("cat /etc/SuSE-release"), [$\n])] of ["SUSE Linux Enterprise Server" ++ _ = DistroStr | _] -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, DistroStr, Label, - linux_product_name()]), - throw({distro, {sles, simplify_label(Label)}}); + %% io:format("Linux: ~s" + %% "~n Distro: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, DistroStr, Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + DistroStr, + Label), + throw({distro, {sles, SLabel}}); [DistroStr | _] -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, DistroStr, Label, - linux_product_name()]), - throw({distro, {suse, simplify_label(Label)}}); + %% io:format("Linux: ~s" + %% "~n Distro: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, DistroStr, Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + DistroStr, + Label), + throw({distro, {suse, SLabel}}); _ -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, "SuSE", Label, - linux_product_name()]), - throw({distro, {suse, simplify_label(Label)}}) + %% io:format("Linux: ~s" + %% "~n Distro: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, "SuSE", Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + "SuSE", + Label), + throw({distro, {suse, SLabel}}) end; _ -> case string:tokens(os:cmd("cat /etc/SUSE-brand"), [$\n]) of @@ -1242,71 +1279,91 @@ do_linux_which_distro_suse_release(Version, Label) -> case [string:strip(S) || S <- string:tokens(VERSION, [$=])] of ["VERSION", VersionNo] -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n Distro Version: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, - DistroStr, VersionNo, - Label, - linux_product_name()]), - throw({distro, - {sles, simplify_label(Label)}}); + %% io:format( + %% "Linux: ~s" + %% "~n Distro: ~s" + %% "~n Distro Version: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, + %% DistroStr, VersionNo, + %% Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + DistroStr, + VersionNo, + Label), + throw({distro, {sles, SLabel}}); _ -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, DistroStr, Label, - linux_product_name()]), - throw({distro, - {sles, simplify_label(Label)}}) + %% io:format( + %% "Linux: ~s" + %% "~n Distro: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, DistroStr, Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + DistroStr, + Label), + throw({distro, {sles, SLabel}}) end; ["openSUSE" = DistroStr, VERSION | _] -> case [string:strip(S) || S <- string:tokens(VERSION, [$=])] of ["VERSION", VersionNo] -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n Distro Version: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, - DistroStr, VersionNo, - Label, - linux_product_name()]), - throw({distro, - {suse, simplify_label(Label)}}); + %% io:format( + %% "Linux: ~s" + %% "~n Distro: ~s" + %% "~n Distro Version: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, + %% DistroStr, VersionNo, + %% Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + DistroStr, + VersionNo, + Label), + throw({distro, {suse, SLabel}}); _ -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, DistroStr, Label, - linux_product_name()]), - throw({distro, - {suse, simplify_label(Label)}}) + %% io:format( + %% "Linux: ~s" + %% "~n Distro: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, DistroStr, Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + DistroStr, + Label), + throw({distro, {suse, SLabel}}) end; _ -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, "Unknown SUSE", Label, - linux_product_name()]), - throw({distro, {suse, simplify_label(Label)}}) + %% io:format( + %% "Linux: ~s" + %% "~n Distro: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, "Unknown SUSE", + %% Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + "Unknown SUSE", + Label), + throw({distro, {suse, SLabel}}) end end; _ -> throw({error, not_found}) end. + do_linux_which_distro_issue(Version, Label) -> case file:read_file_info("/etc/issue") of {ok, _} -> @@ -1315,65 +1372,77 @@ do_linux_which_distro_issue(Version, Label) -> [DistroStr | _] -> case DistroStr of "Wind River Linux" ++ _ -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, DistroStr, Label, - linux_product_name()]), - throw({distro, - {wind_river, simplify_label(Label)}}); + %% io:format( + %% "Linux: ~s" + %% "~n Distro: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, DistroStr, Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + DistroStr, Label), + throw({distro, {wind_river, SLabel}}); "MontaVista" ++ _ -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, DistroStr, Label, - linux_product_name()]), - throw({distro, - {montavista, simplify_label(Label)}}); + %% io:format( + %% "Linux: ~s" + %% "~n Distro: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, DistroStr, Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + DistroStr, Label), + throw({distro, {montavista, SLabel}}); "Yellow Dog" ++ _ -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, DistroStr, Label, - linux_product_name()]), - throw({distro, - {yellow_dog, simplify_label(Label)}}); + %% io:format( + %% "Linux: ~s" + %% "~n Distro: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, DistroStr, Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + DistroStr, Label), + throw({distro, {yellow_dog, SLabel}}); "Debian" ++ _ -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, DistroStr, Label, - linux_product_name()]), - throw({distro, - {debian, simplify_label(Label)}}); + %% io:format( + %% "Linux: ~s" + %% "~n Distro: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, DistroStr, Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + DistroStr, Label), + throw({distro, {debian, SLabel}}); "Ubuntu" ++ _ -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, DistroStr, Label, - linux_product_name()]), - throw({distro, - {ubuntu, simplify_label(Label)}}); + %% io:format( + %% "Linux: ~s" + %% "~n Distro: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, DistroStr, Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + DistroStr, Label), + throw({distro, {ubuntu, SLabel}}); "Linux Mint" ++ _ -> - io:format("Linux: ~s" - "~n Distro: ~s" - "~n TS Extra Platform Label: ~s" - "~n Product Name: ~s" - "~n", - [Version, DistroStr, Label, - linux_product_name()]), - throw({distro, - {linux_mint, simplify_label(Label)}}); + %% io:format( + %% "Linux: ~s" + %% "~n Distro: ~s" + %% "~n TS Extra Platform Label: ~s (~p)" + %% "~n Product Name: ~s" + %% "~n", + %% [Version, DistroStr, Label, SLabel, + %% linux_product_name()]), + SLabel = linux_distro_release(Version, + DistroStr, Label), + throw({distro, {linux_mint, SLabel}}); _ -> DistroStr end; @@ -1468,7 +1537,7 @@ analyze_and_print_linux_host_info(Version) -> _ -> 5 end, - AddLabelFactor = label2factor(simplify_label(Label)), + AddLabelFactor = label2factor(Label), %% Check if we need to adjust the factor because of the memory AddMemFactor = try linux_which_meminfo() catch _:_:_ -> 0 From 5a6f77773c4d04564f29d323326951c8663b45e0 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 10 Jul 2024 17:44:51 +0200 Subject: [PATCH 3/6] [snmp|test] Try ensure (config) not already running --- lib/snmp/test/snmp_manager_config_SUITE.erl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/snmp/test/snmp_manager_config_SUITE.erl b/lib/snmp/test/snmp_manager_config_SUITE.erl index 933be4e01625..074941ab123d 100644 --- a/lib/snmp/test/snmp_manager_config_SUITE.erl +++ b/lib/snmp/test/snmp_manager_config_SUITE.erl @@ -238,6 +238,10 @@ init_per_suite(Config0) when is_list(Config0) -> %% We need one on this node also snmp_test_sys_monitor:start(), + ?IPRINT("init_per_suite -> try ensure snmpm_config not running"), + + config_ensure_not_running(), + ?IPRINT("init_per_suite -> end when" "~n Config: ~p", [Config2]), From b5ef46fa4bbbfbbe2304b93626d66c5cd0e071f4 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 10 Jul 2024 17:46:28 +0200 Subject: [PATCH 4/6] [snmp|test] Tweak timeout calculation --- lib/snmp/test/snmp_manager_SUITE.erl | 15 +++++++++------ lib/snmp/test/snmp_test_lib.erl | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/snmp/test/snmp_manager_SUITE.erl b/lib/snmp/test/snmp_manager_SUITE.erl index 8420ef9955d0..fba9b527d71e 100644 --- a/lib/snmp/test/snmp_manager_SUITE.erl +++ b/lib/snmp/test/snmp_manager_SUITE.erl @@ -1335,6 +1335,8 @@ do_notify_started02(Config) -> ?IPRINT("starting with Config: " "~n ~p", [Config]), + Factor = ?config(snmp_factor, Config), + SCO = ?config(socket_create_opts, Config), ConfDir = ?config(manager_conf_dir, Config), DbDir = ?config(manager_db_dir, Config), @@ -1359,7 +1361,7 @@ do_notify_started02(Config) -> ApproxStartTime = case ns02_client_await_approx_runtime(Pid1) of {ok, T} -> - T; + ?LIB:ftime(T, Factor); {error, Reason} -> %% Attempt cleanup just in case exit(Pid1, kill), @@ -1385,13 +1387,14 @@ do_notify_started02(Config) -> ?FAIL({client, Reason1}); {'EXIT', Pid1, Reason1} -> ?FAIL({client, Reason1}) - after ApproxStartTime + 10000 -> + after ApproxStartTime + 15000 -> exit(Pid1, kill), exit(Pid2, kill), ?FAIL(timeout) end, - - ?IPRINT("await snmpm starter process exit"), + + Timeout2 = ?LIB:ftime(5000, Factor), + ?IPRINT("await (~w msec) snmpm starter process exit", [Timeout2]), receive {'EXIT', Pid2, normal} -> ok; @@ -1400,7 +1403,7 @@ do_notify_started02(Config) -> ?SKIP(SkipReason2); {'EXIT', Pid2, Reason2} -> ?FAIL({ctrl, Reason2}) - after 5000 -> + after Timeout2 -> exit(Pid2, kill), ?FAIL(timeout) end, @@ -1515,7 +1518,7 @@ ns02_ctrl_loop(Opts, N) -> end, ?SLEEP(2000), ?IPRINT("stop manager"), - ?SLEEP(100), % Give the verbosity to take effect... + ?SLEEP(100), % Give the verbosity time to take effect... TS3 = erlang:system_time(millisecond), case snmpm:stop(5000) of ok -> diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl index acaa383c7a69..5c3176b45d7d 100644 --- a/lib/snmp/test/snmp_test_lib.erl +++ b/lib/snmp/test/snmp_test_lib.erl @@ -52,6 +52,7 @@ -export([eprint/2, wprint/2, nprint/2, iprint/2]). -export([explicit_inet_backend/0, test_inet_backends/0]). -export([which_host_ip/2]). +-export([ftime/2]). %% Convenient exports... -export([analyze_and_print_host_info/0]). @@ -3272,6 +3273,20 @@ timetrap_scale_factor() -> N end. +ftime(BaseTime, Factor) + when is_integer(BaseTime) andalso (BaseTime > 0) andalso + is_integer(Factor) andalso (0 < Factor) andalso (Factor < 3) -> + BaseTime; +ftime(BaseTime, Factor) + when is_integer(BaseTime) andalso (BaseTime > 0) andalso + is_integer(Factor) andalso (3 =< Factor) andalso (Factor =< 10) -> + BaseTime + (Factor-2) * (BaseTime div 4); +ftime(BaseTime, Factor) + when is_integer(BaseTime) andalso (BaseTime > 0) andalso + is_integer(Factor) andalso (10 < Factor) -> + 3*BaseTime + (Factor-10) * (BaseTime div 10). + + %% ---------------------------------------------------------------------- %% file & dir functions From 8c7ca45a20f5d2dac6e56b2d778a97236f4d1186 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 6 Aug 2024 11:33:25 +0200 Subject: [PATCH 5/6] [snmp|test] Skip when RPC fails When RPC fails (because of nodedown), skip instead of failing. --- lib/snmp/test/snmp_agent_test_lib.erl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/snmp/test/snmp_agent_test_lib.erl b/lib/snmp/test/snmp_agent_test_lib.erl index 3877123b370b..0edc42c42623 100644 --- a/lib/snmp/test/snmp_agent_test_lib.erl +++ b/lib/snmp/test/snmp_agent_test_lib.erl @@ -1030,7 +1030,12 @@ await_stopped(Pid, Ref) -> %% --- start subagent supervisor --- start_sub_sup(Node, Dir) -> - rpc:call(Node, ?MODULE, start_sub_sup, [Dir]). + case rpc:call(Node, ?MODULE, start_sub_sup, [Dir]) of + {badrpc, _Reason} = BADRPC -> + ?SKIP(BADRPC); + Result -> + Result + end. start_sub_sup(Dir) -> ?DBG("start_sub -> entry",[]), @@ -1056,6 +1061,8 @@ start_subagent(SaNode, RegTree, Mib) -> Func = start_sub_agent, Args = [MA, RegTree, [Mib1]], case rpc:call(SaNode, Mod, Func, Args) of + {badrpc, _Reason} = BADRPC -> + ?SKIP(BADRPC); {ok, SA} -> ?DBG("start_subagent -> SA: ~p", [SA]), {ok, SA}; From b8f93c635b410ac3711c43d330a1590558ee58be Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 6 Aug 2024 18:58:21 +0200 Subject: [PATCH 6/6] [snmp|test] Tweaked simple start and stop test case Try to ensure manager config process is not already running. --- lib/snmp/test/snmp_manager_config_SUITE.erl | 30 ++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/lib/snmp/test/snmp_manager_config_SUITE.erl b/lib/snmp/test/snmp_manager_config_SUITE.erl index 074941ab123d..c800da28b99b 100644 --- a/lib/snmp/test/snmp_manager_config_SUITE.erl +++ b/lib/snmp/test/snmp_manager_config_SUITE.erl @@ -331,20 +331,44 @@ simple_start_and_stop(doc) -> "Start the snmp manager config process with the \n" "minimum setof options (config dir)."; simple_start_and_stop(Conf) when is_list(Conf) -> - put(tname, "SIME-START_AND_STOP"), - ?IPRINT("start"), + put(tname, "SIMPLE_START_AND_STOP"), process_flag(trap_exit, true), + Pre = fun() -> + %% Since this is the first test case in this + %% suite, we (possibly) need to do some cleanup... + ?IPRINT("~w:pre -> ensure config not already running", + [?FUNCTION_NAME]), + config_ensure_not_running() + end, + TC = fun(_) -> + ?IPRINT("~w:tc -> begin", [?FUNCTION_NAME]), + do_simple_start_and_stop(Conf) + end, + Post = fun(_) -> + ?IPRINT("~w:post -> ensure config not still running", + [?FUNCTION_NAME]), + config_ensure_not_running() + end, + ?TC_TRY(?FUNCTION_NAME, Pre, TC, Post). + +do_simple_start_and_stop(Conf) when is_list(Conf) -> ConfDir = ?config(manager_conf_dir, Conf), - DbDir = ?config(manager_db_dir, Conf), + DbDir = ?config(manager_db_dir, Conf), + ?IPRINT("~w -> try write \"standard\" manager config to" + "~n ~p", [?FUNCTION_NAME, ConfDir]), write_manager_conf(ConfDir), Opts = [{versions, [v1]}, {config, [{verbosity, trace}, {dir, ConfDir}, {db_dir, DbDir}]}], + ?IPRINT("~w -> try start with basic opts", [?FUNCTION_NAME]), {ok, _Pid} = snmpm_config:start_link(Opts), + + ?IPRINT("~w -> try stop", [?FUNCTION_NAME]), ok = snmpm_config:stop(), + ?IPRINT("~w -> done", [?FUNCTION_NAME]), ok.