def test_backup_restore(self): """ TestCase: http://www.freeipa.org/page/V4/Replica_Promotion/Test_plan#Test_case: _ipa-restore_after_domainlevel_raise_restores_original_domain_level """ command = ["ipa", "topologysegment-find", DOMAIN_SUFFIX_NAME] tasks.install_replica(self.master, self.replicas[0]) backup_file = tasks.ipa_backup(self.master) self.master.run_command(["ipa", "domainlevel-set", str(DOMAIN_LEVEL_1)]) # We need to give the server time to merge 2 one-way segments into one time.sleep(10) result = self.master.run_command(command) found1 = result.stdout_text.rfind("1 segment matched") assert(found1 > 0), result.stdout_text tasks.ipa_restore(self.master, backup_file) result2 = self.master.run_command(command, raiseonerr=False) found2 = result2.stdout_text.rfind("0 segments matched") assert(found2 > 0), result2.stdout_text