ofayans's pull request #52: "Removed incorrect check for returncode" was synchronize
See the full pull-request at https://github.com/freeipa/freeipa/pull/52 ... or pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/52/head:pr52 git checkout pr52
From c0c274d9873c5be708a2a6e54356f7e611c4b330 Mon Sep 17 00:00:00 2001 From: Oleg Fayans <ofay...@redhat.com> Date: Fri, 2 Sep 2016 15:24:40 +0200 Subject: [PATCH 1/3] Removed incorrect check for returncode The server installation in most cases returns response code 0 no matter what happens except for really severe errors. In this case when we try to uninstall the middle replica of a line topology, it fails, notifies us that we should use '--ignore-topology-disconnect', but returns 0 https://fedorahosted.org/freeipa/ticket/3230 --- ipatests/test_integration/tasks.py | 2 +- ipatests/test_integration/test_replica_promotion.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py index c60d436..db99bbb 100644 --- a/ipatests/test_integration/tasks.py +++ b/ipatests/test_integration/tasks.py @@ -1190,7 +1190,7 @@ def run_server_del(host, server_to_delete, force=False, def assert_error(result, stderr_text, returncode=None): "Assert that `result` command failed and its stderr contains `stderr_text`" assert stderr_text in result.stderr_text, result.stderr_text - if returncode: + if returncode is not None: assert result.returncode == returncode else: assert result.returncode > 0 diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py index 3e62f92..e06cafd 100644 --- a/ipatests/test_integration/test_replica_promotion.py +++ b/ipatests/test_integration/test_replica_promotion.py @@ -348,10 +348,12 @@ def test_replica_uninstallation_prohibited(self): result = self.replicas[0].run_command(['ipa-server-install', '--uninstall', '-U'], raiseonerr=False) - assert(result.returncode > 0), ("The replica was removed without " - "'--ignore-topology-disconnect' option") - assert("Uninstallation leads to disconnected topology" - in result.stdout_text), ("Expected error message was not found") + # Due to ticket 3230 server installation/uninstallation always returns + # 0 unless an uncaught exception occurs. Once this issue is properly + # addressed, please care to change expected return code in the + # following assert from 0 to something else. + assert_error(result, "Removal of '%s' leads to disconnected" + " topology" % self.replicas[0].hostname, 0) self.replicas[0].run_command(['ipa-server-install', '--uninstall', '-U', '--ignore-topology-disconnect']) From 55155cc8e305d92024a66f918d772a6f4dd3a14f Mon Sep 17 00:00:00 2001 From: Oleg Fayans <ofay...@redhat.com> Date: Mon, 5 Sep 2016 09:05:06 +0200 Subject: [PATCH 2/3] Several fixes in replica_promotion tests --- ipatests/test_integration/test_replica_promotion.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py index e06cafd..34af116 100644 --- a/ipatests/test_integration/test_replica_promotion.py +++ b/ipatests/test_integration/test_replica_promotion.py @@ -187,7 +187,9 @@ def test_one_command_installation(self): self.replicas[0].run_command(['ipa-replica-install', '-w', self.master.config.admin_password, '-n', self.master.domain.name, - '-r', self.master.domain.realm]) + '-r', self.master.domain.realm, + '--server', self.master.hostname, + '-U']) class TestReplicaManageCommands(IntegrationTest): @@ -307,7 +309,8 @@ def test_client_enrollment_by_unprivileged_user(self): '-p', self.username, '-w', self.new_password, '--domain', replica.domain.name, - '--realm', replica.domain.realm, '-U'], + '--realm', replica.domain.realm, '-U', + '--server', self.master.hostname], raiseonerr=False) assert_error(result1, "No permission to join this host", 1) @@ -331,7 +334,8 @@ def test_replica_promotion_after_adding_to_admin_group(self): '-P', self.username, '-p', self.new_password, '-n', self.master.domain.name, - '-r', self.master.domain.realm]) + '-r', self.master.domain.realm, + '-U']) class TestProhibitReplicaUninstallation(IntegrationTest): From ad8d931d83bff6aab79a42fcb1dc5dc6a74f4047 Mon Sep 17 00:00:00 2001 From: Oleg Fayans <ofay...@redhat.com> Date: Mon, 5 Sep 2016 09:07:39 +0200 Subject: [PATCH 3/3] Changed addressing to the client hosts to be replicas https://fedorahosted.org/freeipa/ticket/6287 --- ipatests/test_integration/test_replica_promotion.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py index 34af116..cff48ea 100644 --- a/ipatests/test_integration/test_replica_promotion.py +++ b/ipatests/test_integration/test_replica_promotion.py @@ -390,7 +390,7 @@ def test_replica_after_domain_upgrade(self): class TestWrongClientDomain(IntegrationTest): topology = "star" - num_clients = 1 + num_replicas = 1 domain_name = 'exxample.test' @classmethod @@ -398,16 +398,16 @@ def install(cls, mh): tasks.install_master(cls.master, domain_level=cls.domain_level) def teardown_method(self, method): - self.clients[0].run_command(['ipa-client-install', + self.replicas[0].run_command(['ipa-client-install', '--uninstall', '-U'], raiseonerr=False) tasks.kinit_admin(self.master) self.master.run_command(['ipa', 'host-del', - self.clients[0].hostname], + self.replicas[0].hostname], raiseonerr=False) def test_wrong_client_domain(self): - client = self.clients[0] + client = self.replicas[0] client.run_command(['ipa-client-install', '-U', '--domain', self.domain_name, '--realm', self.master.domain.realm, @@ -424,7 +424,7 @@ def test_wrong_client_domain(self): "'%s'" % (self.domain_name, self.master.domain.name)) def test_upcase_client_domain(self): - client = self.clients[0] + client = self.replicas[0] result = client.run_command(['ipa-client-install', '-U', '--domain', self.master.domain.name.upper(), '-w', self.master.config.admin_password,
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code