Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/resources/libostree.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
32 changes: 17 additions & 15 deletions test/suites-ostree/backup-prune.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 ***
Expand All @@ -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
Expand All @@ -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