From 666559111508b65ab1379476b0d8c76c15e5700e Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Tue, 24 Jun 2014 15:54:48 +0200 Subject: Mend regression tests --- lib/snmp/test/snmp_agent_test.erl | 23 +++++++++++++++++------ lib/snmp/test/snmp_manager_config_test.erl | 5 +++-- lib/snmp/test/snmp_manager_test.erl | 12 ++++++++++-- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/lib/snmp/test/snmp_agent_test.erl b/lib/snmp/test/snmp_agent_test.erl index 608a99062d..c13b64e8da 100644 --- a/lib/snmp/test/snmp_agent_test.erl +++ b/lib/snmp/test/snmp_agent_test.erl @@ -1725,7 +1725,7 @@ init_v1(Config) when is_list(Config) -> ?line AgentConfDir = ?config(agent_conf_dir, Config), ?line MgrDir = ?config(mgr_dir, Config), ?line Ip = ?config(ip, Config), - ?line IpFamily = ?config(ipfamily, Config), + ?line IpFamily = config_ipfamily(Config), ?line config( [v1], MgrDir, AgentConfDir, tuple_to_list(Ip), tuple_to_list(Ip), IpFamily), @@ -1798,7 +1798,7 @@ init_v2(Config) when is_list(Config) -> AgentConfDir = ?config(agent_conf_dir, Config), MgrDir = ?config(mgr_dir, Config), Ip = ?config(ip, Config), - IpFamily = ?config(ipfamily, Config), + IpFamily = config_ipfamily(Config), config( [v2], MgrDir, AgentConfDir, tuple_to_list(Ip), tuple_to_list(Ip), IpFamily), @@ -1820,7 +1820,7 @@ init_v1_v2(Config) when is_list(Config) -> AgentConfDir = ?config(agent_conf_dir, Config), MgrDir = ?config(mgr_dir, Config), Ip = ?config(ip, Config), - IpFamily = ?config(ipfamily, Config), + IpFamily = config_ipfamily(Config), config([v1,v2], MgrDir, AgentConfDir, tuple_to_list(Ip), tuple_to_list(Ip), IpFamily), [{vsn, bilingual} | start_bilingual_agent(Config)]. @@ -1909,7 +1909,7 @@ init_v3(Config) when is_list(Config) -> AgentConfDir = ?config(agent_conf_dir, Config), MgrDir = ?config(mgr_dir, Config), Ip = ?config(ip, Config), - IpFamily = ?config(ipfamily, Config), + IpFamily = config_ipfamily(Config), ?line ok = config( [v3], MgrDir, AgentConfDir, @@ -7430,7 +7430,8 @@ init_v1_agent(Config) -> ManagerHost = ?HOSTNAME(ManagerNode), Host = snmp_test_lib:hostname(), - IpFamily = ?LOCALHOST(?config(ipfamily, Config)), + IpFamily = config_ipfamily(Config), + Ip = ?LOCALHOST(IpFamily), {ok, AgentIP0} = snmp_misc:ip(AgentHost, IpFamily), AgentIP = tuple_to_list(AgentIP0), {ok, ManagerIP0} = snmp_misc:ip(ManagerHost, IpFamily), @@ -7458,7 +7459,7 @@ init_v1_agent(Config) -> %% Config2 = start_agent([{host, Host}, - {ip, IpFamily}, + {ip, Ip}, {agent_node, AgentNode}, {agent_host, AgentHost}, {agent_ip, AgentIP}, @@ -7508,3 +7509,13 @@ fin_v1_agent(Config) -> Dog = ?config(watchdog, Config), ?WD_STOP(Dog), lists:keydelete(watchdog, 1, Config). + + + +config_ipfamily(Config) -> + case ?config(ipfamily, Config) of + undefined -> + inet; + Value -> + Value + end. diff --git a/lib/snmp/test/snmp_manager_config_test.erl b/lib/snmp/test/snmp_manager_config_test.erl index 3cdb2cfcbe..2f5c68d14d 100644 --- a/lib/snmp/test/snmp_manager_config_test.erl +++ b/lib/snmp/test/snmp_manager_config_test.erl @@ -720,7 +720,8 @@ start_with_invalid_manager_conf_file1(Conf) when is_list(Conf) -> "[134,138,177,189]", "-1", "500", "\"bmkEngine\""), ?line {error, Reason22} = config_start(Opts), p("start failed (as expected): ~p", [Reason22]), - ?line {failed_check, _, _, 3, {invalid_integer, _}} = Reason22, + io:format("Reason22: ~p~n", [Reason22]), + ?line {failed_check, _, _, 3, {bad_port, _}} = Reason22, await_config_not_running(), %% -- @@ -729,7 +730,7 @@ start_with_invalid_manager_conf_file1(Conf) when is_list(Conf) -> "[134,138,177,189]", "\"kalle-anka\"", "500", "\"bmkEngine\""), ?line {error, Reason23} = config_start(Opts), p("start failed (as expected): ~p", [Reason23]), - ?line {failed_check, _, _, 3, {invalid_integer, _}} = Reason23, + ?line {failed_check, _, _, 3, {bad_port, _}} = Reason23, await_config_not_running(), %% -- diff --git a/lib/snmp/test/snmp_manager_test.erl b/lib/snmp/test/snmp_manager_test.erl index 75560f8958..78352e59cf 100644 --- a/lib/snmp/test/snmp_manager_test.erl +++ b/lib/snmp/test/snmp_manager_test.erl @@ -581,8 +581,16 @@ init_per_group(event_tests_mt = GroupName, Config) -> snmp_test_lib:init_group_top_dir( GroupName, [{manager_net_if_module, snmpm_net_if_mt} | Config]); -init_per_group(ipv6_mt, Config) -> - init_per_group(ipv6, [{manager_net_if_module, snmpm_net_if_mt} | Config]); +init_per_group(ipv6_mt = GroupName, Config) -> + case ct:require(ipv6_hosts) of + ok -> + ipv6_init( + snmp_test_lib:init_group_top_dir( + GroupName, + [{manager_net_if_module, snmpm_net_if_mt} | Config])); + _ -> + {skip, "Host does not support IPV6"} + end; init_per_group(ipv6 = GroupName, Config) -> case ct:require(ipv6_hosts) of ok -> -- cgit v1.2.3