From e401d674b90db71eec64e75ae0d097ead78a04e2 Mon Sep 17 00:00:00 2001 From: Andrey Bienkowski Date: Thu, 27 Jan 2022 20:18:45 +0300 Subject: [PATCH 1/2] Refactor: move a test to ArchiverTestCase Fixes #6168 --- src/borg/testsuite/archiver.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index c617522c3..a21d1db4f 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -3499,6 +3499,13 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 with patch.object(xattr, 'setxattr', patched_setxattr_EACCES): self.cmd('extract', self.repository_location + '::test', exit_code=EXIT_WARNING) + def test_do_not_mention_archive_if_you_can_not_find_repo(self): + """https://github.com/borgbackup/borg/issues/6014""" + archive = self.repository_location + '-this-repository-does-not-exist' + '::test' + output = self.cmd('info', archive, exit_code=2, fork=True) + self.assert_in('this-repository-does-not-exist', output) + self.assert_not_in('this-repository-does-not-exist::test', output) + @unittest.skipUnless('binary' in BORG_EXES, 'no borg.exe available') class ArchiverTestCaseBinary(ArchiverTestCase): @@ -3932,13 +3939,6 @@ class RemoteArchiverTestCase(ArchiverTestCase): res = self.cmd('extract', "--debug", self.repository_location + '::test', '--strip-components', '0') self.assert_true(marker not in res) - def test_do_not_mention_archive_if_you_can_not_find_repo(self): - """https://github.com/borgbackup/borg/issues/6014""" - archive = self.repository_location + '-this-repository-does-not-exist' + '::test' - output = self.cmd('info', archive, exit_code=2, fork=True) - self.assert_in('this-repository-does-not-exist', output) - self.assert_not_in('this-repository-does-not-exist::test', output) - class ArchiverCorruptionTestCase(ArchiverTestCaseBase): def setUp(self): From 6a5d24650f067120f6b82a0b8fd4438e6a7a6395 Mon Sep 17 00:00:00 2001 From: Andrey Bienkowski Date: Thu, 27 Jan 2022 23:03:15 +0300 Subject: [PATCH 2/2] Refactor: improve a test name https://github.com/borgbackup/borg/pull/6186#issuecomment-1023504905 > could you rename the strip test a little, so that there is > ..._remote_repo in the test name. if one does not fully read the test > (like me), one would assume that a strip-related test also applies to > local repos, but in this case, the condition checked only applies to > remote repos. --- src/borg/testsuite/archiver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index a21d1db4f..b4ace5a93 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -3917,7 +3917,7 @@ class RemoteArchiverTestCase(ArchiverTestCase): def test_migrate_lock_alive(self): pass - def test_strip_components_doesnt_leak(self): + def test_remote_repo_strip_components_doesnt_leak(self): self.cmd('init', '--encryption=repokey', self.repository_location) self.create_regular_file('dir/file', contents=b"test file contents 1") self.create_regular_file('dir/file2', contents=b"test file contents 2")