From 352b9dfb49bdf1c70a8de9ed7287387417580c86 Mon Sep 17 00:00:00 2001 From: Michal Polovka Date: Tue, 24 May 2022 09:00:28 +0200 Subject: [PATCH] ipatests: RFE: Improve ipa-replica-install error message Test for RFE: Improve error message with more detail for ipa-replica-install command. If the replication agreement already exists, check if the error message contains a particular command needed to delete it. Related: https://pagure.io/freeipa/issue/9162 Signed-off-by: Michal Polovka Reviewed-By: Florence Blanc-Renaud --- .../test_integration/test_installation.py | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py index c2f3191c4..c7bcf253d 100644 --- a/ipatests/test_integration/test_installation.py +++ b/ipatests/test_integration/test_installation.py @@ -1836,6 +1836,48 @@ class TestInstallReplicaAgainstSpecificServer(IntegrationTest): stdin_text=dirman_password) assert self.replicas[0].hostname not in cmd.stdout_text + def test_replica_install_existing_agreement(self): + """When the replication agreement already exists, the installer + should print an error message with the information on where + and how to remove it""" + # master and replica_1 already installed by class' install() method + + # stop the main server in order to preserve the replication agreement + # when removing the replica + tasks.stop_ipa_server(self.master) + + # intentionally using ipa-server-install --uninstall + # instead of replica-manage + self.replicas[0].run_command(['ipa-server-install', + '--uninstall', + '--force', + '-U']) + tasks.start_ipa_server(self.master) + + result = tasks.install_replica(self.master, + self.replicas[0], + setup_ca=False, + setup_dns=True, + promote=False, + raiseonerr=False, + extra_args=('--force-join',)) + assert result.returncode != 0 + assert self.replicas[0].hostname in result.stderr_text + assert "server-del" in result.stderr_text + + # delete the agreement based on the error message + # and retry the installation + self.master.run_command(['ipa', + 'server-del', + self.replicas[0].hostname, + '--force']) + result = tasks.install_replica(self.master, + self.replicas[0], + setup_ca=False, + setup_dns=True, + promote=False) + assert result.returncode == 0 + class TestInstallWithoutSudo(IntegrationTest):