aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2015-05-23 16:16:51 +0200
committerAnders Svensson <[email protected]>2015-05-24 09:08:55 +0200
commit4676eb881c2619250b384e8e1ab60bc8ae5d58c3 (patch)
treeef905f71d73d046647dbc4cd2e765d3fcf40ee75 /lib/diameter
parent4686d216fd41d534e1f362a6c0c5bba066f17b22 (diff)
downloadotp-4676eb881c2619250b384e8e1ab60bc8ae5d58c3.tar.gz
otp-4676eb881c2619250b384e8e1ab60bc8ae5d58c3.tar.bz2
otp-4676eb881c2619250b384e8e1ab60bc8ae5d58c3.zip
Fix incorrect suite usage of OTP 18 monotonic time
Value was used as strictly increasing when it's only non-decreasing, causing testcases to fail.
Diffstat (limited to 'lib/diameter')
-rw-r--r--lib/diameter/test/diameter_util.erl15
-rw-r--r--lib/diameter/test/diameter_watchdog_SUITE.erl3
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/diameter/test/diameter_util.erl b/lib/diameter/test/diameter_util.erl
index c496876ee1..df7d268429 100644
--- a/lib/diameter/test/diameter_util.erl
+++ b/lib/diameter/test/diameter_util.erl
@@ -204,13 +204,14 @@ seed() ->
%% unique_string/0
unique_string() ->
- us(diameter_lib:now()).
-
-us({M,S,U}) ->
- tl(lists:append(["-" ++ integer_to_list(N) || N <- [M,S,U]]));
-
-us(MonoT) ->
- integer_to_list(MonoT).
+ try erlang:unique_integer() of
+ N ->
+ integer_to_list(N)
+ catch
+ error: undef -> %% OTP < 18
+ {M,S,U} = timestamp(),
+ tl(lists:append(["-" ++ integer_to_list(N) || N <- [M,S,U]]))
+ end.
%% ---------------------------------------------------------------------------
%% have_sctp/0
diff --git a/lib/diameter/test/diameter_watchdog_SUITE.erl b/lib/diameter/test/diameter_watchdog_SUITE.erl
index 5a3ff2c92f..f39e12686e 100644
--- a/lib/diameter/test/diameter_watchdog_SUITE.erl
+++ b/lib/diameter/test/diameter_watchdog_SUITE.erl
@@ -673,8 +673,7 @@ jitter(T,D) ->
%% Generate a unique hostname for the faked peer.
hostname() ->
- {M,S,U} = diameter_util:timestamp(),
- lists:flatten(io_lib:format("~p-~p-~p", [M,S,U])).
+ ?util:unique_string().
putr(Key, Val) ->
put({?MODULE, Key}, Val).