mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-11 01:41:57 -04:00
Merge pull request #9185 from ThomasWaldmann/tests-fs-cleanup-master
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
Tests fs cleanup (master)
This commit is contained in:
commit
2c2b0343b2
4 changed files with 23 additions and 16 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import shutil
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
@ -24,10 +25,13 @@ def clean_env(tmpdir_factory, monkeypatch):
|
|||
for key in keys:
|
||||
monkeypatch.delenv(key, raising=False)
|
||||
# avoid that we access / modify the user's normal .config / .cache directory:
|
||||
monkeypatch.setenv("BORG_BASE_DIR", str(tmpdir_factory.mktemp("borg-base-dir")))
|
||||
base_dir = tmpdir_factory.mktemp("borg-base-dir")
|
||||
monkeypatch.setenv("BORG_BASE_DIR", str(base_dir))
|
||||
# Speed up tests
|
||||
monkeypatch.setenv("BORG_TESTONLY_WEAKEN_KDF", "1")
|
||||
monkeypatch.setenv("BORG_STORE_DATA_LEVELS", "0") # flat storage for few objects
|
||||
yield
|
||||
shutil.rmtree(str(base_dir), ignore_errors=True) # clean up
|
||||
|
||||
|
||||
def pytest_report_header(config, start_path):
|
||||
|
|
@ -116,6 +120,7 @@ def archiver(tmp_path, set_env_variables):
|
|||
os.chdir(archiver.tmpdir)
|
||||
yield archiver
|
||||
os.chdir(old_wd)
|
||||
shutil.rmtree(archiver.tmpdir, ignore_errors=True) # clean up
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
|
|
|
|||
|
|
@ -514,10 +514,12 @@ def fuse_mount(archiver, mountpoint=None, *options, fork=True, os_fork=False, **
|
|||
# with the call to `cmd`, above.
|
||||
yield
|
||||
return
|
||||
wait_for_mountstate(mountpoint, mounted=True)
|
||||
yield
|
||||
umount(mountpoint)
|
||||
wait_for_mountstate(mountpoint, mounted=False)
|
||||
os.rmdir(mountpoint)
|
||||
try:
|
||||
wait_for_mountstate(mountpoint, mounted=True)
|
||||
yield
|
||||
finally:
|
||||
umount(mountpoint)
|
||||
wait_for_mountstate(mountpoint, mounted=False)
|
||||
os.rmdir(mountpoint)
|
||||
# Give the daemon some time to exit
|
||||
time.sleep(0.2)
|
||||
|
|
|
|||
|
|
@ -86,11 +86,11 @@ def test_access_acl():
|
|||
|
||||
@skipif_acls_not_working
|
||||
def test_default_acl():
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
assert get_acl(tmpdir) == {}
|
||||
set_acl(tmpdir, access=ACCESS_ACL, default=DEFAULT_ACL)
|
||||
assert get_acl(tmpdir)["acl_access"] == ACCESS_ACL
|
||||
assert get_acl(tmpdir)["acl_default"] == DEFAULT_ACL
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
assert get_acl(tmpdir) == {}
|
||||
set_acl(tmpdir, access=ACCESS_ACL, default=DEFAULT_ACL)
|
||||
assert get_acl(tmpdir)["acl_access"] == ACCESS_ACL
|
||||
assert get_acl(tmpdir)["acl_default"] == DEFAULT_ACL
|
||||
|
||||
|
||||
# nfs4 acls testing not implemented.
|
||||
|
|
|
|||
|
|
@ -72,11 +72,11 @@ def test_access_acl():
|
|||
|
||||
@skipif_acls_not_working
|
||||
def test_default_acl():
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
assert get_acl(tmpdir) == {}
|
||||
set_acl(tmpdir, access=ACCESS_ACL, default=DEFAULT_ACL)
|
||||
assert get_acl(tmpdir)["acl_access"] == ACCESS_ACL
|
||||
assert get_acl(tmpdir)["acl_default"] == DEFAULT_ACL
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
assert get_acl(tmpdir) == {}
|
||||
set_acl(tmpdir, access=ACCESS_ACL, default=DEFAULT_ACL)
|
||||
assert get_acl(tmpdir)["acl_access"] == ACCESS_ACL
|
||||
assert get_acl(tmpdir)["acl_default"] == DEFAULT_ACL
|
||||
|
||||
|
||||
@skipif_acls_not_working
|
||||
|
|
|
|||
Loading…
Reference in a new issue