From f410de690d86bd4cbc9ffd42ad6a948324a12014 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Tue, 13 Sep 2022 16:22:16 +0200 Subject: [PATCH] remove log output checks the intention of this test is testing whether borg check returns an error when checking a corrupted repository. the removed assertions were rather testing the test logging configuration, which seems flaky: - when running all tests, assertions failed - when running only this one test, assertions succeeded - assertions also succeeded when running all the tests before they were refactored to separate test modules, although the test code was not changed, just moved. --- src/borg/testsuite/archiver/corruption.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/borg/testsuite/archiver/corruption.py b/src/borg/testsuite/archiver/corruption.py index 1d490d921..3ee429992 100644 --- a/src/borg/testsuite/archiver/corruption.py +++ b/src/borg/testsuite/archiver/corruption.py @@ -12,20 +12,18 @@ from . import ArchiverTestCaseBase, RK_ENCRYPTION class ArchiverTestCase(ArchiverTestCaseBase): - def test_corrupted_repository(self): + def test_check_corrupted_repository(self): self.cmd(f"--repo={self.repository_location}", "rcreate", RK_ENCRYPTION) self.create_src_archive("test") self.cmd(f"--repo={self.repository_location}", "extract", "test", "--dry-run") - output = self.cmd(f"--repo={self.repository_location}", "check", "--show-version") - self.assert_in("borgbackup version", output) # implied output even without --info given - self.assert_not_in("Starting repository check", output) # --info not given for root logger + self.cmd(f"--repo={self.repository_location}", "check") name = sorted(os.listdir(os.path.join(self.tmpdir, "repository", "data", "0")), reverse=True)[1] with open(os.path.join(self.tmpdir, "repository", "data", "0", name), "r+b") as fd: fd.seek(100) fd.write(b"XXXX") - output = self.cmd(f"--repo={self.repository_location}", "check", "--info", exit_code=1) - self.assert_in("Starting repository check", output) # --info given for root logger + + self.cmd(f"--repo={self.repository_location}", "check", exit_code=1) class ArchiverCorruptionTestCase(ArchiverTestCaseBase):