diff options
author | Micael Karlberg <[email protected]> | 2014-03-14 18:41:23 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2014-03-14 18:41:23 +0100 |
commit | 3e8aa3462a151d6b528bab917bfa7b4aab021ba5 (patch) | |
tree | d91c15a73ba74299c7d9e6675e534ece9464edd6 /lib/snmp/test/snmp_agent_test.erl | |
parent | bcfc2e4770123f067c346d96b11d9382ff2b6bcc (diff) | |
download | otp-3e8aa3462a151d6b528bab917bfa7b4aab021ba5.tar.gz otp-3e8aa3462a151d6b528bab917bfa7b4aab021ba5.tar.bz2 otp-3e8aa3462a151d6b528bab917bfa7b4aab021ba5.zip |
[snmp/agent] Fixed request id generation
When testing the agent, it is started and then used for a series
(v1, v2, v3, ...) of tests. But the individual test cases are
use one instance of the test manager. Because of this, the requerst
id cannot be a counter starting from 1 or any counter for that
matter. Instead every request id was generated using random.
But this is obiously not a guarantee fo uniqueness, it merely
makes it unlikely that the request ids will be reused.
To get around this problem (without having to rewrite the
entire agent test suite) a simple (global) counter server is
introduced. It is started at the start of the agent test suite
(init_per_suite) and stopped at the end (end_per_suite).
Diffstat (limited to 'lib/snmp/test/snmp_agent_test.erl')
-rw-r--r-- | lib/snmp/test/snmp_agent_test.erl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/snmp/test/snmp_agent_test.erl b/lib/snmp/test/snmp_agent_test.erl index 84fa1af71d..a6571548d6 100644 --- a/lib/snmp/test/snmp_agent_test.erl +++ b/lib/snmp/test/snmp_agent_test.erl @@ -555,6 +555,8 @@ init_per_suite(Config0) when is_list(Config0) -> Config3 = [{mib_dir, MibDir}, {std_mib_dir, StdMibDir} | Config2], + snmp_test_mgr_counter_server:start(), + ?DBG("init_per_suite -> end with" "~n Config3: ~p", [Config3]), @@ -565,6 +567,17 @@ end_per_suite(Config) when is_list(Config) -> ?DBG("end_per_suite -> entry with" "~n Config: ~p", [Config]), + case snmp_test_mgr_counter_server:stop() of + {ok, Counters} -> + ?DBG("end_per_suite -> sucessfully stopped counter server" + "~n Counters: ~p", [Counters]); + + {error, Reason} -> + ?DBG("end_per_suite -> failed stopping counter server" + "~n Reason: ~p", [Reason]) + end, + + ?DBG("end_per_suite -> end", []), Config. |