mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-11 09:59:19 -04:00
add remote repo / borg binary testing
This commit is contained in:
parent
f410de690d
commit
5d7b48ced8
21 changed files with 300 additions and 25 deletions
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue