diff --git a/test/resources/libostree.py b/test/resources/libostree.py index 9cdc0ade53..633fa0af9b 100644 --- a/test/resources/libostree.py +++ b/test/resources/libostree.py @@ -67,13 +67,13 @@ def create_fake_backups(count: int, type_unknown: bool = False) -> None: and are therefore unknown to MicroShift. """ deploy_id = get_booted_deployment_id() - prefix_path = get_deployment_backup_prefix_path(deploy_id) + prefix_path = f"{get_deployment_backup_prefix_path(deploy_id)}_fake" if type_unknown: prefix_path = os.path.join(BACKUP_STORAGE, "unknown") for number in range(0, count): - remote_sudo(f"mkdir -p {prefix_path}_fake{number}") + remote_sudo(f"mkdir -p {prefix_path}{number}") def remove_backups_for_deployment(deploy_id: str) -> None: diff --git a/test/suites-ostree/backup-prune.robot b/test/suites-ostree/backup-prune.robot index 33d2f25cad..79ca0bdcd7 100644 --- a/test/suites-ostree/backup-prune.robot +++ b/test/suites-ostree/backup-prune.robot @@ -2,6 +2,7 @@ Documentation Tests related to MicroShift backup functionality on OSTree-based systems Resource ../resources/common.resource +Resource ../resources/ostree.resource Resource ../resources/ostree-data.resource Library Collections @@ -16,27 +17,19 @@ ${USHIFT_HOST} ${EMPTY} ${USHIFT_USER} ${EMPTY} ${FAKE_DIR_REG} *_fake* -${UNKOWN_DIR_REG} unknown_fake* +${UNKOWN_DIR_REG} unknown* *** Test Cases *** Rebooting Healthy System Should Result In Pruning Old Backups [Documentation] Check that MicroShift backup logic prunes old backups - Create Fake Backup Directories - Validate Fake Backups Exist - Reboot MicroShift Host - Wait For MicroShift Service Validate Fake Backups Have Been Deleted Rebooting Healthy System Should Not Delete Unknown Directories [Documentation] Check that MicroShift backup logic does not delete unknown directories - Create Fake Unknown Backup Directories - Validate Unknown Fake Backups Exist - Reboot MicroShift Host - Wait For MicroShift Service - Validate Unknown Fake Backups Exist + Validate Unknown Directories Exist *** Keywords *** @@ -52,15 +45,15 @@ Validate Fake Backups Have Been Deleted [Documentation] Listing the fake backups should return an error code of 2 if no longer exists List Backups With Expected RC 2 ${FAKE_DIR_REG} -Create Fake Unknown Backup Directories - [Documentation] Create unknown fake backup folders +Create Unknown Directories + [Documentation] Create unknown fake folders that the pruning logic should not touch Create Fake Backups 2 True -Validate Unknown Fake Backups Exist +Validate Unknown Directories Exist [Documentation] Make sure the unknown fake backups exist List Backups With Expected RC 0 ${UNKOWN_DIR_REG} -Delete Unkown Fake Backups +Delete Unknown Directories [Documentation] Remove unknown directories ${stdout} ${rc}= Execute Command @@ -81,7 +74,16 @@ Setup Check Required Env Variables Login MicroShift Host + Create Fake Backup Directories + Validate Fake Backups Exist + + Create Unknown Directories + Validate Unknown Directories Exist + + Reboot MicroShift Host + Wait For Healthy System + Teardown [Documentation] Test suite teardown - Delete Unkown Fake Backups + Delete Unknown Directories Logout MicroShift Host