fix test_recreate_rechunkify

We can not use unique_chunks counter with NewCache,
thus we use a simpler (and weaker) assertion.
This commit is contained in:
Thomas Waldmann 2024-06-01 14:27:42 +02:00
parent e3a0c4f375
commit fbfa7cf7bf
No known key found for this signature in database
GPG Key ID: 243ACFA951F78E01
1 changed files with 10 additions and 7 deletions

View File

@ -153,15 +153,18 @@ def test_recreate_rechunkify(archivers, request):
cmd(archiver, "rcreate", RK_ENCRYPTION)
cmd(archiver, "create", "test1", "input", "--chunker-params", "7,9,8,128")
cmd(archiver, "create", "test2", "input", "--files-cache=disabled")
chunks_list = cmd(archiver, "list", "test1", "input/large_file", "--format", "{num_chunks} {unique_chunks}")
num_chunks, unique_chunks = map(int, chunks_list.split(" "))
# test1 and test2 do not deduplicate
assert num_chunks == unique_chunks
num_chunks1 = int(cmd(archiver, "list", "test1", "input/large_file", "--format", "{num_chunks}"))
num_chunks2 = int(cmd(archiver, "list", "test2", "input/large_file", "--format", "{num_chunks}"))
# right now, the file is chunked differently
assert num_chunks1 != num_chunks2
cmd(archiver, "recreate", "--chunker-params", "default")
check_cache(archiver)
# test1 and test2 do deduplicate after recreate
assert int(cmd(archiver, "list", "test1", "input/large_file", "--format={size}"))
assert not int(cmd(archiver, "list", "test1", "input/large_file", "--format", "{unique_chunks}"))
num_chunks1 = int(cmd(archiver, "list", "test1", "input/large_file", "--format", "{num_chunks}"))
num_chunks2 = int(cmd(archiver, "list", "test2", "input/large_file", "--format", "{num_chunks}"))
# now the files are chunked in the same way
# TODO: this is a rather weak test, it could be improved by comparing the IDs in the chunk lists,
# to make sure that everything is completely deduplicated now (both files have identical chunks).
assert num_chunks1 == num_chunks2
def test_recreate_fixed_rechunkify(archivers, request):