mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #673 from YunoHost/fix-backup-tests
Fix backup tests
This commit is contained in:
commit
f221024e19
2 changed files with 14 additions and 5 deletions
|
@ -1633,9 +1633,18 @@ class BackupMethod(object):
|
|||
# 'NUMBER OF HARD LINKS > 1' see #1043
|
||||
cron_path = os.path.abspath('/etc/cron') + '.'
|
||||
if not os.path.abspath(src).startswith(cron_path):
|
||||
os.link(src, dest)
|
||||
# Success, go to next file to organize
|
||||
continue
|
||||
try:
|
||||
os.link(src, dest)
|
||||
except Exception as e:
|
||||
# This kind of situation may happen when src and dest are on different
|
||||
# logical volume ... even though the st_dev check previously match...
|
||||
# E.g. this happens when running an encrypted hard drive
|
||||
# where everything is mapped to /dev/mapper/some-stuff
|
||||
# yet there are different devices behind it or idk ...
|
||||
logger.warning("Could not link %s to %s (%s) ... falling back to regular copy." % (src, dest, str(e)))
|
||||
else:
|
||||
# Success, go to next file to organize
|
||||
continue
|
||||
|
||||
# If mountbind or hardlink couldnt be created,
|
||||
# prepare a list of files that need to be copied
|
||||
|
|
|
@ -42,7 +42,7 @@ def setup_function(function):
|
|||
|
||||
assert len(backup_list()["archives"]) == 0
|
||||
|
||||
markers = function.__dict__.keys()
|
||||
markers = [m.name for m in function.__dict__.get("pytestmark",[])]
|
||||
|
||||
if "with_wordpress_archive_from_2p4" in markers:
|
||||
add_archive_wordpress_from_2p4()
|
||||
|
@ -82,7 +82,7 @@ def teardown_function(function):
|
|||
delete_all_backups()
|
||||
uninstall_test_apps_if_needed()
|
||||
|
||||
markers = function.__dict__.keys()
|
||||
markers = [m.name for m in function.__dict__.get("pytestmark",[])]
|
||||
|
||||
if "clean_opt_dir" in markers:
|
||||
shutil.rmtree("/opt/test_backup_output_directory")
|
||||
|
|
Loading…
Add table
Reference in a new issue