mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Tests for backup-restore when pkg required is missing
Tests for ipa-restore behaviour when dns or adtrust rpm is missing which is required during ipa-restore https://pagure.io/freeipa/issue/7630 Signed-off-by: Kaleemullah Siddiqui <ksiddiqu@redhat.com> Reviewed-By: Florence Blanc-Renaud <flo@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
parent
ba904672a2
commit
10e8e7af03
@ -1472,3 +1472,15 @@ jobs:
|
|||||||
template: *ci-master-latest
|
template: *ci-master-latest
|
||||||
timeout: 7200
|
timeout: 7200
|
||||||
topology: *adroot_adchild_adtree_master_1client
|
topology: *adroot_adchild_adtree_master_1client
|
||||||
|
|
||||||
|
fedora-latest/test_backup_and_restore_TestBackupAndRestoreTrust:
|
||||||
|
requires: [fedora-latest/build]
|
||||||
|
priority: 50
|
||||||
|
job:
|
||||||
|
class: RunPytest
|
||||||
|
args:
|
||||||
|
build_url: '{fedora-latest/build_url}'
|
||||||
|
test_suite: test_integration/test_backup_and_restore.py::TestBackupAndRestoreTrust
|
||||||
|
template: *ci-master-latest
|
||||||
|
timeout: 7200
|
||||||
|
topology: *master_1repl
|
||||||
|
@ -1574,3 +1574,16 @@ jobs:
|
|||||||
template: *testing-master-latest
|
template: *testing-master-latest
|
||||||
timeout: 7200
|
timeout: 7200
|
||||||
topology: *adroot_adchild_adtree_master_1client
|
topology: *adroot_adchild_adtree_master_1client
|
||||||
|
|
||||||
|
testing-fedora/test_backup_and_restore_TestBackupAndRestoreTrust:
|
||||||
|
requires: [testing-fedora/build]
|
||||||
|
priority: 50
|
||||||
|
job:
|
||||||
|
class: RunPytest
|
||||||
|
args:
|
||||||
|
build_url: '{testing-fedora/build_url}'
|
||||||
|
update_packages: True
|
||||||
|
test_suite: test_integration/test_backup_and_restore.py::TestBackupAndRestoreTrust
|
||||||
|
template: *testing-master-latest
|
||||||
|
timeout: 7200
|
||||||
|
topology: *master_1repl
|
||||||
|
@ -1448,3 +1448,15 @@ jobs:
|
|||||||
template: *ci-master-previous
|
template: *ci-master-previous
|
||||||
timeout: 7200
|
timeout: 7200
|
||||||
topology: *adroot_adchild_adtree_master_1client
|
topology: *adroot_adchild_adtree_master_1client
|
||||||
|
|
||||||
|
fedora-previous/test_backup_and_restore_TestBackupAndRestoreTrust:
|
||||||
|
requires: [fedora-previous/build]
|
||||||
|
priority: 50
|
||||||
|
job:
|
||||||
|
class: RunPytest
|
||||||
|
args:
|
||||||
|
build_url: '{fedora-previous/build_url}'
|
||||||
|
test_suite: test_integration/test_backup_and_restore.py::TestBackupAndRestoreTrust
|
||||||
|
template: *ci-master-previous
|
||||||
|
timeout: 7200
|
||||||
|
topology: *master_1repl
|
||||||
|
@ -1588,3 +1588,16 @@ jobs:
|
|||||||
template: *ci-master-frawhide
|
template: *ci-master-frawhide
|
||||||
timeout: 7200
|
timeout: 7200
|
||||||
topology: *adroot_adchild_adtree_master_1client
|
topology: *adroot_adchild_adtree_master_1client
|
||||||
|
|
||||||
|
fedora-rawhide/test_backup_and_restore_TestBackupAndRestoreTrust:
|
||||||
|
requires: [fedora-rawhide/build]
|
||||||
|
priority: 50
|
||||||
|
job:
|
||||||
|
class: RunPytest
|
||||||
|
args:
|
||||||
|
build_url: '{fedora-rawhide/build_url}'
|
||||||
|
update_packages: True
|
||||||
|
test_suite: test_integration/test_backup_and_restore.py::TestBackupAndRestoreTrust
|
||||||
|
template: *ci-master-frawhide
|
||||||
|
timeout: 7200
|
||||||
|
topology: *master_1repl
|
||||||
|
@ -2039,6 +2039,8 @@ def install_packages(host, pkgs):
|
|||||||
# Only supports RHEL 8+ and Fedora for now
|
# Only supports RHEL 8+ and Fedora for now
|
||||||
if platform in ('rhel', 'fedora'):
|
if platform in ('rhel', 'fedora'):
|
||||||
install_cmd = ['/usr/bin/dnf', 'install', '-y']
|
install_cmd = ['/usr/bin/dnf', 'install', '-y']
|
||||||
|
elif platform in ('ubuntu'):
|
||||||
|
install_cmd = ['apt-get', 'install', '-y']
|
||||||
else:
|
else:
|
||||||
raise ValueError('install_packages: unknown platform %s' % platform)
|
raise ValueError('install_packages: unknown platform %s' % platform)
|
||||||
host.run_command(install_cmd + pkgs)
|
host.run_command(install_cmd + pkgs)
|
||||||
@ -2053,6 +2055,8 @@ def uninstall_packages(host, pkgs):
|
|||||||
# Only supports RHEL 8+ and Fedora for now
|
# Only supports RHEL 8+ and Fedora for now
|
||||||
if platform in ('rhel', 'fedora'):
|
if platform in ('rhel', 'fedora'):
|
||||||
install_cmd = ['/usr/bin/dnf', 'remove', '-y']
|
install_cmd = ['/usr/bin/dnf', 'remove', '-y']
|
||||||
|
elif platform in ('ubuntu'):
|
||||||
|
install_cmd = ['apt-get', 'remove', '-y']
|
||||||
else:
|
else:
|
||||||
raise ValueError('install_packages: unknown platform %s' % platform)
|
raise ValueError('install_packages: unknown platform %s' % platform)
|
||||||
host.run_command(install_cmd + pkgs)
|
host.run_command(install_cmd + pkgs)
|
||||||
|
@ -297,7 +297,10 @@ class BaseBackupAndRestoreWithDNS(IntegrationTest):
|
|||||||
tasks.install_master(cls.master, setup_dns=True)
|
tasks.install_master(cls.master, setup_dns=True)
|
||||||
|
|
||||||
def _full_backup_restore_with_DNS_zone(self, reinstall=False):
|
def _full_backup_restore_with_DNS_zone(self, reinstall=False):
|
||||||
"""backup, uninstall, restore"""
|
"""backup, uninstall, restore.
|
||||||
|
|
||||||
|
Test for bug https://pagure.io/freeipa/issue/7630.
|
||||||
|
"""
|
||||||
with restore_checker(self.master):
|
with restore_checker(self.master):
|
||||||
self.master.run_command([
|
self.master.run_command([
|
||||||
'ipa', 'dnszone-add',
|
'ipa', 'dnszone-add',
|
||||||
@ -312,13 +315,20 @@ class BaseBackupAndRestoreWithDNS(IntegrationTest):
|
|||||||
'--uninstall',
|
'--uninstall',
|
||||||
'-U'])
|
'-U'])
|
||||||
|
|
||||||
|
tasks.uninstall_packages(self.master, ['*ipa-server-dns'])
|
||||||
if reinstall:
|
if reinstall:
|
||||||
tasks.install_master(self.master, setup_dns=True)
|
tasks.install_master(self.master, setup_dns=True)
|
||||||
|
|
||||||
dirman_password = self.master.config.dirman_password
|
dirman_password = self.master.config.dirman_password
|
||||||
|
result = self.master.run_command(
|
||||||
|
['ipa-restore', backup_path],
|
||||||
|
stdin_text=dirman_password + '\nyes',
|
||||||
|
raiseonerr=False)
|
||||||
|
assert 'Please install the package' in result.stderr_text
|
||||||
|
|
||||||
|
tasks.install_packages(self.master, ['*ipa-server-dns'])
|
||||||
self.master.run_command(['ipa-restore', backup_path],
|
self.master.run_command(['ipa-restore', backup_path],
|
||||||
stdin_text=dirman_password + '\nyes')
|
stdin_text=dirman_password + '\nyes')
|
||||||
|
|
||||||
tasks.resolve_record(self.master.ip, self.example_test_zone)
|
tasks.resolve_record(self.master.ip, self.example_test_zone)
|
||||||
|
|
||||||
tasks.kinit_admin(self.master)
|
tasks.kinit_admin(self.master)
|
||||||
@ -861,3 +871,39 @@ class TestReplicaInstallAfterRestore(IntegrationTest):
|
|||||||
# install second replica after restore
|
# install second replica after restore
|
||||||
tasks.install_replica(master, replica2)
|
tasks.install_replica(master, replica2)
|
||||||
check_replication(master, replica2, "testuser2")
|
check_replication(master, replica2, "testuser2")
|
||||||
|
|
||||||
|
|
||||||
|
class TestBackupAndRestoreTrust(IntegrationTest):
|
||||||
|
"""Test for Backup and Restore for Trust scenario"""
|
||||||
|
topology = 'star'
|
||||||
|
|
||||||
|
def test_restore_trust_pkg_before_restore(self):
|
||||||
|
"""Test restore with adtrust when trust-ad pkg is missing.
|
||||||
|
|
||||||
|
Test for bug https://pagure.io/freeipa/issue/7630.
|
||||||
|
"""
|
||||||
|
tasks.install_packages(self.master, ['*ipa-server-trust-ad'])
|
||||||
|
self.master.run_command(['ipa-adtrust-install', '-U',
|
||||||
|
'--enable-compat', '--netbios-name', 'IPA',
|
||||||
|
'-a', self.master.config.admin_password,
|
||||||
|
'--add-sids'])
|
||||||
|
|
||||||
|
with restore_checker(self.master):
|
||||||
|
backup_path = backup(self.master)
|
||||||
|
|
||||||
|
self.master.run_command(['ipa-server-install',
|
||||||
|
'--uninstall',
|
||||||
|
'-U'])
|
||||||
|
|
||||||
|
tasks.uninstall_packages(self.master, ['*ipa-server-trust-ad'])
|
||||||
|
|
||||||
|
dirman_password = self.master.config.dirman_password
|
||||||
|
result = self.master.run_command(
|
||||||
|
['ipa-restore', backup_path],
|
||||||
|
stdin_text=dirman_password + '\nyes',
|
||||||
|
raiseonerr=False)
|
||||||
|
assert 'Please install the package' in result.stderr_text
|
||||||
|
|
||||||
|
tasks.install_packages(self.master, ['*ipa-server-trust-ad'])
|
||||||
|
self.master.run_command(['ipa-restore', backup_path],
|
||||||
|
stdin_text=dirman_password + '\nyes')
|
||||||
|
Loading…
Reference in New Issue
Block a user