diff options
author | Eric Avdey <eiri@eiri.ca> | 2018-01-04 12:56:43 -0400 |
---|---|---|
committer | Eric Avdey <eiri@eiri.ca> | 2018-01-04 13:02:24 -0400 |
commit | f3ecd13c08de71a39074b6e579e46f5195c4817a (patch) | |
tree | bf9348f59fefcb08e71c45d189ae0c61e12b27de | |
parent | f71daa20d4b5d521a59290363293dfa2b18802f0 (diff) | |
download | couchdb-f3ecd13c08de71a39074b6e579e46f5195c4817a.tar.gz |
Use uuid in tmp db names in unit testsuse-uuid-in-eunit-dbnames
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.
-rw-r--r-- | src/couch/include/couch_eunit.hrl | 11 |
1 files 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() -> |