From 5d7b48ced8c9182eccc79e77f6e49cf2280c86af Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Tue, 13 Sep 2022 23:00:42 +0200 Subject: [PATCH] add remote repo / borg binary testing --- src/borg/testsuite/archiver/check_cmd.py | 20 +++++++++++++++++++- src/borg/testsuite/archiver/config_cmd.py | 8 +++++++- src/borg/testsuite/archiver/create_cmd.py | 15 ++++++++++++++- src/borg/testsuite/archiver/debug_cmds.py | 11 +++++++---- src/borg/testsuite/archiver/delete_cmd.py | 13 ++++++++++++- src/borg/testsuite/archiver/diff_cmd.py | 14 ++++++++++++-- src/borg/testsuite/archiver/extract_cmd.py | 13 ++++++++++++- src/borg/testsuite/archiver/info_cmd.py | 20 +++++++++++++++++++- src/borg/testsuite/archiver/key_cmds.py | 19 ++++++++++++++++++- src/borg/testsuite/archiver/list_cmd.py | 19 ++++++++++++++++++- src/borg/testsuite/archiver/lock_cmds.py | 13 ++++++++++++- src/borg/testsuite/archiver/mount_cmds.py | 17 ++++++++++++++++- src/borg/testsuite/archiver/prune_cmd.py | 19 ++++++++++++++++++- src/borg/testsuite/archiver/rcreate_cmd.py | 15 ++++++++++++++- src/borg/testsuite/archiver/rdelete_cmd.py | 12 +++++++++++- src/borg/testsuite/archiver/recreate_cmd.py | 12 +++++++++++- src/borg/testsuite/archiver/rename_cmd.py | 13 ++++++++++++- src/borg/testsuite/archiver/rinfo_cmd.py | 20 +++++++++++++++++++- src/borg/testsuite/archiver/rlist_cmd.py | 20 +++++++++++++++++++- src/borg/testsuite/archiver/tar_cmds.py | 19 ++++++++++++++++++- src/borg/testsuite/archiver/transfer_cmd.py | 13 ++++++++++++- 21 files changed, 300 insertions(+), 25 deletions(-) diff --git a/src/borg/testsuite/archiver/check_cmd.py b/src/borg/testsuite/archiver/check_cmd.py index 874f7a591..595c37971 100644 --- a/src/borg/testsuite/archiver/check_cmd.py +++ b/src/borg/testsuite/archiver/check_cmd.py @@ -1,5 +1,6 @@ import logging import shutil +import unittest from unittest.mock import patch from ...archive import ChunkBuffer @@ -8,7 +9,7 @@ from ...helpers import bin_to_hex from ...helpers import msgpack from ...manifest import Manifest from ...repository import Repository -from . import ArchiverTestCaseBase, RK_ENCRYPTION +from . import ArchiverTestCaseBase, RemoteArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, BORG_EXES class ArchiverCheckTestCase(ArchiverTestCaseBase): @@ -240,3 +241,20 @@ class ArchiverCheckTestCase(ArchiverTestCaseBase): repository.delete(id_) repository.commit(compact=False) self.cmd(f"--repo={self.repository_location}", "check", exit_code=1) + + +class RemoteArchiverCheckTestCase(RemoteArchiverTestCaseBase, ArchiverCheckTestCase): + """run the same tests, but with a remote repository""" + + @unittest.skip("only works locally") + def test_empty_repository(self): + pass + + @unittest.skip("only works locally") + def test_extra_chunks(self): + pass + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverCheckTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/config_cmd.py b/src/borg/testsuite/archiver/config_cmd.py index a466739f4..c16f17576 100644 --- a/src/borg/testsuite/archiver/config_cmd.py +++ b/src/borg/testsuite/archiver/config_cmd.py @@ -1,7 +1,8 @@ import os +import unittest from ...constants import * # NOQA -from . import ArchiverTestCaseBase, RK_ENCRYPTION +from . import ArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, BORG_EXES class ArchiverTestCase(ArchiverTestCaseBase): @@ -40,3 +41,8 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.cmd(f"--repo={self.repository_location}", "config", "--list", "--delete", exit_code=2) self.cmd(f"--repo={self.repository_location}", "config", exit_code=2) self.cmd(f"--repo={self.repository_location}", "config", "invalid-option", exit_code=1) + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/create_cmd.py b/src/borg/testsuite/archiver/create_cmd.py index 119b9b8bb..16ebcf137 100644 --- a/src/borg/testsuite/archiver/create_cmd.py +++ b/src/borg/testsuite/archiver/create_cmd.py @@ -22,7 +22,14 @@ from .. import ( is_utime_fully_supported, is_birthtime_fully_supported, ) -from . import ArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, BORG_EXES, requires_hardlinks +from . import ( + ArchiverTestCaseBase, + ArchiverTestCaseBinaryBase, + RemoteArchiverTestCaseBase, + RK_ENCRYPTION, + BORG_EXES, + requires_hardlinks, +) class ArchiverTestCase(ArchiverTestCaseBase): @@ -725,8 +732,14 @@ class ArchiverTestCase(ArchiverTestCaseBase): assert "security: read previous location" in log +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + @unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" + @unittest.skip("test_basic_functionality seems incompatible with fakeroot and/or the binary.") def test_basic_functionality(self): pass diff --git a/src/borg/testsuite/archiver/debug_cmds.py b/src/borg/testsuite/archiver/debug_cmds.py index 3deef60bd..c7fce5bec 100644 --- a/src/borg/testsuite/archiver/debug_cmds.py +++ b/src/borg/testsuite/archiver/debug_cmds.py @@ -6,7 +6,7 @@ from hashlib import sha256 from ...constants import * # NOQA from .. import changedir -from . import ArchiverTestCaseBase, RemoteArchiverTestCaseBase, RK_ENCRYPTION +from . import ArchiverTestCaseBase, RemoteArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, BORG_EXES class ArchiverTestCase(ArchiverTestCaseBase): @@ -115,6 +115,9 @@ class ArchiverTestCase(ArchiverTestCaseBase): class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): - @unittest.skip("only works locally") - def test_debug_put_get_delete_obj(self): - pass + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/delete_cmd.py b/src/borg/testsuite/archiver/delete_cmd.py index a486205b5..5f00a209f 100644 --- a/src/borg/testsuite/archiver/delete_cmd.py +++ b/src/borg/testsuite/archiver/delete_cmd.py @@ -1,8 +1,10 @@ +import unittest + from ...archive import Archive from ...constants import * # NOQA from ...manifest import Manifest from ...repository import Repository -from . import ArchiverTestCaseBase, RK_ENCRYPTION +from . import ArchiverTestCaseBase, RemoteArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, BORG_EXES class ArchiverTestCase(ArchiverTestCaseBase): @@ -71,3 +73,12 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.cmd(f"--repo={self.repository_location}", "check", "--repair") output = self.cmd(f"--repo={self.repository_location}", "rlist") self.assert_not_in("test", output) + + +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/diff_cmd.py b/src/borg/testsuite/archiver/diff_cmd.py index 43aa7a3ac..cb0a8a867 100644 --- a/src/borg/testsuite/archiver/diff_cmd.py +++ b/src/borg/testsuite/archiver/diff_cmd.py @@ -1,13 +1,14 @@ import json import os import stat +import unittest from ...constants import * # NOQA from .. import are_symlinks_supported, are_hardlinks_supported -from . import ArchiverTestCaseBase, RK_ENCRYPTION +from . import ArchiverTestCaseBase, RemoteArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, BORG_EXES -class DiffArchiverTestCase(ArchiverTestCaseBase): +class ArchiverTestCase(ArchiverTestCaseBase): def test_basic_functionality(self): # Setup files for the first snapshot self.create_regular_file("empty", size=0) @@ -251,3 +252,12 @@ class DiffArchiverTestCase(ArchiverTestCaseBase): ] assert all(x in line for x, line in zip(expected, output.splitlines())) + + +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/extract_cmd.py b/src/borg/testsuite/archiver/extract_cmd.py index f057b5a5f..b948e7a5e 100644 --- a/src/borg/testsuite/archiver/extract_cmd.py +++ b/src/borg/testsuite/archiver/extract_cmd.py @@ -14,7 +14,14 @@ from ...helpers import flags_noatime, flags_normal from .. import changedir from .. import are_symlinks_supported, are_hardlinks_supported, is_utime_fully_supported, is_birthtime_fully_supported from ..platform import is_darwin -from . import ArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, requires_hardlinks, BORG_EXES +from . import ( + ArchiverTestCaseBase, + ArchiverTestCaseBinaryBase, + RemoteArchiverTestCaseBase, + RK_ENCRYPTION, + requires_hardlinks, + BORG_EXES, +) class ArchiverTestCase(ArchiverTestCaseBase): @@ -538,6 +545,10 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.cmd(f"--repo={self.repository_location}", "extract", "test", exit_code=EXIT_WARNING) +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + @unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): @unittest.skip("patches objects") diff --git a/src/borg/testsuite/archiver/info_cmd.py b/src/borg/testsuite/archiver/info_cmd.py index 71a9eb2cf..eb960dff2 100644 --- a/src/borg/testsuite/archiver/info_cmd.py +++ b/src/borg/testsuite/archiver/info_cmd.py @@ -1,6 +1,15 @@ import json +import unittest + from ...constants import * # NOQA -from . import ArchiverTestCaseBase, RK_ENCRYPTION, checkts +from . import ( + ArchiverTestCaseBase, + RemoteArchiverTestCaseBase, + ArchiverTestCaseBinaryBase, + RK_ENCRYPTION, + checkts, + BORG_EXES, +) class ArchiverTestCase(ArchiverTestCaseBase): @@ -37,3 +46,12 @@ class ArchiverTestCase(ArchiverTestCaseBase): assert info_repo["archives"] == [] info_repo = json.loads(self.cmd(f"--repo={self.repository_location}", "info", "--json", "--last=1")) assert info_repo["archives"] == [] + + +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/key_cmds.py b/src/borg/testsuite/archiver/key_cmds.py index 28671aada..c866fc3ae 100644 --- a/src/borg/testsuite/archiver/key_cmds.py +++ b/src/borg/testsuite/archiver/key_cmds.py @@ -1,4 +1,5 @@ import os +import unittest from binascii import unhexlify, b2a_base64, a2b_base64 import pytest @@ -12,7 +13,14 @@ from ...helpers import msgpack from ...repository import Repository from .. import environment_variable from .. import key -from . import ArchiverTestCaseBase, RK_ENCRYPTION, KF_ENCRYPTION +from . import ( + ArchiverTestCaseBase, + ArchiverTestCaseBinaryBase, + RemoteArchiverTestCaseBase, + RK_ENCRYPTION, + KF_ENCRYPTION, + BORG_EXES, +) class ArchiverTestCase(ArchiverTestCaseBase): @@ -277,3 +285,12 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02 with Repository(self.repository_path) as repository: key = msgpack.unpackb(a2b_base64(repository.load_key())) assert key["algorithm"] == "argon2 chacha20-poly1305" + + +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/list_cmd.py b/src/borg/testsuite/archiver/list_cmd.py index 09c2f6df7..a1d73b378 100644 --- a/src/borg/testsuite/archiver/list_cmd.py +++ b/src/borg/testsuite/archiver/list_cmd.py @@ -1,8 +1,16 @@ import json import os +import unittest from ...constants import * # NOQA -from . import ArchiverTestCaseBase, src_dir, RK_ENCRYPTION +from . import ( + ArchiverTestCaseBase, + RemoteArchiverTestCaseBase, + ArchiverTestCaseBinaryBase, + src_dir, + RK_ENCRYPTION, + BORG_EXES, +) class ArchiverTestCase(ArchiverTestCaseBase): @@ -72,3 +80,12 @@ class ArchiverTestCase(ArchiverTestCaseBase): file1 = items[1] assert file1["path"] == "input/file1" assert file1["sha256"] == "b2915eb69f260d8d3c25249195f2c8f4f716ea82ec760ae929732c0262442b2b" + + +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/lock_cmds.py b/src/borg/testsuite/archiver/lock_cmds.py index 481b35f13..797ce7a28 100644 --- a/src/borg/testsuite/archiver/lock_cmds.py +++ b/src/borg/testsuite/archiver/lock_cmds.py @@ -1,6 +1,8 @@ import os +import unittest + from ...constants import * # NOQA -from . import ArchiverTestCaseBase, RK_ENCRYPTION +from . import ArchiverTestCaseBase, RemoteArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, BORG_EXES class ArchiverTestCase(ArchiverTestCaseBase): @@ -13,3 +15,12 @@ class ArchiverTestCase(ArchiverTestCaseBase): lock_path = os.path.join(self.repository_path, "lock.exclusive") cmd = "python3", "-c", 'import os, sys; sys.exit(42 if os.path.exists("%s") else 23)' % lock_path self.cmd(f"--repo={self.repository_location}", "with-lock", *cmd, fork=True, exit_code=42) + + +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/mount_cmds.py b/src/borg/testsuite/archiver/mount_cmds.py index a6787dcfd..8a1f051af 100644 --- a/src/borg/testsuite/archiver/mount_cmds.py +++ b/src/borg/testsuite/archiver/mount_cmds.py @@ -15,7 +15,14 @@ from .. import has_lchflags, llfuse from .. import changedir, no_selinux from .. import are_symlinks_supported, are_hardlinks_supported, are_fifos_supported from ..platform import fakeroot_detected -from . import ArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, requires_hardlinks, BORG_EXES +from . import ( + ArchiverTestCaseBase, + ArchiverTestCaseBinaryBase, + RemoteArchiverTestCaseBase, + RK_ENCRYPTION, + requires_hardlinks, + BORG_EXES, +) class ArchiverTestCase(ArchiverTestCaseBase): @@ -343,6 +350,14 @@ class ArchiverTestCase(ArchiverTestCaseBase): borg.locking.Lock.migrate_lock = borg.locking.Lock.migrate_lock.__wrapped__ +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + @unittest.skip("only works locally") + def test_migrate_lock_alive(self): + pass + + @unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): def test_fuse(self): diff --git a/src/borg/testsuite/archiver/prune_cmd.py b/src/borg/testsuite/archiver/prune_cmd.py index dba7d0523..4a753be7b 100644 --- a/src/borg/testsuite/archiver/prune_cmd.py +++ b/src/borg/testsuite/archiver/prune_cmd.py @@ -1,8 +1,16 @@ import re +import unittest from datetime import datetime from ...constants import * # NOQA -from . import ArchiverTestCaseBase, RK_ENCRYPTION, src_dir +from . import ( + ArchiverTestCaseBase, + RemoteArchiverTestCaseBase, + ArchiverTestCaseBinaryBase, + RK_ENCRYPTION, + src_dir, + BORG_EXES, +) class ArchiverTestCase(ArchiverTestCaseBase): @@ -223,3 +231,12 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.assert_in("2015-08-12-20:00-foo", output) self.assert_in("2015-08-12-10:00-bar", output) self.assert_in("2015-08-12-20:00-bar", output) + + +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/rcreate_cmd.py b/src/borg/testsuite/archiver/rcreate_cmd.py index 2c659e587..b1b4bf528 100644 --- a/src/borg/testsuite/archiver/rcreate_cmd.py +++ b/src/borg/testsuite/archiver/rcreate_cmd.py @@ -9,7 +9,14 @@ from ...constants import * # NOQA from ...crypto.key import FlexiKey from ...repository import Repository from .. import environment_variable -from . import ArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, KF_ENCRYPTION, BORG_EXES +from . import ( + ArchiverTestCaseBase, + ArchiverTestCaseBinaryBase, + RemoteArchiverTestCaseBase, + RK_ENCRYPTION, + KF_ENCRYPTION, + BORG_EXES, +) class ArchiverTestCase(ArchiverTestCaseBase): @@ -63,8 +70,14 @@ class ArchiverTestCase(ArchiverTestCaseBase): assert before == after +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + @unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" + @unittest.skip("does not raise Exception, but sets rc==2") def test_rcreate_parent_dirs(self): pass diff --git a/src/borg/testsuite/archiver/rdelete_cmd.py b/src/borg/testsuite/archiver/rdelete_cmd.py index cae7d6417..f6d8932da 100644 --- a/src/borg/testsuite/archiver/rdelete_cmd.py +++ b/src/borg/testsuite/archiver/rdelete_cmd.py @@ -1,7 +1,8 @@ import os +import unittest from ...constants import * # NOQA -from . import ArchiverTestCaseBase, RK_ENCRYPTION +from . import ArchiverTestCaseBase, RemoteArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, BORG_EXES class ArchiverTestCase(ArchiverTestCaseBase): @@ -18,3 +19,12 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.cmd(f"--repo={self.repository_location}", "rdelete") # Make sure the repo is gone self.assertFalse(os.path.exists(self.repository_path)) + + +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/recreate_cmd.py b/src/borg/testsuite/archiver/recreate_cmd.py index 05d62fc0f..31caa5c4e 100644 --- a/src/borg/testsuite/archiver/recreate_cmd.py +++ b/src/borg/testsuite/archiver/recreate_cmd.py @@ -1,12 +1,13 @@ import os import re +import unittest from datetime import datetime import pytest from ...constants import * # NOQA from .. import changedir, are_hardlinks_supported -from . import ArchiverTestCaseBase, RK_ENCRYPTION +from . import ArchiverTestCaseBase, RemoteArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, BORG_EXES class ArchiverTestCase(ArchiverTestCaseBase): @@ -258,3 +259,12 @@ class ArchiverTestCase(ArchiverTestCaseBase): assert "Comment: modified comment" in self.cmd(f"--repo={self.repository_location}", "info", "-a", "test2") assert "Comment: \n" in self.cmd(f"--repo={self.repository_location}", "info", "-a", "test3") assert "Comment: preserved comment" in self.cmd(f"--repo={self.repository_location}", "info", "-a", "test4") + + +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/rename_cmd.py b/src/borg/testsuite/archiver/rename_cmd.py index 1c05ca128..7c1591dab 100644 --- a/src/borg/testsuite/archiver/rename_cmd.py +++ b/src/borg/testsuite/archiver/rename_cmd.py @@ -1,7 +1,9 @@ +import unittest + from ...constants import * # NOQA from ...manifest import Manifest from ...repository import Repository -from . import ArchiverTestCaseBase, RK_ENCRYPTION +from . import ArchiverTestCaseBase, RemoteArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, BORG_EXES class ArchiverTestCase(ArchiverTestCaseBase): @@ -24,3 +26,12 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.assert_equal(len(manifest.archives), 2) self.assert_in("test.3", manifest.archives) self.assert_in("test.4", manifest.archives) + + +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/rinfo_cmd.py b/src/borg/testsuite/archiver/rinfo_cmd.py index 77f453815..a661afcaf 100644 --- a/src/borg/testsuite/archiver/rinfo_cmd.py +++ b/src/borg/testsuite/archiver/rinfo_cmd.py @@ -1,6 +1,15 @@ import json +import unittest + from ...constants import * # NOQA -from . import ArchiverTestCaseBase, RK_ENCRYPTION, checkts +from . import ( + ArchiverTestCaseBase, + RemoteArchiverTestCaseBase, + ArchiverTestCaseBinaryBase, + RK_ENCRYPTION, + BORG_EXES, + checkts, +) class ArchiverTestCase(ArchiverTestCaseBase): @@ -26,3 +35,12 @@ class ArchiverTestCase(ArchiverTestCaseBase): stats = cache["stats"] assert all(isinstance(o, int) for o in stats.values()) assert all(key in stats for key in ("total_chunks", "total_size", "total_unique_chunks", "unique_size")) + + +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/rlist_cmd.py b/src/borg/testsuite/archiver/rlist_cmd.py index 115089e41..c5de4ff74 100644 --- a/src/borg/testsuite/archiver/rlist_cmd.py +++ b/src/borg/testsuite/archiver/rlist_cmd.py @@ -1,7 +1,16 @@ import json +import unittest from ...constants import * # NOQA -from . import ArchiverTestCaseBase, src_dir, RK_ENCRYPTION, checkts +from . import ( + ArchiverTestCaseBase, + RemoteArchiverTestCaseBase, + ArchiverTestCaseBinaryBase, + src_dir, + RK_ENCRYPTION, + checkts, + BORG_EXES, +) class ArchiverTestCase(ArchiverTestCaseBase): @@ -60,3 +69,12 @@ class ArchiverTestCase(ArchiverTestCaseBase): assert "keyfile" not in list_repo["encryption"] archive0 = list_repo["archives"][0] checkts(archive0["time"]) + + +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/tar_cmds.py b/src/borg/testsuite/archiver/tar_cmds.py index 26e546d69..caf890d09 100644 --- a/src/borg/testsuite/archiver/tar_cmds.py +++ b/src/borg/testsuite/archiver/tar_cmds.py @@ -1,12 +1,20 @@ import os import shutil import subprocess +import unittest import pytest from ...constants import * # NOQA from .. import changedir -from . import ArchiverTestCaseBase, RK_ENCRYPTION, requires_hardlinks +from . import ( + ArchiverTestCaseBase, + RemoteArchiverTestCaseBase, + ArchiverTestCaseBinaryBase, + RK_ENCRYPTION, + requires_hardlinks, + BORG_EXES, +) def have_gnutar(): @@ -145,3 +153,12 @@ class ArchiverTestCase(ArchiverTestCaseBase): with changedir(self.output_path): self.cmd(f"--repo={self.repository_location}", "extract", "dst") self.assert_dirs_equal("input", "output/input") + + +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary""" diff --git a/src/borg/testsuite/archiver/transfer_cmd.py b/src/borg/testsuite/archiver/transfer_cmd.py index 0c3231ffb..c653b7761 100644 --- a/src/borg/testsuite/archiver/transfer_cmd.py +++ b/src/borg/testsuite/archiver/transfer_cmd.py @@ -1,5 +1,7 @@ +import unittest + from ...constants import * # NOQA -from . import ArchiverTestCaseBase, RK_ENCRYPTION +from . import ArchiverTestCaseBase, RemoteArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, BORG_EXES class ArchiverTestCase(ArchiverTestCaseBase): @@ -28,3 +30,12 @@ class ArchiverTestCase(ArchiverTestCaseBase): self.cmd(repo2, "transfer", other_repo1) self.cmd(repo2, "transfer", other_repo1, "--dry-run") check_repo(repo2) + + +class RemoteArchiverTestCase(RemoteArchiverTestCaseBase, ArchiverTestCase): + """run the same tests, but with a remote repository""" + + +@unittest.skipUnless("binary" in BORG_EXES, "no borg.exe available") +class ArchiverTestCaseBinary(ArchiverTestCaseBinaryBase, ArchiverTestCase): + """runs the same tests, but via the borg binary"""