Skip to content
Open
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
21 changes: 17 additions & 4 deletions tests/backup_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@
BACKUP_DIR = "/tmp/foremanctl-backup-test"


def backup_command(server_hostname):
return [
'./foremanctl', 'backup', BACKUP_DIR,
'--target-host', server_hostname,
'--wait-for-tasks',
]


def test_backup_command_waits_for_tasks(server_hostname):
assert backup_command(server_hostname) == [
'./foremanctl', 'backup', BACKUP_DIR,
'--target-host', server_hostname,
'--wait-for-tasks',
]


@pytest.fixture(scope="module")
def expected_databases(enabled_features):
"""
Expand Down Expand Up @@ -50,10 +66,7 @@ def backup_result(server, server_hostname):
result = server.run(f"mkdir -p {BACKUP_DIR}")
assert result.rc == 0, f"Failed to create backup directory on VM: {result.stderr}"

result = subprocess.run(
['./foremanctl', 'backup', BACKUP_DIR, '--target-host', server_hostname],
capture_output=True, text=True,
)
result = subprocess.run(backup_command(server_hostname), capture_output=True, text=True)
returncode = result.returncode

find_result = server.run(f"ls -1 {BACKUP_DIR}")
Expand Down
Loading