File 7661-snmp-agent-test-Attempt-to-detect-usmStatsNotInTimeW.patch of Package erlang
From 5a3ef5a8c9f73cc607388e4da230da741637d98d Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Fri, 17 Dec 2021 18:38:03 +0100
Subject: [PATCH 01/12] [snmp|agent|test] Attempt to detect
'usmStatsNotInTimeWindows'
---
lib/snmp/test/snmp_agent_SUITE.erl | 22 ++++++++--------------
lib/snmp/test/snmp_test_mgr.erl | 8 ++++++--
lib/snmp/test/snmp_test_mgr_misc.erl | 3 +++
3 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/lib/snmp/test/snmp_agent_SUITE.erl b/lib/snmp/test/snmp_agent_SUITE.erl
index adf24cbb99..44ee3abdc0 100644
--- a/lib/snmp/test/snmp_agent_SUITE.erl
+++ b/lib/snmp/test/snmp_agent_SUITE.erl
@@ -503,23 +503,17 @@
-define(expect1(What),
- ?ALIB:expect(?MODULE, ?LINE,
- What)).
+ ?ALIB:expect(?MODULE, ?LINE, What)).
-define(expect2(What, ExpVBs),
- ?ALIB:expect(?MODULE, ?LINE,
- What, ExpVBs)).
+ ?ALIB:expect(?MODULE, ?LINE, What, ExpVBs)).
-define(expect3(Err, Idx, ExpVBs),
- ?ALIB:expect(?MODULE, ?LINE,
- Err, Idx, ExpVBs)).
+ ?ALIB:expect(?MODULE, ?LINE, Err, Idx, ExpVBs)).
-define(expect4(Err, Idx, ExpVBs, To),
- ?ALIB:expect(?MODULE, ?LINE,
- Err, Idx, ExpVBs, To)).
+ ?ALIB:expect(?MODULE, ?LINE, Err, Idx, ExpVBs, To)).
-define(expect5(Type, Ent, Gen, Spec, ExpVBs),
- ?ALIB:expect(?MODULE, ?LINE,
- Type, Ent, Gen, Spec, ExpVBs)).
+ ?ALIB:expect(?MODULE, ?LINE, Type, Ent, Gen, Spec, ExpVBs)).
-define(expect6(Type, Ent, Gen, Spec, ExpVBs, To),
- ?ALIB:expect(?MODULE, ?LINE,
- Type, Ent, Gen, Spec, ExpVBs, To)).
+ ?ALIB:expect(?MODULE, ?LINE, Type, Ent, Gen, Spec, ExpVBs, To)).
%%======================================================================
@@ -3651,8 +3645,8 @@ v3_inform_sync(MA) ->
?SLEEP(20000), % more than 1500*10 in target_addr.conf
?DBG("v3_sync -> await response",[]),
?line ?expect2({inform, true},
- [{[sysUpTime, 0], any},
- {[snmpTrapOID, 0], ?system ++ [0,1]}]).
+ [{[sysUpTime, 0], any},
+ {[snmpTrapOID, 0], ?system ++ [0,1]}]).
v2_caps(suite) -> [];
diff --git a/lib/snmp/test/snmp_test_mgr.erl b/lib/snmp/test/snmp_test_mgr.erl
index 7fab69c043..d9532a7c6d 100644
--- a/lib/snmp/test/snmp_test_mgr.erl
+++ b/lib/snmp/test/snmp_test_mgr.erl
@@ -151,9 +151,13 @@ receive_response(Timeout) ->
receive
{snmp_pdu, PDU} when is_record(PDU, pdu) ->
d("received PDU: ~n\t~p",[PDU]),
- PDU
+ PDU;
+ {error, Reason} = ERROR ->
+ d("received unexpected error: "
+ "~n\t\t~p", [Reason]),
+ ERROR
after Timeout ->
- d("response timeout",[]),
+ d("response timeout", []),
{error, timeout}
end.
diff --git a/lib/snmp/test/snmp_test_mgr_misc.erl b/lib/snmp/test/snmp_test_mgr_misc.erl
index 2a20ebee42..6f15adaed1 100644
--- a/lib/snmp/test/snmp_test_mgr_misc.erl
+++ b/lib/snmp/test/snmp_test_mgr_misc.erl
@@ -327,6 +327,9 @@ handle_v3_message(Mgr, UdpId, Ip, UdpPort, AgentIp,
"~n Port: ~p"
"~n Ip: ~p",
[Reason, UdpPort, Ip]),
+ %% Can we be sure that this error is not expected?
+ {_, Pid} = Mgr,
+ Pid ! {error, Reason},
[];
throw:{error, Reason}:_ ->
--
2.34.1