From aa77957f6831e9b70a1876c779f5192de2a79c42 Mon Sep 17 00:00:00 2001 From: Andrey Bienkowski Date: Sat, 22 Jan 2022 20:53:17 +0000 Subject: [PATCH] Add test for: info: emit repo info even if repo has 0 archives (#6155) add test for: info: emit repo info even if repo has 0 archives In https://github.com/borgbackup/borg/pull/6152 it has been neglected to add a regression test for the bug that has been fixed. This is the test. --- src/borg/testsuite/archiver.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index cbd465d07..c617522c3 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -1538,6 +1538,14 @@ class ArchiverTestCase(ArchiverTestCaseBase): assert datetime.strptime(archive['start'], ISO_FORMAT) assert datetime.strptime(archive['end'], ISO_FORMAT) + def test_info_json_of_empty_archive(self): + """See https://github.com/borgbackup/borg/issues/6120""" + self.cmd('init', '--encryption=repokey', self.repository_location) + info_repo = json.loads(self.cmd('info', '--json', '--first=1', self.repository_location)) + assert info_repo["archives"] == [] + info_repo = json.loads(self.cmd('info', '--json', '--last=1', self.repository_location)) + assert info_repo["archives"] == [] + def test_comment(self): self.create_regular_file('file1', size=1024 * 80) self.cmd('init', '--encryption=repokey', self.repository_location)