File 7671-snmp-agent-test-Add-a-sanity-check-for-framework-tes.patch of Package erlang

From 249baa1d94bc86ffcfa1ba61cd66107ba79fe602 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Tue, 25 Jan 2022 17:50:51 +0100
Subject: [PATCH 11/12] [snmp|agent|test] Add a "sanity check" for framework
 test case

On some of our slow (and/or "unstable) machines, time checks may
produce results that are untrustworthy.
So, as a sort of sanity check, we check how long time it took
to get the snmpEngineTime. This should normally only take a couple
of milli sec (at most 100ms). So, if it takes more tha a second
then we can no longer trust the results. Therefor SKIP instead.

Also update copyright end date.
---
 lib/snmp/test/snmp_agent_SUITE.erl    | 23 +++++++++++++++++++++--
 lib/snmp/test/snmp_agent_test_lib.erl |  2 +-
 lib/snmp/test/snmp_test_lib.erl       |  2 +-
 lib/snmp/test/snmp_test_mgr.erl       |  2 +-
 lib/snmp/test/snmp_test_mgr_misc.erl  |  2 +-
 5 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/lib/snmp/test/snmp_agent_SUITE.erl b/lib/snmp/test/snmp_agent_SUITE.erl
index 408ba53a92..6db80e924e 100644
--- a/lib/snmp/test/snmp_agent_SUITE.erl
+++ b/lib/snmp/test/snmp_agent_SUITE.erl
@@ -1,7 +1,7 @@
 %% 
 %% %CopyrightBegin%
 %%
-%% Copyright Ericsson AB 2003-2021. All Rights Reserved.
+%% Copyright Ericsson AB 2003-2022. All Rights Reserved.
 %%
 %% Licensed under the Apache License, Version 2.0 (the "License");
 %% you may not use this file except in compliance with the License.
@@ -5908,7 +5908,7 @@ snmp_framework_mib_3(Config) when is_list(Config) ->
 
 
 %% Req. SNMP-FRAMEWORK-MIB
-%% snmpEngineID in number of seconds.
+%% snmpEngineTime (in number of seconds).
 %% In theory, the Engine Time diff of the engine, should be exactly
 %% the same as the number of seconds we sleep (5 in this case).
 %% But because, on some (slow or/and high loaded) hosts, the actual
@@ -5956,6 +5956,25 @@ snmp_framework_mib_test() ->
              EngineTime2, T4-T3,
              T4-T1, ASleep, Sleep, EngineTimeDiff, LowEngineTime, HighEngineTime]),
 
+    %% In our environment, get'ing the snmpEngineTime should only take
+    %% a couple of milli sec (less then 100).
+    %% So just as a sanity check, we check that it its < 1000ms.
+    %% We do have a couple of machines that are "unstable"...
+
+    ?IPRINT("check that all snmpEngineTime acquire < 1000"),
+    if
+        ((T2 - T1) >= 1000) ->
+            ?WPRINT("Failed snmpEngineTime 1 sanity check: "
+                    "~n      Time to acquire ~w >= 1000", [T2-T1]),
+            ?SKIP({acquire, snmpEngineTime, 1, T1, T2});
+        ((T4 - T3) => 1000) ->
+            ?WPRINT("Failed snmpEngineTime 2 sanity check: "
+                    "~n      Time to acquire ~w >= 1000", [T4-T3]),
+            ?SKIP({acquire, snmpEngineTime, 2, T3, T4});
+        true ->
+            ok
+    end,
+
     if
         (HighEngineTime < EngineTime2) ->
             ?EPRINT("snmp_framework_mib -> (High) Engine Time diff (~w) too large: "
diff --git a/lib/snmp/test/snmp_agent_test_lib.erl b/lib/snmp/test/snmp_agent_test_lib.erl
index 27c4248c49..aa8c7c65ca 100644
--- a/lib/snmp/test/snmp_agent_test_lib.erl
+++ b/lib/snmp/test/snmp_agent_test_lib.erl
@@ -1,7 +1,7 @@
 %% 
 %% %CopyrightBegin%
 %%
-%% Copyright Ericsson AB 2005-2021. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2022. All Rights Reserved.
 %%
 %% Licensed under the Apache License, Version 2.0 (the "License");
 %% you may not use this file except in compliance with the License.
diff --git a/lib/snmp/test/snmp_test_mgr.erl b/lib/snmp/test/snmp_test_mgr.erl
index 9e93509d20..d9caa15cdb 100644
--- a/lib/snmp/test/snmp_test_mgr.erl
+++ b/lib/snmp/test/snmp_test_mgr.erl
@@ -1,7 +1,7 @@
 %% 
 %% %CopyrightBegin%
 %%
-%% Copyright Ericsson AB 1996-2021. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2022. All Rights Reserved.
 %%
 %% Licensed under the Apache License, Version 2.0 (the "License");
 %% you may not use this file except in compliance with the License.
diff --git a/lib/snmp/test/snmp_test_mgr_misc.erl b/lib/snmp/test/snmp_test_mgr_misc.erl
index 22b0d32d7d..506ceb6a5e 100644
--- a/lib/snmp/test/snmp_test_mgr_misc.erl
+++ b/lib/snmp/test/snmp_test_mgr_misc.erl
@@ -1,7 +1,7 @@
 %% 
 %% %CopyrightBegin%
 %%
-%% Copyright Ericsson AB 1996-2020. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2022. All Rights Reserved.
 %%
 %% Licensed under the Apache License, Version 2.0 (the "License");
 %% you may not use this file except in compliance with the License.
-- 
2.34.1

openSUSE Build Service is sponsored by