You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2021/11/26 17:04:25 UTC
[couchdb-erlfdb] branch avoid-reserved-keys-in-tests created (now 53e7a71)
This is an automated email from the ASF dual-hosted git repository.
kocolosk pushed a change to branch avoid-reserved-keys-in-tests
in repository https://gitbox.apache.org/repos/asf/couchdb-erlfdb.git.
at 53e7a71 Avoid reserved keys in tests
This branch includes the following new commits:
new 53e7a71 Avoid reserved keys in tests
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[couchdb-erlfdb] 01/01: Avoid reserved keys in tests
Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kocolosk pushed a commit to branch avoid-reserved-keys-in-tests
in repository https://gitbox.apache.org/repos/asf/couchdb-erlfdb.git
commit 53e7a71d70ad3ba645ef906429a5375cfe6ea65e
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Fri Nov 26 12:01:01 2021 -0500
Avoid reserved keys in tests
Prefix keys with a 0 byte to avoid the /xFF space. I suppose we could
apply this same treatment for keys and values as is being done elsewhere
in the test suite, but there's no such restriction on value encoding,
and I think it's sometimes helpful to reinforce the idea that keys have
special requirements that do not carry over to values.
Closes #46
---
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>>.