From fcf08106ee3f9dd2267adac4d216bf0bd568a916 Mon Sep 17 00:00:00 2001 From: TW Date: Mon, 1 Jun 2020 16:36:40 +0200 Subject: [PATCH] test_delete_force: avoid sporadic test setup issues (#5203) the old test stumbled over files with an empty chunks list, so I guess just having some empty file in src/borg could make that test fail. fixed this by deleting a chunk of some specific file (we use this file / this construction at misc. other places in the archiver tests). --- src/borg/testsuite/archiver.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index 348a46ab2..f62dff447 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -1496,11 +1496,12 @@ class ArchiverTestCase(ArchiverTestCaseBase): manifest, key = Manifest.load(repository, Manifest.NO_OPERATION_CHECK) archive = Archive(repository, key, manifest, 'test') for item in archive.iter_items(): - if 'chunks' in item: - first_chunk_id = item.chunks[0].id - repository.delete(first_chunk_id) - repository.commit() + if item.path.endswith('testsuite/archiver.py'): + repository.delete(item.chunks[-1].id) break + else: + assert False # missed the file + repository.commit() output = self.cmd('delete', '--force', self.repository_location + '::test') self.assert_in('deleted archive was corrupted', output) self.cmd('check', '--repair', self.repository_location)