From 4e1c8b6faa46427e203817b126e7a3438816cdc3 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Mon, 23 Sep 2024 10:05:24 +0000 Subject: [PATCH] test(backup): total restore nocrash test --- tests/conftest.py | 1 + tests/test_backup.py | 31 ++++++++++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index e50a6ff..b20df92 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -293,6 +293,7 @@ def catch_nixos_rebuild_calls(fp): # A helper function to be used in tests of all systems that requires # rebuilds prepare_nixos_rebuild_calls(fp, API_REBUILD_SYSTEM_UNIT) + return fp def assert_rebuild_was_made(fp, unit_name): diff --git a/tests/test_backup.py b/tests/test_backup.py index bd4fa5d..f43647b 100644 --- a/tests/test_backup.py +++ b/tests/test_backup.py @@ -831,17 +831,26 @@ def test_service_manager_backs_up_without_crashing( Backups.restore_snapshot(snapshot) -# def test_backup_all_restore_all(backups, generic_userdata, dkim_file, only_dummy_service_and_api, catch_nixos_rebuild_calls): -# dummy_service = only_dummy_service_and_api -# fp = catch_nixos_rebuild_calls -# backup_job = add_total_backup_job() -# total_backup(backup_job) -# assert len(Backups.get_all_snapshots()) == 2 +def test_backup_all_restore_all( + backups, + generic_userdata, + dkim_file, + only_dummy_service_and_api, + catch_nixos_rebuild_calls, +): + dummy_service = only_dummy_service_and_api + fp = catch_nixos_rebuild_calls + fp.pass_command(["restic", fp.any()]) + fp.keep_last_process(True) -# restore_job = add_total_restore_job() + backup_job = add_total_backup_job() + total_backup(backup_job) + assert len(Backups.get_all_snapshots()) == 2 -# do_full_restore(restore_job) + restore_job = add_total_restore_job() -# # TODO: maybe test integrity. -# # since it is standard restore operations they would have failed if something went wrong -# # however, one still needs to check that all of the required restores have even started + do_full_restore(restore_job) + + # TODO: maybe test integrity. + # since it is standard restore operations they would have failed if something went wrong + # however, one still needs to check that all of the required restores have even started