mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Use backups from 3.8 instead of old 2.4 archives for system/apps restore tests
This commit is contained in:
parent
8b8a8fb3c7
commit
a8656c835c
1 changed files with 29 additions and 29 deletions
|
@ -47,8 +47,8 @@ def setup_function(function):
|
||||||
for m in function.__dict__.get("pytestmark", [])
|
for m in function.__dict__.get("pytestmark", [])
|
||||||
}
|
}
|
||||||
|
|
||||||
if "with_wordpress_archive_from_2p4" in markers:
|
if "with_wordpress_archive_from_3p8" in markers:
|
||||||
add_archive_wordpress_from_2p4()
|
add_archive_wordpress_from_3p8()
|
||||||
assert len(backup_list()["archives"]) == 1
|
assert len(backup_list()["archives"]) == 1
|
||||||
|
|
||||||
if "with_legacy_app_installed" in markers:
|
if "with_legacy_app_installed" in markers:
|
||||||
|
@ -70,8 +70,8 @@ def setup_function(function):
|
||||||
)
|
)
|
||||||
assert app_is_installed("backup_recommended_app")
|
assert app_is_installed("backup_recommended_app")
|
||||||
|
|
||||||
if "with_system_archive_from_2p4" in markers:
|
if "with_system_archive_from_3p8" in markers:
|
||||||
add_archive_system_from_2p4()
|
add_archive_system_from_3p8()
|
||||||
assert len(backup_list()["archives"]) == 1
|
assert len(backup_list()["archives"]) == 1
|
||||||
|
|
||||||
if "with_permission_app_installed" in markers:
|
if "with_permission_app_installed" in markers:
|
||||||
|
@ -147,7 +147,7 @@ def backup_test_dependencies_are_met():
|
||||||
|
|
||||||
# Dummy test apps (or backup archives)
|
# Dummy test apps (or backup archives)
|
||||||
assert os.path.exists(
|
assert os.path.exists(
|
||||||
os.path.join(get_test_apps_dir(), "backup_wordpress_from_2p4")
|
os.path.join(get_test_apps_dir(), "backup_wordpress_from_3p8")
|
||||||
)
|
)
|
||||||
assert os.path.exists(os.path.join(get_test_apps_dir(), "legacy_app_ynh"))
|
assert os.path.exists(os.path.join(get_test_apps_dir(), "legacy_app_ynh"))
|
||||||
assert os.path.exists(
|
assert os.path.exists(
|
||||||
|
@ -216,39 +216,39 @@ def install_app(app, path, additionnal_args=""):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def add_archive_wordpress_from_2p4():
|
def add_archive_wordpress_from_3p8():
|
||||||
|
|
||||||
os.system("mkdir -p /home/yunohost.backup/archives")
|
os.system("mkdir -p /home/yunohost.backup/archives")
|
||||||
|
|
||||||
os.system(
|
os.system(
|
||||||
"cp "
|
"cp "
|
||||||
+ os.path.join(
|
+ os.path.join(
|
||||||
get_test_apps_dir(), "backup_wordpress_from_2p4/backup.info.json"
|
get_test_apps_dir(), "backup_wordpress_from_3p8/backup.info.json"
|
||||||
)
|
)
|
||||||
+ " /home/yunohost.backup/archives/backup_wordpress_from_2p4.info.json"
|
+ " /home/yunohost.backup/archives/backup_wordpress_from_3p8.info.json"
|
||||||
)
|
)
|
||||||
|
|
||||||
os.system(
|
os.system(
|
||||||
"cp "
|
"cp "
|
||||||
+ os.path.join(get_test_apps_dir(), "backup_wordpress_from_2p4/backup.tar.gz")
|
+ os.path.join(get_test_apps_dir(), "backup_wordpress_from_3p8/backup.tar.gz")
|
||||||
+ " /home/yunohost.backup/archives/backup_wordpress_from_2p4.tar.gz"
|
+ " /home/yunohost.backup/archives/backup_wordpress_from_3p8.tar.gz"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def add_archive_system_from_2p4():
|
def add_archive_system_from_3p8():
|
||||||
|
|
||||||
os.system("mkdir -p /home/yunohost.backup/archives")
|
os.system("mkdir -p /home/yunohost.backup/archives")
|
||||||
|
|
||||||
os.system(
|
os.system(
|
||||||
"cp "
|
"cp "
|
||||||
+ os.path.join(get_test_apps_dir(), "backup_system_from_2p4/backup.info.json")
|
+ os.path.join(get_test_apps_dir(), "backup_system_from_3p8/backup.info.json")
|
||||||
+ " /home/yunohost.backup/archives/backup_system_from_2p4.info.json"
|
+ " /home/yunohost.backup/archives/backup_system_from_3p8.info.json"
|
||||||
)
|
)
|
||||||
|
|
||||||
os.system(
|
os.system(
|
||||||
"cp "
|
"cp "
|
||||||
+ os.path.join(get_test_apps_dir(), "backup_system_from_2p4/backup.tar.gz")
|
+ os.path.join(get_test_apps_dir(), "backup_system_from_3p8/backup.tar.gz")
|
||||||
+ " /home/yunohost.backup/archives/backup_system_from_2p4.tar.gz"
|
+ " /home/yunohost.backup/archives/backup_system_from_3p8.tar.gz"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -314,12 +314,12 @@ def test_backup_and_restore_all_sys(mocker):
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# System restore from 2.4 #
|
# System restore from 3.8 #
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.with_system_archive_from_2p4
|
@pytest.mark.with_system_archive_from_3p8
|
||||||
def test_restore_system_from_Ynh2p4(monkeypatch, mocker):
|
def test_restore_system_from_Ynh3p8(monkeypatch, mocker):
|
||||||
|
|
||||||
# Backup current system
|
# Backup current system
|
||||||
with message(mocker, "backup_created"):
|
with message(mocker, "backup_created"):
|
||||||
|
@ -327,7 +327,7 @@ def test_restore_system_from_Ynh2p4(monkeypatch, mocker):
|
||||||
archives = backup_list()["archives"]
|
archives = backup_list()["archives"]
|
||||||
assert len(archives) == 2
|
assert len(archives) == 2
|
||||||
|
|
||||||
# Restore system archive from 2.4
|
# Restore system archive from 3.8
|
||||||
try:
|
try:
|
||||||
with message(mocker, "restore_complete"):
|
with message(mocker, "restore_complete"):
|
||||||
backup_restore(
|
backup_restore(
|
||||||
|
@ -464,9 +464,9 @@ def test_backup_using_copy_method(mocker):
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.with_wordpress_archive_from_2p4
|
@pytest.mark.with_wordpress_archive_from_3p8
|
||||||
@pytest.mark.with_custom_domain("yolo.test")
|
@pytest.mark.with_custom_domain("yolo.test")
|
||||||
def test_restore_app_wordpress_from_Ynh2p4(mocker):
|
def test_restore_app_wordpress_from_Ynh3p8(mocker):
|
||||||
|
|
||||||
with message(mocker, "restore_complete"):
|
with message(mocker, "restore_complete"):
|
||||||
backup_restore(
|
backup_restore(
|
||||||
|
@ -474,7 +474,7 @@ def test_restore_app_wordpress_from_Ynh2p4(mocker):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.with_wordpress_archive_from_2p4
|
@pytest.mark.with_wordpress_archive_from_3p8
|
||||||
@pytest.mark.with_custom_domain("yolo.test")
|
@pytest.mark.with_custom_domain("yolo.test")
|
||||||
def test_restore_app_script_failure_handling(monkeypatch, mocker):
|
def test_restore_app_script_failure_handling(monkeypatch, mocker):
|
||||||
def custom_hook_exec(name, *args, **kwargs):
|
def custom_hook_exec(name, *args, **kwargs):
|
||||||
|
@ -495,7 +495,7 @@ def test_restore_app_script_failure_handling(monkeypatch, mocker):
|
||||||
assert not _is_installed("wordpress")
|
assert not _is_installed("wordpress")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.with_wordpress_archive_from_2p4
|
@pytest.mark.with_wordpress_archive_from_3p8
|
||||||
def test_restore_app_not_enough_free_space(monkeypatch, mocker):
|
def test_restore_app_not_enough_free_space(monkeypatch, mocker):
|
||||||
def custom_free_space_in_directory(dirpath):
|
def custom_free_space_in_directory(dirpath):
|
||||||
return 0
|
return 0
|
||||||
|
@ -514,7 +514,7 @@ def test_restore_app_not_enough_free_space(monkeypatch, mocker):
|
||||||
assert not _is_installed("wordpress")
|
assert not _is_installed("wordpress")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.with_wordpress_archive_from_2p4
|
@pytest.mark.with_wordpress_archive_from_3p8
|
||||||
def test_restore_app_not_in_backup(mocker):
|
def test_restore_app_not_in_backup(mocker):
|
||||||
|
|
||||||
assert not _is_installed("wordpress")
|
assert not _is_installed("wordpress")
|
||||||
|
@ -530,7 +530,7 @@ def test_restore_app_not_in_backup(mocker):
|
||||||
assert not _is_installed("yoloswag")
|
assert not _is_installed("yoloswag")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.with_wordpress_archive_from_2p4
|
@pytest.mark.with_wordpress_archive_from_3p8
|
||||||
@pytest.mark.with_custom_domain("yolo.test")
|
@pytest.mark.with_custom_domain("yolo.test")
|
||||||
def test_restore_app_already_installed(mocker):
|
def test_restore_app_already_installed(mocker):
|
||||||
|
|
||||||
|
@ -648,18 +648,18 @@ def test_restore_archive_with_no_json(mocker):
|
||||||
backup_restore(name="badbackup", force=True)
|
backup_restore(name="badbackup", force=True)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.with_wordpress_archive_from_2p4
|
@pytest.mark.with_wordpress_archive_from_3p8
|
||||||
def test_restore_archive_with_bad_archive(mocker):
|
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_2p4.tar.gz > /home/yunohost.backup/archives/backup_wordpress_from_2p4.tar.gz"
|
"head -n 1000 /home/yunohost.backup/archives/backup_wordpress_from_3p8.tar.gz > /home/yunohost.backup/archives/backup_wordpress_from_3p8.tar.gz"
|
||||||
)
|
)
|
||||||
|
|
||||||
assert "backup_wordpress_from_2p4" in backup_list()["archives"]
|
assert "backup_wordpress_from_3p8" in backup_list()["archives"]
|
||||||
|
|
||||||
with raiseYunohostError(mocker, "backup_archive_open_failed"):
|
with raiseYunohostError(mocker, "backup_archive_open_failed"):
|
||||||
backup_restore(name="backup_wordpress_from_2p4", force=True)
|
backup_restore(name="backup_wordpress_from_3p8", force=True)
|
||||||
|
|
||||||
clean_tmp_backup_directory()
|
clean_tmp_backup_directory()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue