URL: https://github.com/freeipa/freeipa/pull/1320 Author: mrizwan93 Title: #1320: ipatest: automation for bz-1493145 Action: opened
PR body: """ This fix adds automation for above mentioned bugzilla. Fixes: https://pagure.io/freeipa/issue/7276 Signed-off-by: Mohammad Rizwan Yusuf <myu...@redhat.com> """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/1320/head:pr1320 git checkout pr1320
From 58945aa120e38131ae768a73feda6f83cd8d82c7 Mon Sep 17 00:00:00 2001 From: Mohammad Rizwan Yusuf <myu...@redhat.com> Date: Wed, 22 Nov 2017 16:54:33 +0530 Subject: [PATCH] ipatest: automation for bz-1493145 This fix adds automation for above mentioned bugzilla. Fixes: https://pagure.io/freeipa/issue/7276 Signed-off-by: Mohammad Rizwan Yusuf <myu...@redhat.com> --- ipatests/test_integration/test_bugzilla.py | 71 ++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 ipatests/test_integration/test_bugzilla.py diff --git a/ipatests/test_integration/test_bugzilla.py b/ipatests/test_integration/test_bugzilla.py new file mode 100644 index 0000000000..e8fec1747c --- /dev/null +++ b/ipatests/test_integration/test_bugzilla.py @@ -0,0 +1,71 @@ +# +# Copyright (C) 2015 FreeIPA Contributors see COPYING for license +# + +import time +from tempfile import NamedTemporaryFile + +from ipatests.pytest_plugins.integration import tasks +from ipatests.pytest_plugins.integration.env_config import get_global_config +from ipatests.test_integration.base import IntegrationTest + +config = get_global_config() + + +class LayoutsBaseTest(IntegrationTest): + @classmethod + def install(cls, mh): + # tests use custom installation + pass + + def replication_is_working(self): + test_user = 'replication-testuser' + self.master.run_command( + ['ipa', 'user-add', test_user, '--first', 'test', '--last', 'user'] + ) + + time.sleep(60) # make sure the replication of user is done + + for r in self.replicas: + r.run_command(['ipa', 'user-show', test_user]) + + +class TestReplicaInstallWithExistingEntry(LayoutsBaseTest): + """Automation for: + https://bugzilla.redhat.com/show_bug.cgi?id=1493145 + https://bugzilla.redhat.com/show_bug.cgi?id=1506913 + ipa-replica-install might fail because of an already existing + entry cn=ipa-http-delegation,cn=s4u2proxy,cn=etc,$SUFFIX""" + num_replicas = 1 + + def test_replica_install_with_existing_entry(self): + result = tasks.install_master(self.master) + assert result.returncode == 0 + master = self.master + replica = self.replicas[0] + tf = NamedTemporaryFile() + ldif_file = tf.name + base_dn = "dc=%s" % (",dc=".join(replica.domain.name.split("."))) + entry_ldif = """ + dn: cn=ipa-http-delegation,cn=s4u2proxy,cn=etc,%s\n + changetype: modify\n + add: memberPrincipal\n + memberPrincipal: HTTP/%s@%s\n + + dn: cn=ipa-ldap-delegation-targets,cn=s4u2proxy,cn=etc,%s\n + changetype: modify\n + add: memberPrincipal\n + memberPrincipal: ldap/%s@%s""" % ( + base_dn, replica.hostname, replica.domain.name.upper(), + base_dn, replica.hostname, replica.domain.name.upper()) + master.put_file_contents(ldif_file, entry_ldif) + arg = ['ldapmodify', '-h', master.hostname, '-p', '389', + '-D', str(master.config.dirman_dn), '-w', + master.config.dirman_password, '-f', ldif_file] + cmd = master.run_command(arg, raiseonerr=False) + assert cmd.returncode == 0, cmd.stdout_text + + cmd = tasks.install_replica(master, replica) + assert cmd.returncode == 0, cmd.stdout_text + + self.replication_is_working()
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org