From f3ecd13c08de71a39074b6e579e46f5195c4817a Mon Sep 17 00:00:00 2001 From: Eric Avdey Date: Thu, 4 Jan 2018 12:56:43 -0400 Subject: Use uuid in tmp db names in unit tests This changes naming of temporary eunit databases and files from using unique_monotonic_integer to couch_uuids:random to remove performance penalty and normalize naming across erlang releases. Also getting rid of unnecessary inter-types convertion. --- src/couch/include/couch_eunit.hrl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/couch/include/couch_eunit.hrl b/src/couch/include/couch_eunit.hrl index 8eb763aff..f4617e1d3 100644 --- a/src/couch/include/couch_eunit.hrl +++ b/src/couch/include/couch_eunit.hrl @@ -40,17 +40,14 @@ -define(tempfile, fun() -> - A = integer_to_list(couch_util:unique_monotonic_integer()), - N = node(), - FileName = lists:flatten(io_lib:format("~p-~s", [N, A])), + Suffix = couch_uuids:random(), + FileName = io_lib:format("~p-~s", [node(), Suffix]), filename:join([?TEMPDIR, FileName]) end). -define(tempdb, fun() -> - Nums = integer_to_list(couch_util:unique_monotonic_integer()), - Prefix = "eunit-test-db", - Suffix = lists:concat([integer_to_list(Num) || Num <- Nums]), - list_to_binary(Prefix ++ "-" ++ Suffix) + Suffix = couch_uuids:random(), + iolist_to_binary(["eunit-test-db-", Suffix]) end). -define(docid, fun() -> -- cgit v1.2.1