test: sealed_file_wrong_size_is_an_error_test fails 1 run in 256 (a random key ending in a newline is read as 19 bytes) #13
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Purpose (test fix):
sealed_file_wrong_size_is_an_error_testpasses on every run, not on 255 runs in 256.Found on reckon-db#11's PR run 6740 (job 27542, commit
46222e0). The same commit's push run, 6741, was green. eunit reported 1 failure in 712:Cause: the test writes
crypto:strong_rand_bytes(20)as the sealed file (test/unit/reckon_db_integrity_key_tests.erl:196). The loader strips one trailing newline (strip_trailing_newline/1,src/reckon_db_integrity_key.erl:212), so when the last random byte is\n(1 in 256) the key reads back as 19 bytes. The loader is right: a sealed file written withechoends in a newline. The test's input is wrong.Done when
\n. For example, 20 fixed bytes, or random bytes with the last byte forced to a non-newline, still asserting{integrity_key_invalid_size, 20}.