This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-erlfdb.git


The following commit(s) were added to refs/heads/main by this push:
     new 74a31ce  Avoid reserved keys in tests (#48)
74a31ce is described below

commit 74a31ce5a14be60b5cd2062da771deff71a06599
Author: Adam Kocoloski <[email protected]>
AuthorDate: Fri Nov 26 15:44:29 2021 -0500

    Avoid reserved keys in tests (#48)
---
 test/erlfdb_02_anon_fdbserver_test.erl | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/test/erlfdb_02_anon_fdbserver_test.erl 
b/test/erlfdb_02_anon_fdbserver_test.erl
index 209cf53..ebfd020 100644
--- a/test/erlfdb_02_anon_fdbserver_test.erl
+++ b/test/erlfdb_02_anon_fdbserver_test.erl
@@ -33,7 +33,7 @@ get_db_test() ->
 
 get_set_get_test() ->
     Db = erlfdb_util:get_test_db(),
-    Key = crypto:strong_rand_bytes(8),
+    Key = gen_key(8),
     Val = crypto:strong_rand_bytes(8),
     erlfdb:transactional(Db, fun(Tx) ->
         ?assertEqual(not_found, erlfdb:wait(erlfdb:get(Tx, Key)))
@@ -47,7 +47,7 @@ get_set_get_test() ->
 
 get_empty_test() ->
     Db1 = erlfdb_util:get_test_db(),
-    Key = crypto:strong_rand_bytes(8),
+    Key = gen_key(8),
     Val = crypto:strong_rand_bytes(8),
     erlfdb:transactional(Db1, fun(Tx) ->
         ok = erlfdb:set(Tx, Key, Val)
@@ -67,3 +67,7 @@ get_empty_test() ->
     erlfdb:transactional(Db1, fun(Tx) ->
         ?assertEqual(not_found, erlfdb:wait(erlfdb:get(Tx, Key)))
     end).
+
+gen_key(Size) when is_integer(Size), Size > 1 ->
+    RandBin = crypto:strong_rand_bytes(Size - 1),
+    <<0, RandBin/binary>>.

Reply via email to