1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-19 04:41:50 +00:00

testsuite: hashindex: test compact -> merge

This commit is contained in:
Marian Beermann 2017-06-09 10:57:58 +02:00
parent 1379af22de
commit 295ac86d71

View file

@ -162,22 +162,6 @@ def test_chunk_indexer(self):
# the index should now be empty
assert list(index.iteritems()) == []
def test_vacuum(self):
idx1 = ChunkIndex()
idx1[H(1)] = 1, 100, 100
idx1[H(2)] = 2, 200, 200
idx1[H(3)] = 3, 300, 300
idx1.compact()
assert idx1.size() == 18 + 3 * (32 + 3 * 4)
#with self.assert_raises(KeyError):
# idx1[H(1)]
data = list(idx1.iteritems())
print(data)
assert (H(1), ChunkIndexEntry(1, 100, 100)) in data
assert (H(2), ChunkIndexEntry(2, 200, 200)) in data
assert (H(3), ChunkIndexEntry(3, 300, 300)) in data
class HashIndexSizeTestCase(BaseTestCase):
def test_size_on_disk(self):
@ -487,6 +471,20 @@ def test_empty(self):
self.index(num_entries=0, num_buckets=0)
assert compact_index == self.index_data.getvalue()
def test_merge(self):
master = ChunkIndex()
idx1 = ChunkIndex()
idx1[H(1)] = 1, 100, 100
idx1[H(2)] = 2, 200, 200
idx1[H(3)] = 3, 300, 300
idx1.compact()
assert idx1.size() == 18 + 3 * (32 + 3 * 4)
master.merge(idx1)
assert master[H(1)] == (1, 100, 100)
assert master[H(2)] == (2, 200, 200)
assert master[H(3)] == (3, 300, 300)
class NSIndexTestCase(BaseTestCase):
def test_nsindex_segment_limit(self):