From 3fd5b73e1e89f8b1d1a4f22cd910f2f3e9e81ca2 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Mon, 20 Jun 2022 15:31:26 +0200 Subject: [PATCH] borg create NAME ... --- src/borg/archiver.py | 16 +- src/borg/testsuite/archiver.py | 438 ++++++++++++++++---------------- src/borg/testsuite/benchmark.py | 6 +- 3 files changed, 230 insertions(+), 230 deletions(-) diff --git a/src/borg/archiver.py b/src/borg/archiver.py index a12034e3c..1daf2a91c 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -671,20 +671,20 @@ class Archiver: compression = '--compression=none' # measure create perf (without files cache to always have it chunking) t_start = time.monotonic() - rc = self.do_create(self.parse_args([f'--repo={repo}', 'create', '--name=borg-benchmark-crud1', - compression, '--files-cache=disabled', path])) + rc = self.do_create(self.parse_args([f'--repo={repo}', 'create', compression, '--files-cache=disabled', + 'borg-benchmark-crud1', path])) t_end = time.monotonic() dt_create = t_end - t_start assert rc == 0 # now build files cache - rc1 = self.do_create(self.parse_args([f'--repo={repo}', 'create', '--name=borg-benchmark-crud2', - compression, path])) + rc1 = self.do_create(self.parse_args([f'--repo={repo}', 'create', compression, + 'borg-benchmark-crud2', path])) rc2 = self.do_delete(self.parse_args([f'--repo={repo}', 'delete', '--name=borg-benchmark-crud2'])) assert rc1 == rc2 == 0 # measure a no-change update (archive1 is still present) t_start = time.monotonic() - rc1 = self.do_create(self.parse_args([f'--repo={repo}', 'create', '--name=borg-benchmark-crud3', - compression, path])) + rc1 = self.do_create(self.parse_args([f'--repo={repo}', 'create', compression, + 'borg-benchmark-crud3', path])) t_end = time.monotonic() dt_update = t_end - t_start rc2 = self.do_delete(self.parse_args([f'--repo={repo}', 'delete', '--name=borg-benchmark-crud3'])) @@ -3899,8 +3899,6 @@ class Archiver: 'regular files. Also follows symlinks pointing to these kinds of files.') archive_group = subparser.add_argument_group('Archive options') - archive_group.add_argument('--name', dest='name', metavar='NAME', type=NameSpec, default='{hostname}-{now}', - help='specify the archive name') archive_group.add_argument('--comment', dest='comment', metavar='COMMENT', type=CommentSpec, default='', help='add a comment text to the archive') archive_group.add_argument('--timestamp', metavar='TIMESTAMP', dest='timestamp', @@ -3919,6 +3917,8 @@ class Archiver: help='select compression algorithm, see the output of the ' '"borg help compression" command for details.') + subparser.add_argument('name', metavar='NAME', type=NameSpec, + help='specify the archive name') subparser.add_argument('paths', metavar='PATH', nargs='*', type=str, help='paths to archive') diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index 918e8f089..48f682f23 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -149,14 +149,14 @@ def test_return_codes(cmd, tmpdir): input.join('test_file').write('content') rc, out = cmd('--repo=%s' % str(repo), 'init', '--encryption=none') assert rc == EXIT_SUCCESS - rc, out = cmd('--repo=%s' % repo, 'create', '--name=archive', str(input)) + rc, out = cmd('--repo=%s' % repo, 'create', 'archive', str(input)) assert rc == EXIT_SUCCESS with changedir(str(output)): rc, out = cmd('--repo=%s' % repo, 'extract', '--name=archive') assert rc == EXIT_SUCCESS rc, out = cmd('--repo=%s' % repo, 'extract', '--name=archive', 'does/not/match') assert rc == EXIT_WARNING # pattern did not match - rc, out = cmd('--repo=%s' % repo, 'create', '--name=archive', str(input)) + rc, out = cmd('--repo=%s' % repo, 'create', 'archive', str(input)) assert rc == EXIT_ERROR # duplicate archive name @@ -219,7 +219,7 @@ def test_disk_full(cmd): break raise try: - rc, out = cmd('--repo=%s' % repo, 'create', '--name=test%03d' % i, input) + rc, out = cmd('--repo=%s' % repo, 'create', 'test%03d' % i, input) success = rc == EXIT_SUCCESS if not success: print('create', rc, out) @@ -299,7 +299,7 @@ class ArchiverTestCaseBase(BaseTestCase): return output def create_src_archive(self, name): - self.cmd(f'--repo={self.repository_location}', 'create', f'--name={name}', '--compression=lz4', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', '--compression=lz4', name, src_dir) def open_archive(self, name): repository = Repository(self.repository_path, exclusive=True) @@ -394,8 +394,8 @@ class ArchiverTestCase(ArchiverTestCaseBase): output = self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey', '--show-version', '--show-rc', fork=True) self.assert_in('borgbackup version', output) self.assert_in('terminating with success status, rc 0', output) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--exclude-nodump', 'input') - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test.2', '--exclude-nodump', '--stats', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', '--exclude-nodump', 'test', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', '--exclude-nodump', '--stats', 'test.2', 'input') self.assert_in('Archive name: test.2', output) self.assert_in('This archive: ', output) with changedir('output'): @@ -463,7 +463,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file(hl_a, contents=b'123456') os.link(hl_a, hl_b) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=none') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input', 'input') # give input twice! + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input', 'input') # give input twice! # test if created archive has 'input' contents twice: archive_list = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test', '--json-lines') paths = [json.loads(line)['path'] for line in archive_list.split('\n') if line] @@ -491,7 +491,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): pytest.skip('unix sockets disabled or not supported') elif err.errno == errno.EACCES: pytest.skip('permission denied to create unix sockets') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') sock.close() with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test') @@ -501,7 +501,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_symlink_extract(self): self.create_test_files() self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test') assert os.readlink('input/link1') == 'somewhere' @@ -514,7 +514,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): os.symlink('target', 'symlink1') os.link('symlink1', 'symlink2', follow_symlinks=False) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with changedir('output'): output = self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test') print(output) @@ -548,7 +548,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): have_noatime = has_noatime('input/file1') os.utime('input/file1', (atime, mtime)) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--atime', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', '--atime', 'test', 'input') with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test') sti = os.stat('input/file1') @@ -568,7 +568,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): os.utime('input/file1', (atime, birthtime)) os.utime('input/file1', (atime, mtime)) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test') sti = os.stat('input/file1') @@ -584,7 +584,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): os.utime('input/file1', (atime, birthtime)) os.utime('input/file1', (atime, mtime)) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--nobirthtime', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input', '--nobirthtime') with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test') sti = os.stat('input/file1') @@ -645,7 +645,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): # we could create a sparse input file, so creating a backup of it and # extracting it again (as sparse) should also work: self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with changedir(self.output_path): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test', '--sparse') self.assert_dirs_equal('input', 'output/input') @@ -664,7 +664,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): with open(filename, 'wb'): pass self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') for filename in filenames: with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test', os.path.join('input', filename)) @@ -675,70 +675,70 @@ class ArchiverTestCase(ArchiverTestCaseBase): os.environ['BORG_PASSPHRASE'] = 'passphrase' self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') repository_id = self._extract_repository_id(self.repository_path) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') shutil.rmtree(self.repository_path) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=none') self._set_repository_id(self.repository_path, repository_id) self.assert_equal(repository_id, self._extract_repository_id(self.repository_path)) if self.FORK_DEFAULT: - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test.2', 'input', exit_code=EXIT_ERROR) + self.cmd(f'--repo={self.repository_location}', 'create', 'test.2', 'input', exit_code=EXIT_ERROR) else: with pytest.raises(Cache.EncryptionMethodMismatch): - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test.2', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test.2', 'input') def test_repository_swap_detection2(self): self.create_test_files() self.cmd(f'--repo={self.repository_location}_unencrypted', 'init', '--encryption=none') os.environ['BORG_PASSPHRASE'] = 'passphrase' self.cmd(f'--repo={self.repository_location}_encrypted', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}_encrypted', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}_encrypted', 'create', 'test', 'input') shutil.rmtree(self.repository_path + '_encrypted') os.rename(self.repository_path + '_unencrypted', self.repository_path + '_encrypted') if self.FORK_DEFAULT: - self.cmd(f'--repo={self.repository_location}_encrypted', 'create', '--name=test.2', 'input', exit_code=EXIT_ERROR) + self.cmd(f'--repo={self.repository_location}_encrypted', 'create', 'test.2', 'input', exit_code=EXIT_ERROR) else: with pytest.raises(Cache.RepositoryAccessAborted): - self.cmd(f'--repo={self.repository_location}_encrypted', 'create', '--name=test.2', 'input') + self.cmd(f'--repo={self.repository_location}_encrypted', 'create', 'test.2', 'input') def test_repository_swap_detection_no_cache(self): self.create_test_files() os.environ['BORG_PASSPHRASE'] = 'passphrase' self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') repository_id = self._extract_repository_id(self.repository_path) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') shutil.rmtree(self.repository_path) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=none') self._set_repository_id(self.repository_path, repository_id) self.assert_equal(repository_id, self._extract_repository_id(self.repository_path)) self.cmd(f'--repo={self.repository_location}', 'delete', '--cache-only') if self.FORK_DEFAULT: - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test.2', 'input', exit_code=EXIT_ERROR) + self.cmd(f'--repo={self.repository_location}', 'create', 'test.2', 'input', exit_code=EXIT_ERROR) else: with pytest.raises(Cache.EncryptionMethodMismatch): - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test.2', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test.2', 'input') def test_repository_swap_detection2_no_cache(self): self.create_test_files() self.cmd(f'--repo={self.repository_location}_unencrypted', 'init', '--encryption=none') os.environ['BORG_PASSPHRASE'] = 'passphrase' self.cmd(f'--repo={self.repository_location}_encrypted', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}_encrypted', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}_encrypted', 'create', 'test', 'input') self.cmd(f'--repo={self.repository_location}_unencrypted', 'delete', '--cache-only') self.cmd(f'--repo={self.repository_location}_encrypted', 'delete', '--cache-only') shutil.rmtree(self.repository_path + '_encrypted') os.rename(self.repository_path + '_unencrypted', self.repository_path + '_encrypted') if self.FORK_DEFAULT: - self.cmd(f'--repo={self.repository_location}_encrypted', 'create', '--name=test.2', 'input', exit_code=EXIT_ERROR) + self.cmd(f'--repo={self.repository_location}_encrypted', 'create', 'test.2', 'input', exit_code=EXIT_ERROR) else: with pytest.raises(Cache.RepositoryAccessAborted): - self.cmd(f'--repo={self.repository_location}_encrypted', 'create', '--name=test.2', 'input') + self.cmd(f'--repo={self.repository_location}_encrypted', 'create', 'test.2', 'input') def test_repository_swap_detection_repokey_blank_passphrase(self): # Check that a repokey repo with a blank passphrase is considered like a plaintext repo. self.create_test_files() # User initializes her repository with her passphrase self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') # Attacker replaces it with her own repository, which is encrypted but has no passphrase set shutil.rmtree(self.repository_path) with environment_variable(BORG_PASSPHRASE=''): @@ -751,10 +751,10 @@ class ArchiverTestCase(ArchiverTestCaseBase): # is set, while it isn't. Previously this raised no warning, # since the repository is, technically, encrypted. if self.FORK_DEFAULT: - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test.2', 'input', exit_code=EXIT_ERROR) + self.cmd(f'--repo={self.repository_location}', 'create', 'test.2', 'input', exit_code=EXIT_ERROR) else: with pytest.raises(Cache.CacheInitAbortedError): - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test.2', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test.2', 'input') def test_repository_move(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') @@ -805,7 +805,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_strip_components(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') self.create_regular_file('dir/file') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test', '--strip-components', '3') assert not os.path.exists('file') @@ -833,7 +833,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): os.path.join(self.input_path, 'dir1/aaaa')) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') @requires_hardlinks @unittest.skipUnless(llfuse, 'llfuse not installed') @@ -910,7 +910,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file(hl_a, contents=b'123456') os.link(hl_a, hl_b) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=none') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input', 'input') # give input twice! + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input', 'input') # give input twice! # now test extraction with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test') @@ -927,7 +927,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('file2', size=1024 * 80) self.create_regular_file('file3', size=1024 * 80) self.create_regular_file('file4', size=1024 * 80) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--exclude=input/file4', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', '--exclude=input/file4', 'test', 'input') with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test', 'input/file1', ) self.assert_equal(sorted(os.listdir('output/input')), ['file1']) @@ -947,7 +947,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('file333', size=1024 * 80) # Create with regular expression exclusion for file4 - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--exclude=re:input/file4$', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', '--exclude=re:input/file4$', 'test', 'input') with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test') self.assert_equal(sorted(os.listdir('output/input')), ['file1', 'file2', 'file3', 'file333']) @@ -985,7 +985,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): fd.write(b're:input/file4$\n') fd.write(b'fm:*aa:*thing\n') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--exclude-from=' + self.exclude_file_path, 'input') + self.cmd(f'--repo={self.repository_location}', 'create', '--exclude-from=' + self.exclude_file_path, 'test', 'input') with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test') self.assert_equal(sorted(os.listdir('output/input')), ['file1', 'file2', 'file3', 'file333']) @@ -1019,7 +1019,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file("file4", size=1024 * 80) self.create_regular_file("file333", size=1024 * 80) - self.cmd(f'--repo={self.repository_location}', "create", "--name=test", "input") + self.cmd(f'--repo={self.repository_location}', 'create', "test", "input") # Extract everything with regular expression with changedir("output"): @@ -1048,7 +1048,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') self.create_regular_file('file', size=1024 * 80) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with changedir('output'): output = self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test') @@ -1072,7 +1072,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_extract_progress(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') self.create_regular_file('file', size=1024 * 80) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with changedir('output'): output = self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test', '--progress') @@ -1095,7 +1095,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_create_stdin(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') input_data = b'\x00foo\n\nbar\n \n' - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '-', input=input_data) + self.cmd(f'--repo={self.repository_location}', 'create', 'test', '-', input=input_data) item = json.loads(self.cmd(f'--repo={self.repository_location}', 'list', '--name=test', '--json-lines')) assert item['uid'] == 0 assert item['gid'] == 0 @@ -1108,8 +1108,8 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') input_data = 'some test content' name = 'a/b/c' - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--stdin-name', name, '--content-from-command', - '--', 'echo', input_data) + self.cmd(f'--repo={self.repository_location}', 'create', '--stdin-name', name, '--content-from-command', + 'test', '--', 'echo', input_data) item = json.loads(self.cmd(f'--repo={self.repository_location}', 'list', '--name=test', '--json-lines')) assert item['uid'] == 0 assert item['gid'] == 0 @@ -1120,7 +1120,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_create_content_from_command_with_failed_command(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--content-from-command', + output = self.cmd(f'--repo={self.repository_location}', 'create', '--content-from-command', 'test', '--', 'sh', '-c', 'exit 73;', exit_code=2) assert output.endswith("Command 'sh' exited with status 73\n") archive_list = json.loads(self.cmd(f'--repo={self.repository_location}', 'list', '--json')) @@ -1128,7 +1128,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_create_content_from_command_missing_command(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--content-from-command', exit_code=2) + output = self.cmd(f'--repo={self.repository_location}', 'create', 'test', '--content-from-command', exit_code=2) assert output.endswith('No command given.\n') def test_create_paths_from_stdin(self): @@ -1139,7 +1139,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file("file4", size=1024 * 80) input_data = b'input/file1\0input/dir1\0input/file4' - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', + self.cmd(f'--repo={self.repository_location}', 'create', 'test', '--paths-from-stdin', '--paths-delimiter', '\\0', input=input_data) archive_list = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test', '--json-lines') paths = [json.loads(line)['path'] for line in archive_list.split('\n') if line] @@ -1153,7 +1153,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file("file4", size=1024 * 80) input_data = 'input/file1\ninput/file2\ninput/file3' - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--paths-from-command', + self.cmd(f'--repo={self.repository_location}', 'create', '--paths-from-command', 'test', '--', 'echo', input_data) archive_list = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test', '--json-lines') paths = [json.loads(line)['path'] for line in archive_list.split('\n') if line] @@ -1161,7 +1161,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_create_paths_from_command_with_failed_command(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--paths-from-command', + output = self.cmd(f'--repo={self.repository_location}', 'create', '--paths-from-command', 'test', '--', 'sh', '-c', 'exit 73;', exit_code=2) assert output.endswith("Command 'sh' exited with status 73\n") archive_list = json.loads(self.cmd(f'--repo={self.repository_location}', 'list', '--json')) @@ -1169,20 +1169,20 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_create_paths_from_command_missing_command(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--paths-from-command', exit_code=2) + output = self.cmd(f'--repo={self.repository_location}', 'create', 'test', '--paths-from-command', exit_code=2) assert output.endswith('No command given.\n') def test_create_without_root(self): """test create without a root""" self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', exit_code=2) + self.cmd(f'--repo={self.repository_location}', 'create', 'test', exit_code=2) def test_create_pattern_root(self): """test create with only a root pattern""" self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') self.create_regular_file('file1', size=1024 * 80) self.create_regular_file('file2', size=1024 * 80) - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '-v', '--list', '--pattern=R input') + output = self.cmd(f'--repo={self.repository_location}', 'create', 'test', '-v', '--list', '--pattern=R input') self.assert_in("A input/file1", output) self.assert_in("A input/file2", output) @@ -1192,9 +1192,9 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('file1', size=1024 * 80) self.create_regular_file('file2', size=1024 * 80) self.create_regular_file('file_important', size=1024 * 80) - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '-v', '--list', + output = self.cmd(f'--repo={self.repository_location}', 'create', '-v', '--list', '--pattern=+input/file_important', '--pattern=-input/file*', - 'input') + 'test', 'input') self.assert_in("A input/file_important", output) self.assert_in('x input/file1', output) self.assert_in('x input/file2', output) @@ -1206,9 +1206,9 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('file2', size=1024 * 80) self.create_regular_file('otherfile', size=1024 * 80) self.create_regular_file('file_important', size=1024 * 80) - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '-v', '--list', + output = self.cmd(f'--repo={self.repository_location}', 'create', '-v', '--list', '--pattern=-input/otherfile', '--patterns-from=' + self.patterns_file_path, - 'input') + 'test', 'input') self.assert_in("A input/file_important", output) self.assert_in('x input/file1', output) self.assert_in('x input/file2', output) @@ -1224,9 +1224,9 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('x/a/foo_a', size=1024 * 80) self.create_regular_file('x/b/foo_b', size=1024 * 80) self.create_regular_file('y/foo_y', size=1024 * 80) - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '-v', '--list', + output = self.cmd(f'--repo={self.repository_location}', 'create', '-v', '--list', '--patterns-from=' + self.patterns_file_path2, - 'input') + 'test', 'input') self.assert_in('x input/x/a/foo_a', output) self.assert_in("A input/x/b/foo_b", output) self.assert_in('A input/y/foo_y', output) @@ -1241,9 +1241,9 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('x/a/foo_a', size=1024 * 80) self.create_regular_file('x/b/foo_b', size=1024 * 80) self.create_regular_file('y/foo_y', size=1024 * 80) - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '-v', '--list', + output = self.cmd(f'--repo={self.repository_location}', 'create', '-v', '--list', '--patterns-from=' + self.patterns_file_path2, - 'input') + 'test', 'input') self.assert_not_in('input/x/a/foo_a', output) self.assert_not_in('input/x/a', output) self.assert_in('A input/y/foo_y', output) @@ -1259,8 +1259,8 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('x/a/foo_a', size=1024 * 80) self.create_regular_file('x/b/foo_b', size=1024 * 80) with changedir('input'): - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', - '--patterns-from=' + self.patterns_file_path2, '.') + self.cmd(f'--repo={self.repository_location}', 'create', '--patterns-from=' + self.patterns_file_path2, + 'test', '.') # list the archive and verify that the "intermediate" folders appear before # their contents @@ -1277,15 +1277,15 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_test_files() self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') self.cmd(f'--repo={self.repository_location}', 'delete', '--cache-only') - create_json = json.loads(self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', - '--no-cache-sync', 'input', - '--json', '--error')) # ignore experimental warning + create_json = json.loads(self.cmd(f'--repo={self.repository_location}', 'create', + '--no-cache-sync', '--json', '--error', + 'test', 'input')) # ignore experimental warning info_json = json.loads(self.cmd(f'--repo={self.repository_location}', 'info', '--name=test', '--json')) create_stats = create_json['cache']['stats'] info_stats = info_json['cache']['stats'] assert create_stats == info_stats self.cmd(f'--repo={self.repository_location}', 'delete', '--cache-only') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', '--no-cache-sync', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', '--no-cache-sync', 'test2', 'input') self.cmd(f'--repo={self.repository_location}', 'info') self.cmd(f'--repo={self.repository_location}', 'check') @@ -1294,7 +1294,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('file1', size=1024 * 80) self.create_regular_file('file2', size=1024 * 80) self.create_regular_file('file_important', size=1024 * 80) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test', '--pattern=+input/file_important', '--pattern=-input/file*') @@ -1308,12 +1308,12 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_exclude_caches(self): self._create_test_caches() - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--exclude-caches', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input', '--exclude-caches') self._assert_test_caches() def test_recreate_exclude_caches(self): self._create_test_caches() - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') self.cmd(f'--repo={self.repository_location}', 'recreate', '--name=test', '--exclude-caches') self._assert_test_caches() @@ -1331,13 +1331,13 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_exclude_tagged(self): self._create_test_tagged() - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--exclude-if-present', '.NOBACKUP', - '--exclude-if-present', '00-NOBACKUP', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input', + '--exclude-if-present', '.NOBACKUP', '--exclude-if-present', '00-NOBACKUP') self._assert_test_tagged() def test_recreate_exclude_tagged(self): self._create_test_tagged() - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') self.cmd(f'--repo={self.repository_location}', 'recreate', '--name=test', '--exclude-if-present', '.NOBACKUP', '--exclude-if-present', '00-NOBACKUP') self._assert_test_tagged() @@ -1370,13 +1370,13 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_exclude_keep_tagged(self): self._create_test_keep_tagged() - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--exclude-if-present', '.NOBACKUP1', - '--exclude-if-present', '.NOBACKUP2', '--exclude-caches', '--keep-exclude-tags', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input', '--exclude-if-present', '.NOBACKUP1', + '--exclude-if-present', '.NOBACKUP2', '--exclude-caches', '--keep-exclude-tags') self._assert_test_keep_tagged() def test_recreate_exclude_keep_tagged(self): self._create_test_keep_tagged() - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') self.cmd(f'--repo={self.repository_location}', 'recreate', '--name=test', '--exclude-if-present', '.NOBACKUP1', '--exclude-if-present', '.NOBACKUP2', '--exclude-caches', '--keep-exclude-tags') self._assert_test_keep_tagged() @@ -1388,7 +1388,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): os.mkdir(os.path.join(self.input_path, 'subdir')) # to make sure the tag is encountered *after* file1 os.link(os.path.join(self.input_path, 'file1'), os.path.join(self.input_path, 'subdir', CACHE_TAG_NAME)) # correct tag name, hardlink to file1 - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') # in the "test" archive, we now have, in this order: # - a regular file item for "file1" # - a hardlink item for "CACHEDIR.TAG" referring back to file1 for its contents @@ -1410,7 +1410,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('file') xattr.setxattr(b'input/file', b'security.capability', capabilities) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with changedir('output'): with patch.object(os, 'fchown', patched_fchown): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test') @@ -1431,7 +1431,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('file') xattr.setxattr(b'input/file', b'user.attribute', b'value') self.cmd(f'--repo={self.repository_location}', 'init', '-e' 'none') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with changedir('output'): input_abspath = os.path.abspath('input/file') with patch.object(xattr, 'setxattr', patched_setxattr_E2BIG): @@ -1451,7 +1451,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') self.create_regular_file('dir1/dir2/file', size=1024 * 80) with changedir('input/dir1/dir2'): - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', + self.cmd(f'--repo={self.repository_location}', 'create', 'test', '../../../input/dir1/../dir1/dir2/..') output = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test') self.assert_not_in('..', output) @@ -1462,16 +1462,16 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('file1', size=1024 * 80) self.create_regular_file('file2', size=1024 * 80) with changedir('input'): - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', '--exclude=file1', '.') + self.cmd(f'--repo={self.repository_location}', 'create', 'test1', '.', '--exclude=file1') with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test1') self.assert_equal(sorted(os.listdir('output')), ['file2']) with changedir('input'): - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', '--exclude=./file1', '.') + self.cmd(f'--repo={self.repository_location}', 'create', 'test2', '.', '--exclude=./file1') with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test2') self.assert_equal(sorted(os.listdir('output')), ['file2']) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test3', '--exclude=input/./file1', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test3', 'input', '--exclude=input/./file1') with changedir('output'): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test3') self.assert_equal(sorted(os.listdir('output/input')), ['file2']) @@ -1479,13 +1479,13 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_repeated_files(self): self.create_regular_file('file1', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input', 'input') def test_overwrite(self): self.create_regular_file('file1', size=1024 * 80) self.create_regular_file('dir2/file2', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') # Overwriting regular files and directories should be supported os.mkdir('output/input') os.mkdir('output/input/file1') @@ -1504,8 +1504,8 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('file1', size=1024 * 80) self.create_regular_file('dir2/file2', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test.2', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test.2', 'input') self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test', '--dry-run') self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test.2', '--dry-run') self.cmd(f'--repo={self.repository_location}', 'rename', 'test', 'test.3') @@ -1523,7 +1523,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_info(self): self.create_regular_file('file1', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') info_repo = self.cmd(f'--repo={self.repository_location}', 'info') assert 'All archives:' in info_repo info_archive = self.cmd(f'--repo={self.repository_location}', 'info', '--name=test') @@ -1534,7 +1534,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_info_json(self): self.create_regular_file('file1', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') info_repo = json.loads(self.cmd(f'--repo={self.repository_location}', 'info', '--json')) repository = info_repo['repository'] assert len(repository['id']) == 64 @@ -1572,10 +1572,10 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_comment(self): self.create_regular_file('file1', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', 'input') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', '--comment', 'this is the comment', 'input') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test3', '--comment', '"deleted" comment', 'input') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test4', '--comment', 'preserved comment', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test1', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test2', 'input', '--comment', 'this is the comment') + self.cmd(f'--repo={self.repository_location}', 'create', 'test3', 'input', '--comment', '"deleted" comment') + self.cmd(f'--repo={self.repository_location}', 'create', 'test4', 'input', '--comment', 'preserved comment') assert 'Comment: \n' in self.cmd(f'--repo={self.repository_location}', 'info', '--name=test1') assert 'Comment: this is the comment' in self.cmd(f'--repo={self.repository_location}', 'info', '--name=test2') @@ -1592,11 +1592,11 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('file1', size=1024 * 80) self.create_regular_file('dir2/file2', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test.2', 'input') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test.3', 'input') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=another_test.1', 'input') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=another_test.2', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test.2', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test.3', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'another_test.1', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'another_test.2', 'input') self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test', '--dry-run') self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test.2', '--dry-run') self.cmd(f'--repo={self.repository_location}', 'delete', '--prefix', 'another_') @@ -1612,9 +1612,9 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_delete_multiple(self): self.create_regular_file('file1', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', 'input') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', 'input') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test3', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test1', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test2', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test3', 'input') self.cmd(f'--repo={self.repository_location}', 'delete', '--name=test1', 'test2') self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test3', '--dry-run') self.cmd(f'--repo={self.repository_location}', 'delete', '--name=test3') @@ -1624,8 +1624,8 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('file1', size=1024 * 80) self.create_regular_file('dir2/file2', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test.2', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test.2', 'input') os.environ['BORG_DELETE_I_KNOW_WHAT_I_AM_DOING'] = 'no' self.cmd(f'--repo={self.repository_location}', 'delete', exit_code=2) assert os.path.exists(self.repository_path) @@ -1797,13 +1797,13 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_umask(self): self.create_regular_file('file1', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') mode = os.stat(self.repository_path).st_mode self.assertEqual(stat.S_IMODE(mode), 0o700) def test_create_dry_run(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--dry-run', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', '--dry-run', 'test', 'input') # Make sure no archive has been created with Repository(self.repository_path) as repository: manifest, key = Manifest.load(repository, Manifest.NO_OPERATION_CHECK) @@ -1827,13 +1827,13 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_unknown_feature_on_create(self): print(self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey')) self.add_unknown_feature(Manifest.Operation.WRITE) - self.cmd_raises_unknown_feature([f'--repo={self.repository_location}', 'create', '--name=test', 'input']) + self.cmd_raises_unknown_feature([f'--repo={self.repository_location}', 'create', 'test', 'input']) def test_unknown_feature_on_cache_sync(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') self.cmd(f'--repo={self.repository_location}', 'delete', '--cache-only') self.add_unknown_feature(Manifest.Operation.READ) - self.cmd_raises_unknown_feature([f'--repo={self.repository_location}', 'create', '--name=test', 'input']) + self.cmd_raises_unknown_feature([f'--repo={self.repository_location}', 'create', 'test', 'input']) def test_unknown_feature_on_change_passphrase(self): print(self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey')) @@ -1842,7 +1842,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_unknown_feature_on_read(self): print(self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey')) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') self.add_unknown_feature(Manifest.Operation.READ) with changedir('output'): self.cmd_raises_unknown_feature([f'--repo={self.repository_location}', 'extract', '--name=test']) @@ -1852,13 +1852,13 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_unknown_feature_on_rename(self): print(self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey')) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') self.add_unknown_feature(Manifest.Operation.CHECK) self.cmd_raises_unknown_feature([f'--repo={self.repository_location}', 'rename', 'test', 'other']) def test_unknown_feature_on_delete(self): print(self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey')) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') self.add_unknown_feature(Manifest.Operation.DELETE) # delete of an archive raises self.cmd_raises_unknown_feature([f'--repo={self.repository_location}', 'delete', '--name=test']) @@ -1869,7 +1869,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): @unittest.skipUnless(llfuse, 'llfuse not installed') def test_unknown_feature_on_mount(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') self.add_unknown_feature(Manifest.Operation.READ) mountpoint = os.path.join(self.tmpdir, 'mountpoint') os.mkdir(mountpoint) @@ -1895,7 +1895,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): cache.commit() if self.FORK_DEFAULT: - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') else: called = False wipe_cache_safe = LocalCache.wipe_cache @@ -1906,7 +1906,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): wipe_cache_safe(*args) with patch.object(LocalCache, 'wipe_cache', wipe_wrapper): - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') assert called @@ -1920,13 +1920,13 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_progress_on(self): self.create_regular_file('file1', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test4', '--progress', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', 'test4', 'input', '--progress') self.assert_in("\r", output) def test_progress_off(self): self.create_regular_file('file1', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test5', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', 'test5', 'input') self.assert_not_in("\r", output) def test_file_status(self): @@ -1937,11 +1937,11 @@ class ArchiverTestCase(ArchiverTestCaseBase): time.sleep(1) # file2 must have newer timestamps than file1 self.create_regular_file('file2', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--list', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', '--list', 'test', 'input') self.assert_in("A input/file1", output) self.assert_in("A input/file2", output) # should find first file as unmodified - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', '--list', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', '--list', 'test2', 'input') self.assert_in("U input/file1", output) # this is expected, although surprising, for why, see: # https://borgbackup.readthedocs.org/en/latest/faq.html#i-am-seeing-a-added-status-for-a-unchanged-file @@ -1953,15 +1953,15 @@ class ArchiverTestCase(ArchiverTestCaseBase): time.sleep(1) # file2 must have newer timestamps than file1 self.create_regular_file('file2', size=10) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', - '--list', '--files-cache=ctime,size', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', 'test1', 'input', + '--list', '--files-cache=ctime,size') # modify file1, but cheat with the mtime (and atime) and also keep same size: st = os.stat('input/file1') self.create_regular_file('file1', contents=b'321') os.utime('input/file1', ns=(st.st_atime_ns, st.st_mtime_ns)) # this mode uses ctime for change detection, so it should find file1 as modified - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', - '--list', '--files-cache=ctime,size', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', 'test2', 'input', + '--list', '--files-cache=ctime,size') self.assert_in("M input/file1", output) def test_file_status_ms_cache_mode(self): @@ -1970,14 +1970,14 @@ class ArchiverTestCase(ArchiverTestCaseBase): time.sleep(1) # file2 must have newer timestamps than file1 self.create_regular_file('file2', size=10) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', - '--list', '--files-cache=mtime,size', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', + '--list', '--files-cache=mtime,size', 'test1', 'input') # change mode of file1, no content change: st = os.stat('input/file1') os.chmod('input/file1', st.st_mode ^ stat.S_IRWXO) # this triggers a ctime change, but mtime is unchanged # this mode uses mtime for change detection, so it should find file1 as unmodified - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', - '--list', '--files-cache=mtime,size', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', + '--list', '--files-cache=mtime,size', 'test2', 'input') self.assert_in("U input/file1", output) def test_file_status_rc_cache_mode(self): @@ -1986,11 +1986,11 @@ class ArchiverTestCase(ArchiverTestCaseBase): time.sleep(1) # file2 must have newer timestamps than file1 self.create_regular_file('file2', size=10) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', - '--list', '--files-cache=rechunk,ctime', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', + '--list', '--files-cache=rechunk,ctime', 'test1', 'input') # no changes here, but this mode rechunks unconditionally - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', - '--list', '--files-cache=rechunk,ctime', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', + '--list', '--files-cache=rechunk,ctime', 'test2', 'input') self.assert_in("A input/file1", output) def test_file_status_excluded(self): @@ -2003,14 +2003,14 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('file3', size=1024 * 80) platform.set_flags(os.path.join(self.input_path, 'file3'), stat.UF_NODUMP) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--list', '--exclude-nodump', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', '--list', '--exclude-nodump', 'test', 'input') self.assert_in("A input/file1", output) self.assert_in("A input/file2", output) if has_lchflags: self.assert_in("x input/file3", output) # should find second file as excluded - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', - '--list', '--exclude-nodump', 'input', '--exclude', '*/file2') + output = self.cmd(f'--repo={self.repository_location}', 'create', 'test1', 'input', + '--list', '--exclude-nodump', '--exclude', '*/file2') self.assert_in("U input/file1", output) self.assert_in("x input/file2", output) if has_lchflags: @@ -2019,8 +2019,8 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_create_json(self): self.create_regular_file('file1', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - create_info = json.loads(self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', - '--json', 'input')) + create_info = json.loads(self.cmd(f'--repo={self.repository_location}', 'create', '--json', + 'test', 'input')) # The usual keys assert 'encryption' in create_info assert 'repository' in create_info @@ -2040,21 +2040,21 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('file2', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') # no listing by default - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') self.assert_not_in('file1', output) # shouldn't be listed even if unchanged - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test0', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', 'test0', 'input') self.assert_not_in('file1', output) # should list the file as unchanged - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', '--list', '--filter=U', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', 'test1', 'input', '--list', '--filter=U') self.assert_in('file1', output) # should *not* list the file as changed - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', '--list', '--filter=AM', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', 'test2', 'input', '--list', '--filter=AM') self.assert_not_in('file1', output) # change the file self.create_regular_file('file1', size=1024 * 100) # should list the file as changed - output = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test3', '--list', '--filter=AM', 'input') + output = self.cmd(f'--repo={self.repository_location}', 'create', 'test3', 'input', '--list', '--filter=AM') self.assert_in('file1', output) @pytest.mark.skipif(not are_fifos_supported(), reason='FIFOs not supported') @@ -2079,7 +2079,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): t = Thread(target=fifo_feeder, args=(fifo_fn, data)) t.start() try: - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--read-special', 'input/link_fifo') + self.cmd(f'--repo={self.repository_location}', 'create', '--read-special', 'test', 'input/link_fifo') finally: t.join() with changedir('output'): @@ -2092,25 +2092,25 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_create_read_special_broken_symlink(self): os.symlink('somewhere does not exist', os.path.join(self.input_path, 'link')) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--read-special', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', '--read-special', 'test', 'input') output = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test') assert 'input/link -> somewhere does not exist' in output # def test_cmdline_compatibility(self): # self.create_regular_file('file1', size=1024 * 80) # self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - # self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + # self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') # output = self.cmd('foo', self.repository_location, '--old') # self.assert_in('"--old" has been deprecated. Use "--new" instead', output) def test_prune_repository(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', src_dir) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'test1', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'test2', src_dir) # these are not really a checkpoints, but they look like some: - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test3.checkpoint', src_dir) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test3.checkpoint.1', src_dir) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test4.checkpoint', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'test3.checkpoint', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'test3.checkpoint.1', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'test4.checkpoint', src_dir) output = self.cmd(f'--repo={self.repository_location}', 'prune', '--list', '--dry-run', '--keep-daily=1') assert re.search(r'Would prune:\s+test1', output) # must keep the latest non-checkpoint archive: @@ -2133,7 +2133,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.assert_not_in('test3.checkpoint.1', output) self.assert_in('test4.checkpoint', output) # now we supersede the latest checkpoint by a successful backup: - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test5', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'test5', src_dir) self.cmd(f'--repo={self.repository_location}', 'prune', '--keep-daily=2') output = self.cmd(f'--repo={self.repository_location}', 'list', '--consider-checkpoints') # all checkpoints should be gone now: @@ -2148,8 +2148,8 @@ class ArchiverTestCase(ArchiverTestCaseBase): return dtime.astimezone(dateutil.tz.UTC).strftime("%Y-%m-%dT%H:%M:%S") def _create_archive_ts(self, name, y, m, d, H=0, M=0, S=0): - self.cmd(f'--repo={self.repository_location}', 'create', f'--name={name}', - '--timestamp', self._to_utc_timestamp(y, m, d, H, M, S), src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', + '--timestamp', self._to_utc_timestamp(y, m, d, H, M, S), name, src_dir) # This test must match docs/misc/prune-example.txt def test_prune_repository_example(self): @@ -2238,8 +2238,8 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_prune_repository_save_space(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', src_dir) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'test1', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'test2', src_dir) output = self.cmd(f'--repo={self.repository_location}', 'prune', '--list', '--dry-run', '--keep-daily=1') assert re.search(r'Keeping archive \(rule: daily #1\):\s+test2', output) assert re.search(r'Would prune:\s+test1', output) @@ -2253,10 +2253,10 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_prune_repository_prefix(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=foo-2015-08-12-10:00', src_dir) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=foo-2015-08-12-20:00', src_dir) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=bar-2015-08-12-10:00', src_dir) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=bar-2015-08-12-20:00', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'foo-2015-08-12-10:00', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'foo-2015-08-12-20:00', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'bar-2015-08-12-10:00', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'bar-2015-08-12-20:00', src_dir) output = self.cmd(f'--repo={self.repository_location}', 'prune', '--list', '--dry-run', '--keep-daily=1', '--prefix=foo-') assert re.search(r'Keeping archive \(rule: daily #1\):\s+foo-2015-08-12-20:00', output) assert re.search(r'Would prune:\s+foo-2015-08-12-10:00', output) @@ -2274,10 +2274,10 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_prune_repository_glob(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=2015-08-12-10:00-foo', src_dir) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=2015-08-12-20:00-foo', src_dir) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=2015-08-12-10:00-bar', src_dir) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=2015-08-12-20:00-bar', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', '2015-08-12-10:00-foo', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', '2015-08-12-20:00-foo', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', '2015-08-12-10:00-bar', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', '2015-08-12-20:00-bar', src_dir) output = self.cmd(f'--repo={self.repository_location}', 'prune', '--list', '--dry-run', '--keep-daily=1', '--glob-archives=2015-*-foo') assert re.search(r'Keeping archive \(rule: daily #1\):\s+2015-08-12-20:00-foo', output) assert re.search(r'Would prune:\s+2015-08-12-10:00-foo', output) @@ -2295,9 +2295,9 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_list_prefix(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test-1', src_dir) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=something-else-than-test-1', src_dir) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test-2', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'test-1', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'something-else-than-test-1', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'test-2', src_dir) output = self.cmd(f'--repo={self.repository_location}', 'list', '--prefix=test-') self.assert_in('test-1', output) self.assert_in('test-2', output) @@ -2305,7 +2305,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_list_format(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'test', src_dir) output_1 = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test') output_2 = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test', '--format', '{mode} {user:6} {group:6} {size:8d} {mtime} {path}{extra}{NEWLINE}') output_3 = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test', '--format', '{mtime:%s} {path}{NL}') @@ -2314,8 +2314,8 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_list_repository_format(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test-1', '--comment', 'comment 1', src_dir) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test-2', '--comment', 'comment 2', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', '--comment', 'comment 1', 'test-1', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', '--comment', 'comment 2', 'test-2', src_dir) output_1 = self.cmd(f'--repo={self.repository_location}', 'list') output_2 = self.cmd(f'--repo={self.repository_location}', 'list', '--format', '{archive:<36} {time} [{id}]{NL}') self.assertEqual(output_1, output_2) @@ -2331,17 +2331,17 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('empty_file', size=0) self.create_regular_file('amb', contents=b'a' * 1000000) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') output = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test', '--format', '{sha256} {path}{NL}') assert "cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0 input/amb" in output assert "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 input/empty_file" in output def test_list_consider_checkpoints(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'test1', src_dir) # these are not really a checkpoints, but they look like some: - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2.checkpoint', src_dir) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test3.checkpoint.1', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'test2.checkpoint', src_dir) + self.cmd(f'--repo={self.repository_location}', 'create', 'test3.checkpoint.1', src_dir) output = self.cmd(f'--repo={self.repository_location}', 'list') assert "test1" in output assert "test2.checkpoint" not in output @@ -2358,7 +2358,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): fd.write(b'abba' * 2000000) fd.write(b'baab' * 2000000) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') output = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test', '--format', '{num_chunks} {unique_chunks} {path}{NL}') assert "0 0 input/empty_file" in output assert "2 2 input/two_chunks" in output @@ -2366,7 +2366,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_list_size(self): self.create_regular_file('compressible_file', size=10000) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '-C', 'lz4', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', '-C', 'lz4', 'test', 'input') output = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test', '--format', '{size} {path}{NL}') size, path = output.split("\n")[1].split(" ") assert int(size) == 10000 @@ -2374,7 +2374,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_list_json(self): self.create_regular_file('file1', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') list_repo = json.loads(self.cmd(f'--repo={self.repository_location}', 'list', '--json')) repository = list_repo['repository'] assert len(repository['id']) == 64 @@ -2407,7 +2407,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_log_json(self): self.create_test_files() self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - log = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--log-json', 'input', '--list', '--debug') + log = self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input', '--log-json', '--list', '--debug') messages = {} # type -> message, one of each kind for line in log.splitlines(): msg = json.loads(line) @@ -2425,13 +2425,13 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_debug_profile(self): self.create_test_files() self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input', '--debug-profile=create.prof') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input', '--debug-profile=create.prof') self.cmd('debug', 'convert-profile', 'create.prof', 'create.pyprof') stats = pstats.Stats('create.pyprof') stats.strip_dirs() stats.sort_stats('cumtime') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', 'input', '--debug-profile=create.pyprof') + self.cmd(f'--repo={self.repository_location}', 'create', 'test2', 'input', '--debug-profile=create.pyprof') stats = pstats.Stats('create.pyprof') # Only do this on trusted data! stats.strip_dirs() stats.sort_stats('cumtime') @@ -2439,7 +2439,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_common_options(self): self.create_test_files() self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - log = self.cmd(f'--repo={self.repository_location}', '--debug', 'create', '--name=test', 'input') + log = self.cmd(f'--repo={self.repository_location}', '--debug', 'create', 'test', 'input') assert 'security: read previous location' in log def test_change_passphrase(self): @@ -2513,8 +2513,8 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') self.create_test_files() have_noatime = has_noatime('input/file1') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=archive', '--exclude-nodump', '--atime', 'input') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=archive2', '--exclude-nodump', '--atime', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', '--exclude-nodump', '--atime', 'archive', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', '--exclude-nodump', '--atime', 'archive2', 'input') if has_lchflags: # remove the file we did not backup, so input and output become equal os.remove(os.path.join('input', 'flagfile')) @@ -2606,9 +2606,9 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('hardlink1', contents=b'123456') os.link('input/hardlink1', 'input/hardlink2') os.link('input/hardlink1', 'input/hardlink3') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=archive1', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'archive1', 'input') self.create_regular_file('test', contents=b'second') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=archive2', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'archive2', 'input') mountpoint = os.path.join(self.tmpdir, 'mountpoint') # mount the whole repository, archive contents shall show up in versioned view: with self.fuse_mount(self.repository_location, mountpoint, '-o', 'versions'): @@ -2786,9 +2786,9 @@ class ArchiverTestCase(ArchiverTestCaseBase): os.environ['BORG_PASSPHRASE'] = 'passphrase' self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=' + method) verify_uniqueness() - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') verify_uniqueness() - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test.2', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test.2', 'input') verify_uniqueness() self.cmd(f'--repo={self.repository_location}', 'delete', '--name=test.2') verify_uniqueness() @@ -2802,7 +2802,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_debug_dump_archive_items(self): self.create_test_files() self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with changedir('output'): output = self.cmd(f'--repo={self.repository_location}', 'debug', 'dump-archive-items', '--name=test') output_dir = sorted(os.listdir('output')) @@ -2812,7 +2812,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_debug_dump_repo_objs(self): self.create_test_files() self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with changedir('output'): output = self.cmd(f'--repo={self.repository_location}', 'debug', 'dump-repo-objs') output_dir = sorted(os.listdir('output')) @@ -2899,7 +2899,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_check_cache(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with self.open_repository() as repository: manifest, key = Manifest.load(repository, Manifest.NO_OPERATION_CHECK) with Cache(repository, key, manifest, sync=False) as cache: @@ -2918,7 +2918,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_test_files() self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') self.check_cache() - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test0', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test0', 'input') self.check_cache() original_archive = self.cmd(f'--repo={self.repository_location}', 'list') self.cmd(f'--repo={self.repository_location}', 'recreate', '--name=test0', 'input/dir2', @@ -2937,7 +2937,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_test_files() self.create_regular_file('dir2/file3', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test0', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test0', 'input') self.cmd(f'--repo={self.repository_location}', 'recreate', '--name=test0', 'input/dir2', '-e', 'input/dir2/file3') self.check_cache() listing = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test0', '--short') @@ -2949,7 +2949,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_recreate_subtree_hardlinks(self): # This is essentially the same problem set as in test_extract_hardlinks self._extract_hardlinks_setup() - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test2', 'input') self.cmd(f'--repo={self.repository_location}', 'recreate', '--name=test', 'input/dir1') self.check_cache() with changedir('output'): @@ -2967,8 +2967,8 @@ class ArchiverTestCase(ArchiverTestCaseBase): fd.write(b'a' * 280) fd.write(b'b' * 280) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', '--chunker-params', '7,9,8,128', 'input') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', 'input', '--files-cache=disabled') + self.cmd(f'--repo={self.repository_location}', 'create', 'test1', 'input', '--chunker-params', '7,9,8,128') + self.cmd(f'--repo={self.repository_location}', 'create', 'test2', 'input', '--files-cache=disabled') list = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test1', 'input/large_file', '--format', '{num_chunks} {unique_chunks}') num_chunks, unique_chunks = map(int, list.split(' ')) @@ -2984,7 +2984,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_recreate_recompress(self): self.create_regular_file('compressible', size=10000) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input', '-C', 'none') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input', '-C', 'none') file_list = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test', 'input/compressible', '--format', '{size} {sha256}') size, sha256_before = file_list.split(' ') @@ -2999,7 +2999,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): local_timezone = datetime.now(timezone(timedelta(0))).astimezone().tzinfo self.create_test_files() self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test0', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test0', 'input') self.cmd(f'--repo={self.repository_location}', 'recreate', '--name=test0', '--timestamp', "1970-01-02T00:00:00", '--comment', 'test') info = self.cmd(f'--repo={self.repository_location}', 'info', '--name=test0').splitlines() @@ -3011,7 +3011,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_recreate_dry_run(self): self.create_regular_file('compressible', size=10000) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') archives_before = self.cmd(f'--repo={self.repository_location}', 'list', '--name=test') self.cmd(f'--repo={self.repository_location}', 'recreate', '-n', '-e', 'input/compressible') self.check_cache() @@ -3021,7 +3021,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_recreate_skips_nothing_to_do(self): self.create_regular_file('file1', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') info_before = self.cmd(f'--repo={self.repository_location}', 'info', '--name=test') self.cmd(f'--repo={self.repository_location}', 'recreate', '--chunker-params', 'default') self.check_cache() @@ -3042,7 +3042,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('file4', size=0) self.create_regular_file('file5', size=0) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') output = self.cmd(f'--repo={self.repository_location}', 'recreate', '--name=test', '--list', '--info', '-e', 'input/file2') self.check_cache() @@ -3066,7 +3066,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): def test_bad_filters(self): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') self.cmd(f'--repo={self.repository_location}', 'delete', '--first', '1', '--last', '1', fork=True, exit_code=2) def test_key_export_keyfile(self): @@ -3266,7 +3266,7 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 def test_debug_dump_manifest(self): self.create_regular_file('file1', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') dump_file = self.output_path + '/dump' output = self.cmd(f'--repo={self.repository_location}', 'debug', 'dump-manifest', dump_file) assert output == "" @@ -3281,7 +3281,7 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 def test_debug_dump_archive(self): self.create_regular_file('file1', size=1024 * 80) self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') dump_file = self.output_path + '/dump' output = self.cmd(f'--repo={self.repository_location}', 'debug', 'dump-archive', '--name=test', dump_file) assert output == "" @@ -3297,7 +3297,7 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 output = self.cmd(f'--repo={self.repository_location}', 'debug', 'refcount-obj', '0' * 64).strip() assert output == 'object 0000000000000000000000000000000000000000000000000000000000000000 not found [info from chunks cache].' - create_json = json.loads(self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', '--json', 'input')) + create_json = json.loads(self.cmd(f'--repo={self.repository_location}', 'create', '--json', 'test', 'input')) archive_id = create_json['archive']['id'] output = self.cmd(f'--repo={self.repository_location}', 'debug', 'refcount-obj', archive_id).strip() assert output == 'object ' + archive_id + ' has 1 referrers [info from chunks cache].' @@ -3363,7 +3363,7 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 self.create_test_files() os.unlink('input/flagfile') self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') self.cmd(f'--repo={self.repository_location}', 'export-tar', '--name=test', 'simple.tar', '--progress', '--tar-format=GNU') with changedir('output'): # This probably assumes GNU tar. Note -p switch to extract permissions regardless of umask. @@ -3378,7 +3378,7 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 self.create_test_files() os.unlink('input/flagfile') self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') list = self.cmd(f'--repo={self.repository_location}', 'export-tar', '--name=test', 'simple.tar.gz', '--list', '--tar-format=GNU') assert 'input/file1\n' in list @@ -3394,7 +3394,7 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 self.create_test_files() os.unlink('input/flagfile') self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') list = self.cmd(f'--repo={self.repository_location}', 'export-tar', '--name=test', 'simple.tar', '--strip-components=1', '--list', '--tar-format=GNU') # --list's path are those before processing with --strip-components @@ -3433,7 +3433,7 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 self.create_test_files(create_hardlinks=False) # hardlinks become separate files os.unlink('input/flagfile') self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=none') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=src', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'src', 'input') self.cmd(f'--repo={self.repository_location}', 'export-tar', '--name=src', 'simple.tar', f'--tar-format={tar_format}') self.cmd(f'--repo={self.repository_location}', 'import-tar', '--name=dst', 'simple.tar') with changedir(self.output_path): @@ -3447,7 +3447,7 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 self.create_test_files(create_hardlinks=False) # hardlinks become separate files os.unlink('input/flagfile') self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=none') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=src', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'src', 'input') self.cmd(f'--repo={self.repository_location}', 'export-tar', '--name=src', 'simple.tgz', f'--tar-format={tar_format}') self.cmd(f'--repo={self.repository_location}', 'import-tar', '--name=dst', 'simple.tgz') with changedir(self.output_path): @@ -3457,7 +3457,7 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 def test_roundtrip_pax_borg(self): self.create_test_files() self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=none') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=src', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'src', 'input') self.cmd(f'--repo={self.repository_location}', 'export-tar', '--name=src', 'simple.tar', '--tar-format=BORG') self.cmd(f'--repo={self.repository_location}', 'import-tar', '--name=dst', 'simple.tar') with changedir(self.output_path): @@ -3475,7 +3475,7 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 self.create_regular_file('file') xattr.setxattr(b'input/file', b'user.attribute%p', b'value') self.cmd('init', self.repository_location, '-e' 'none') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with changedir('output'): with patch.object(xattr, 'setxattr', patched_setxattr_EACCES): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test', exit_code=EXIT_WARNING) @@ -3491,7 +3491,7 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 os.makedirs(os.path.join(self.input_path, 'dir%p')) xattr.setxattr(b'input/dir%p', b'user.attribute', b'value') self.cmd(f'--repo={self.repository_location}', 'init', '-e' 'none') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') with changedir('output'): with patch.object(xattr, 'setxattr', patched_setxattr_EACCES): self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test', exit_code=EXIT_WARNING) @@ -3510,7 +3510,7 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 both the client and the server forget the nonce""" self.create_regular_file('file1', contents=b'Hello, borg') self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') # Oops! We have removed the repo-side memory of the nonce! # See https://github.com/borgbackup/borg/issues/5858 os.remove(os.path.join(self.repository_path, 'nonce')) @@ -3541,13 +3541,13 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 """ self.create_regular_file('file1', contents=b'Hello, borg') self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') # Oops! We have removed the repo-side memory of the nonce! # See https://github.com/borgbackup/borg/issues/5858 nonce = os.path.join(self.repository_path, 'nonce') os.remove(nonce) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test2', 'input') assert os.path.exists(nonce) def test_init_defaults_to_argon2(self): @@ -3994,7 +3994,7 @@ class RemoteArchiverTestCase(ArchiverTestCase): self.create_regular_file('skipped-file1', contents=b"test file contents 3") self.create_regular_file('skipped-file2', contents=b"test file contents 4") self.create_regular_file('skipped-file3', contents=b"test file contents 5") - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') marker = 'cached responses left in RemoteRepository' with changedir('output'): res = self.cmd(f'--repo={self.repository_location}', 'extract', '--name=test', "--debug", '--strip-components', '3') @@ -4035,17 +4035,17 @@ class ArchiverCorruptionTestCase(ArchiverTestCaseBase): self.cmd(f'--repo={self.repository_location}', 'info') def test_cache_files(self): - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test', 'input') self.corrupt(os.path.join(self.cache_path, 'files')) - out = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', 'input') + out = self.cmd(f'--repo={self.repository_location}', 'create', 'test1', 'input') # borg warns about the corrupt files cache, but then continues without files cache. assert 'files cache is corrupted' in out def test_chunks_archive(self): - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test1', 'input') # Find ID of test1 so we can corrupt it later :) target_id = self.cmd(f'--repo={self.repository_location}', 'list', '--format={id}{LF}').strip() - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test2', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test2', 'input') # Force cache sync, creating archive chunks of test1 and test2 in chunks.archive.d self.cmd(f'--repo={self.repository_location}', 'delete', '--cache-only') @@ -4065,7 +4065,7 @@ class ArchiverCorruptionTestCase(ArchiverTestCaseBase): config.write(fd) # Cache sync notices corrupted archive chunks, but automatically recovers. - out = self.cmd(f'--repo={self.repository_location}', 'create', '--name=test3', '-v', 'input', exit_code=1) + out = self.cmd(f'--repo={self.repository_location}', 'create', '-v', 'test3', 'input', exit_code=1) assert 'Reading cached archive chunk index for test1' in out assert 'Cached archive chunk index of test1 is corrupted' in out assert 'Fetching and building archive index for test1' in out @@ -4111,7 +4111,7 @@ class DiffArchiverTestCase(ArchiverTestCaseBase): self.cmd(f'--repo={self.repository_location}', 'init', '--encryption=repokey') # Create the first snapshot - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test0', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test0', 'input') # Setup files for the second snapshot self.create_regular_file('file_added', size=2048) @@ -4142,8 +4142,8 @@ class DiffArchiverTestCase(ArchiverTestCaseBase): fd.write(b'appended_data') # Create the second snapshot - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1a', 'input') - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1b', '--chunker-params', '16,18,17,4095', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test1a', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test1b', 'input', '--chunker-params', '16,18,17,4095') def do_asserts(output, can_compare_ids): # File contents changed (deleted and replaced with a new file) @@ -4300,7 +4300,7 @@ class DiffArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('f_file_removed', size=16) self.create_regular_file('c_file_changed', size=32) self.create_regular_file('e_file_changed', size=64) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test0', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test0', 'input') os.unlink('input/a_file_removed') os.unlink('input/f_file_removed') @@ -4310,7 +4310,7 @@ class DiffArchiverTestCase(ArchiverTestCaseBase): self.create_regular_file('e_file_changed', size=1024) self.create_regular_file('b_file_added', size=128) self.create_regular_file('d_file_added', size=256) - self.cmd(f'--repo={self.repository_location}', 'create', '--name=test1', 'input') + self.cmd(f'--repo={self.repository_location}', 'create', 'test1', 'input') output = self.cmd(f'--repo={self.repository_location}', 'diff', '--name=test0', '--name2=test1', '--sort') diff --git a/src/borg/testsuite/benchmark.py b/src/borg/testsuite/benchmark.py index 4eb3a3da6..fac828c13 100644 --- a/src/borg/testsuite/benchmark.py +++ b/src/borg/testsuite/benchmark.py @@ -57,19 +57,19 @@ def testdata(request, tmpdir_factory): @pytest.fixture(params=['none', 'lz4']) def repo_archive(request, cmd, repo, testdata): archive = 'test' - cmd(f'--repo={repo}', 'create', f'--name={archive}', '--compression', request.param, testdata) + cmd(f'--repo={repo}', 'create', f'{archive}', '--compression', request.param, testdata) return repo, archive def test_create_none(benchmark, cmd, repo, testdata): result, out = benchmark.pedantic(cmd, (f'--repo={repo}', 'create', '--compression', 'none', - '--name', 'test', testdata)) + 'test', testdata)) assert result == 0 def test_create_lz4(benchmark, cmd, repo, testdata): result, out = benchmark.pedantic(cmd, (f'--repo={repo}', 'create', '--compression', 'lz4', - '--name', 'test', testdata)) + 'test', testdata)) assert result == 0