mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Misc test fixes for corrupted archive test though not sure what doing ..
This commit is contained in:
parent
037a2a66a4
commit
80e2e0da71
2 changed files with 7 additions and 5 deletions
|
@ -2418,7 +2418,7 @@ def backup_info(name, with_details=False, human_readable=False):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
files_in_archive = tar.getnames()
|
files_in_archive = tar.getnames()
|
||||||
except IOError as e:
|
except (IOError, EOFError) as e:
|
||||||
raise YunohostError(
|
raise YunohostError(
|
||||||
"backup_archive_corrupted", archive=archive_file, error=str(e)
|
"backup_archive_corrupted", archive=archive_file, error=str(e)
|
||||||
)
|
)
|
||||||
|
@ -2532,6 +2532,8 @@ def backup_delete(name):
|
||||||
files_to_delete.append(actual_archive)
|
files_to_delete.append(actual_archive)
|
||||||
|
|
||||||
for backup_file in files_to_delete:
|
for backup_file in files_to_delete:
|
||||||
|
if not os.path.exists(backup_file):
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
os.remove(backup_file)
|
os.remove(backup_file)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
@ -640,13 +640,13 @@ def test_restore_archive_with_bad_archive(mocker):
|
||||||
|
|
||||||
# Break the archive
|
# Break the archive
|
||||||
os.system(
|
os.system(
|
||||||
"head -n 1000 /home/yunohost.backup/archives/backup_wordpress_from_3p8.tar.gz > /home/yunohost.backup/archives/backup_wordpress_from_3p8.tar.gz"
|
"head -n 1000 /home/yunohost.backup/archives/backup_wordpress_from_3p8.tar.gz > /home/yunohost.backup/archives/backup_wordpress_from_3p8_bad.tar.gz"
|
||||||
)
|
)
|
||||||
|
|
||||||
assert "backup_wordpress_from_3p8" in backup_list()["archives"]
|
assert "backup_wordpress_from_3p8_bad" in backup_list()["archives"]
|
||||||
|
|
||||||
with raiseYunohostError(mocker, "backup_archive_open_failed"):
|
with raiseYunohostError(mocker, "backup_archive_corrupted"):
|
||||||
backup_restore(name="backup_wordpress_from_3p8", force=True)
|
backup_restore(name="backup_wordpress_from_3p8_bad", force=True)
|
||||||
|
|
||||||
clean_tmp_backup_directory()
|
clean_tmp_backup_directory()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue