From c99b8bb4abbbfc9611185adc1b1168cce2c79cf3 Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud Date: Wed, 20 Oct 2021 10:43:33 +0200 Subject: [PATCH] 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 Reviewed-By: Christian Heimes Reviewed-By: Rob Crittenden Reviewed-By: Alexander Bokovoy --- .../test_integration/test_backup_and_restore.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ipatests/test_integration/test_backup_and_restore.py b/ipatests/test_integration/test_backup_and_restore.py index dcaddb1a1..a10c96f80 100644 --- a/ipatests/test_integration/test_backup_and_restore.py +++ b/ipatests/test_integration/test_backup_and_restore.py @@ -311,6 +311,11 @@ class BaseBackupAndRestoreWithDNS(IntegrationTest): tasks.install_master(self.master, setup_dns=True) self.master.run_command(['ipa-restore', backup_path], 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.kinit_admin(self.master) @@ -380,6 +385,12 @@ class BaseBackupAndRestoreWithDNSSEC(IntegrationTest): self.master.run_command(['ipa-restore', backup_path], 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 ( wait_until_record_is_signed( self.master.ip, self.example_test_zone) @@ -464,6 +475,12 @@ class BaseBackupAndRestoreWithKRA(IntegrationTest): self.master.run_command(['ipa-restore', backup_path], 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) # retrieve secret after restore self.master.run_command([