mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-01 12:45:34 +00:00
Add a negative test for import-tar --ignore-zeros
This commit is contained in:
parent
3c941ae604
commit
8071ef6280
1 changed files with 31 additions and 1 deletions
|
@ -144,7 +144,7 @@ def test_import_tar_gz(self, tar_format="GNU"):
|
|||
self.assert_dirs_equal("input", "output/input", ignore_ns=True, ignore_xattrs=True)
|
||||
|
||||
@requires_gnutar
|
||||
def test_import_tar_with_ignore_zeros(self):
|
||||
def test_import_concatenated_tar_with_ignore_zeros(self):
|
||||
self.create_test_files(create_hardlinks=False) # hardlinks become separate files
|
||||
os.unlink("input/flagfile")
|
||||
with changedir("input"):
|
||||
|
@ -170,6 +170,36 @@ def test_import_tar_with_ignore_zeros(self):
|
|||
self.cmd(f"--repo={self.repository_location}", "extract", "dst")
|
||||
self.assert_dirs_equal("input", "output", ignore_ns=True, ignore_xattrs=True)
|
||||
|
||||
@requires_gnutar
|
||||
def test_import_concatenated_tar_without_ignore_zeros(self):
|
||||
self.create_test_files(create_hardlinks=False) # hardlinks become separate files
|
||||
os.unlink("input/flagfile")
|
||||
with changedir("input"):
|
||||
subprocess.check_call(["tar", "cf", "file1.tar", "file1"])
|
||||
subprocess.check_call(["tar", "cf", "the_rest.tar", "--exclude", "file1*", "."])
|
||||
with open("concatenated.tar", "wb") as concatenated:
|
||||
with open("file1.tar", "rb") as file1:
|
||||
concatenated.write(file1.read())
|
||||
# Clean up for assert_dirs_equal.
|
||||
os.unlink("file1.tar")
|
||||
|
||||
with open("the_rest.tar", "rb") as the_rest:
|
||||
concatenated.write(the_rest.read())
|
||||
# Clean up for assert_dirs_equal.
|
||||
os.unlink("the_rest.tar")
|
||||
|
||||
self.cmd(f"--repo={self.repository_location}", "rcreate", "--encryption=none")
|
||||
self.cmd(f"--repo={self.repository_location}", "import-tar", "dst", "input/concatenated.tar")
|
||||
# Clean up for assert_dirs_equal.
|
||||
os.unlink("input/concatenated.tar")
|
||||
|
||||
with changedir(self.output_path):
|
||||
self.cmd(f"--repo={self.repository_location}", "extract", "dst")
|
||||
|
||||
# Negative test -- assert that only file1 has been extracted, and the_rest has been ignored
|
||||
# due to zero-filled block marker.
|
||||
self.assert_equal(os.listdir("output"), ["file1"])
|
||||
|
||||
def test_roundtrip_pax_borg(self):
|
||||
self.create_test_files()
|
||||
self.cmd(f"--repo={self.repository_location}", "rcreate", "--encryption=none")
|
||||
|
|
Loading…
Reference in a new issue