ipatests: backup-reinstall-restore needs to clear sssd cache

The integration tests that check backup-reinstall-restore
scenario need to clear sssd cache before checking the uid
of the admin user. For instance:
backup: saves the original admin uid
reinstall: creates a new admin uid, potentially cached by SSSD
restore: restores the original admin uid

Related: https://pagure.io/freeipa/issue/8995
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Florence Blanc-Renaud 2021-10-20 10:43:33 +02:00
parent fd53ed14b0
commit c99b8bb4ab

View File

@ -311,6 +311,11 @@ class BaseBackupAndRestoreWithDNS(IntegrationTest):
tasks.install_master(self.master, setup_dns=True) tasks.install_master(self.master, setup_dns=True)
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')
if reinstall:
# If the server was reinstalled, reinstall may have changed
# the uid and restore reverts to the original value.
# clear the cache to make sure we get up-to-date values
tasks.clear_sssd_cache(self.master)
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)
@ -380,6 +385,12 @@ class BaseBackupAndRestoreWithDNSSEC(IntegrationTest):
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')
if reinstall:
# If the server was reinstalled, reinstall may have changed
# the uid and restore reverts to the original value.
# clear the cache to make sure we get up-to-date values
tasks.clear_sssd_cache(self.master)
assert ( assert (
wait_until_record_is_signed( wait_until_record_is_signed(
self.master.ip, self.example_test_zone) self.master.ip, self.example_test_zone)
@ -464,6 +475,12 @@ class BaseBackupAndRestoreWithKRA(IntegrationTest):
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')
if reinstall:
# If the server was reinstalled, reinstall may have changed
# the uid and restore reverts to the original value.
# clear the cache to make sure we get up-to-date values
tasks.clear_sssd_cache(self.master)
tasks.kinit_admin(self.master) tasks.kinit_admin(self.master)
# retrieve secret after restore # retrieve secret after restore
self.master.run_command([ self.master.run_command([