From 60e992ca569543b7cf74366a7feece71f62f2db3 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 10 May 2018 12:53:20 +0200 Subject: [PATCH] Fix test_server_del::TestLastServices The reason why the test started to fail is probably commit be3ad1e where the checks were reordered. TestLastServices relies on execution of tests in a specific order. So it fails given that checks were changed but tests weren't. Given that master is installed with DNS and CA and replica with anything and given that checks in server-del command are in order: DNS, DNSSec, CA, KRA then the test should be something like: * install master (with DNS, CA) * install replica * test test_removal_of_master_raises_error_about_last_dns * test_install_dns_on_replica1_and_dnssec_on_master (installing DNS and DNSSec will allow DNSSec check) * test_removal_of_master_raises_error_about_dnssec * test_disable_dnssec_on_master (will allow CA check) * test_removal_of_master_raises_error_about_last_ca * test_forced_removal_of_master https://pagure.io/freeipa/issue/7517 Signed-off-by: Petr Vobornik Reviewed-By: Florence Blanc-Renaud --- ipatests/test_integration/test_server_del.py | 43 ++++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/ipatests/test_integration/test_server_del.py b/ipatests/test_integration/test_server_del.py index f5738a3a5..c35bcb87d 100644 --- a/ipatests/test_integration/test_server_del.py +++ b/ipatests/test_integration/test_server_del.py @@ -241,23 +241,6 @@ class TestLastServices(ServerDelBase): cls.topology, cls.master, cls.replicas, [], domain_level=cls.domain_level, setup_replica_cas=False) - def test_removal_of_master_raises_error_about_last_ca(self): - """ - test that removal of master fails on the last - """ - tasks.assert_error( - tasks.run_server_del(self.replicas[0], self.master.hostname), - "Deleting this server is not allowed as it would leave your " - "installation without a CA.", - 1 - ) - - def test_install_ca_on_replica1(self): - """ - Install CA on replica so that we can test DNS-related checks - """ - tasks.install_ca(self.replicas[0], domain_level=self.domain_level) - def test_removal_of_master_raises_error_about_last_dns(self): """ Now server-del should complain about the removal of last DNS server @@ -291,6 +274,32 @@ class TestLastServices(ServerDelBase): 1 ) + def test_disable_dnssec_on_master(self): + """ + Disable DNSSec master so that it is not tested anymore. Normal way + would be to move the DNSSec master to replica, but that is tested in + DNSSec tests. + """ + args = [ + "ipa-dns-install", + "--disable-dnssec-master", + "--forwarder", self.master.config.dns_forwarder, + "--force", + "-U", + ] + self.master.run_command(args) + + def test_removal_of_master_raises_error_about_last_ca(self): + """ + test that removal of master fails on the last + """ + tasks.assert_error( + tasks.run_server_del(self.replicas[0], self.master.hostname), + "Deleting this server is not allowed as it would leave your " + "installation without a CA.", + 1 + ) + def test_forced_removal_of_master(self): """ Tests that we can still force remove the master using