From 10aad7caa19d61e179da00f53ab471ec76bea7ec Mon Sep 17 00:00:00 2001 From: René Genz Date: Jan 30 2018 23:19:03 +0000 Subject: [PATCH 1/3] Fix minor spelling mistakes in tests/multihost/* --- diff --git a/src/tests/multihost/basic/README b/src/tests/multihost/basic/README index 794e63b..b3bc384 100644 --- a/src/tests/multihost/basic/README +++ b/src/tests/multihost/basic/README @@ -3,7 +3,7 @@ pytest using pytest-multihost plugin Following are the test cases: -1. Check ssh login as ldap user with kerberos credentials +1. Check ssh login as LDAP user with Kerberos credentials 2. Run kinit after user login 3. Run kinit with KRB5CCNAME=KCM: 4. Test Offline ssh login diff --git a/src/tests/multihost/basic/conftest.py b/src/tests/multihost/basic/conftest.py index bd26be9..a658ede 100644 --- a/src/tests/multihost/basic/conftest.py +++ b/src/tests/multihost/basic/conftest.py @@ -28,7 +28,7 @@ def multihost(session_multihost, request): @pytest.fixture(scope="session") def config_authconfig(session_multihost, request): - """ Run authconfig to configure kerberos and sssd auth on remote host """ + """ Run authconfig to configure Kerberos and SSSD auth on remote host """ authconfig = RedHatAuthConfig(session_multihost.master[0]) session_multihost.master[0].log.info("Take backup of current authconfig") authconfig.backup('/root/authconfig_backup') diff --git a/src/tests/multihost/basic/mhc.yaml b/src/tests/multihost/basic/mhc.yaml index 6f53958..1b56eb3 100644 --- a/src/tests/multihost/basic/mhc.yaml +++ b/src/tests/multihost/basic/mhc.yaml @@ -1,7 +1,7 @@ windows_test_dir: '/home/Administrator' root_password: 'redhat' domains: - - name: testrelm.test + - name: testrealm.test type: sssd hosts: - name: idm1.example.test diff --git a/src/tests/multihost/basic/test_basic.py b/src/tests/multihost/basic/test_basic.py index f10176b..3433447 100644 --- a/src/tests/multihost/basic/test_basic.py +++ b/src/tests/multihost/basic/test_basic.py @@ -8,7 +8,7 @@ import time class Test_basic_sssd(object): def test_ssh_user_login(self, multihost): - """ Check ssh login as ldap user with kerberos credentials """ + """ Check ssh login as LDAP user with Kerberos credentials """ try: ssh = SSHClient(multihost.master[0].sys_hostname, username='foo1', password='Secret123') From 75072201474c6ebff3c29d7023e88d953799def1 Mon Sep 17 00:00:00 2001 From: René Genz Date: Jan 30 2018 23:19:03 +0000 Subject: [PATCH 2/3] Fix minor spelling mistakes in PY files in tests/python/* --- diff --git a/src/tests/python/sssd/testlib/common/authconfig.py b/src/tests/python/sssd/testlib/common/authconfig.py index 4dbee6f..99493ac 100644 --- a/src/tests/python/sssd/testlib/common/authconfig.py +++ b/src/tests/python/sssd/testlib/common/authconfig.py @@ -27,13 +27,13 @@ FILES_TO_NOT_BACKUP = ['passwd', 'group', 'shadow', 'gshadow'] class RedHatAuthConfig(object): """ - AuthConfig class implements system-independent interface to configure + AuthConfig class implements a system-independent interface to configure system authentication resources. In Red Hat systems this is done with authconfig(8) utility. AuthConfig class is nothing more than a tool to gather configuration - options and execute their processing. These options then converted by - an actual implementation to series of a system calls to appropriate + options and execute their processing. These options are then converted by + an actual implementation to a series of system calls to appropriate utilities performing real configuration. If you need to re-use existing AuthConfig instance for multiple runs, @@ -73,7 +73,7 @@ class RedHatAuthConfig(object): def add_parameter(self, option, value): """ - Add paramters + Add parameters :param str option: authconfig options :param str values: values """ diff --git a/src/tests/python/sssd/testlib/common/exceptions.py b/src/tests/python/sssd/testlib/common/exceptions.py index cdd74ed..1839a59 100644 --- a/src/tests/python/sssd/testlib/common/exceptions.py +++ b/src/tests/python/sssd/testlib/common/exceptions.py @@ -25,7 +25,7 @@ class InvalidInput(StandardException): class DirSrvException(StandardException): """ - Override StandardException, This exception s to be used for + Override StandardException, This exception is to be used for Directory Server related Errors """ @@ -52,5 +52,5 @@ class LdapException(StandardException): class RPMException(StandardException): """ - Override StandardException, This exception is to be used for LDAP Errors + Override StandardException, This exception is to be used for RPM Errors """ diff --git a/src/tests/python/sssd/testlib/common/libdirsrv.py b/src/tests/python/sssd/testlib/common/libdirsrv.py index 710d324..1bca4b1 100644 --- a/src/tests/python/sssd/testlib/common/libdirsrv.py +++ b/src/tests/python/sssd/testlib/common/libdirsrv.py @@ -86,7 +86,7 @@ class DirSrv(object): ds_config_file (str): ds_config_file: Configuration File path Returns: - bool: True if seutp-ds.pl ran successfully else False + bool: True if setup-ds.pl ran successfully else False Exceptions: subprocess.CalledProcessError: @@ -134,9 +134,9 @@ class DirSrv(object): Exceptions: DirSrvException """ - # we stop directory server before we copy files , this is required + # We stop directory server before we copy files. This is required # because it's seen that at times, if ns-slapd process is reading - # the db files, copying of files is successfull but not all data + # the db files, copying of files is successful but not all data # is written causing the files to go corrupt. stop_ds = ['systemctl', 'stop', 'dirsrv@%s' % (self.instance_name)] try: @@ -165,12 +165,12 @@ class DirSrv(object): self.multihost.run_command(change_ownership) except subprocess.CalledProcessError: raise DirSrvException( - 'fail to user change ownerhsip of pin.txt fail') + 'fail to user change ownership of pin.txt fail') try: self.multihost.run_command(change_group) except subprocess.CalledProcessError: raise DirSrvException( - 'fail to change group ownerhsip of pin.txt file') + 'fail to change group ownership of pin.txt file') try: self.multihost.run_command(chmod_file) except subprocess.CalledProcessError: @@ -189,11 +189,11 @@ class DirSrv(object): """sets TLS Port and enabled TLS on Directory Server. Args: - binduri (str): ldap uri to bind with + binduri (str): LDAP uri to bind with tls_port (str): TLS port to be setup Returns: - bool: True if successfully setup TLSPort + bool: True if successfully setup TLS port Exceptions: LdapException @@ -249,14 +249,14 @@ class DirSrvWrap(object): """This is a wrapper class for DirSrv. This is a wrapper class of DirSrv class which validates - all the inpts sent to Dirsrv object. Specifies ports for - ldap and tls ports , specifies default suffix. + all the inputs sent to Dirsrv object. Specifies ports for + LDAP and TLS ports, specifies default suffix. """ # pylint: disable=too-many-instance-attributes def __init__(self, multihost_obj, ssl=None, ssldb=None): """ Create a DirSrv object for a specific Host. Specify the ports, - Instance details to the Dirsrv object + instance details to the Dirsrv object Args: multihost_obj (obj): Multihost object @@ -297,11 +297,11 @@ class DirSrvWrap(object): instance_name (str): DS Instance Name instance_suffix (str): DS Instance Suffix root_dn_pwd (str): Directory Manager password - ldap_port (str): ldap port + ldap_port (str): LDAP port tls_port (str): TLS Port Returns: - A tuple containing 'Success' ,0 or Failed Message and 1 + A tuple containing 'Success', 0 or Failed Message and 1 for failure to setup ports Exceptions: @@ -339,23 +339,23 @@ class DirSrvWrap(object): """return ports required to setup DS Instance. Idea behind this is when a directory server instance needs - to be created we need ports for ldap and ssl ports. - 1. check if LdapPort and SSLPort is given + to be created we need ports for LDAP and SSL ports. + 1. check if LDAP port and SSL port is given 1.1 If given, verify if the ports are available(not used) 1.1.1 Bind that port to ldap_port_t using semanage command 1.1.2 Use the ports and add it to the self.UsedPorts list 1.2 else raise exception - 2. If LdapPort and SSLPort is not given + 2. If LDAP port and SSL port is not given 2.1 Check if the ports are available(not used) 2.1.1 Bind the port to ldap_port_t using semanage command 2.1.2 Use the ports and add it to self.ds_used_ports list Args: - u_port (str): unencrypted ldap port + u_port (str): unencrypted LDAP port e_port (str): Encrypted port to be used for TLS Returns: - sorted_available_ports[0] (list): ldap and tls ports + sorted_available_ports[0] (list): LDAP and TLS ports """ ds_ports = [389, 1389, 2389, 3389, 4389, 30389, 31389, 32389, 33389, 34389, 35389, 36389, 37389, 38389, 39389] @@ -389,7 +389,7 @@ class DirSrvWrap(object): """check if the port on the remote host is free. Args: - port (int): check if port is avaliable + port (int): check if port is available Returns: bool: True if port is free else False. @@ -407,7 +407,7 @@ class DirSrvWrap(object): return True def _validate_options(self): - """verify if the instance directory alread exists. + """verify if the instance directory already exists. Args: None @@ -437,7 +437,7 @@ class DirSrvWrap(object): inst_name (str): Instance Name inst_suffix (str): Instance suffix root_dn_pwd (str): Directory Manager password - ldap_port (str): ldap port to be used + ldap_port (str): LDAP port to be used tls_port (str): TLS port to be used Returns: @@ -478,9 +478,9 @@ class DirSrvWrap(object): raise DirSrvException('fail to setup Directory Server instance') def enablessl(self): - """Enable ssl/tls on instance. + """Enable SSL/TLS on instance. - Enable by adding tls port to ldap_port_t selinux label and restart + Enable by adding TLS port to ldap_port_t SELinux label and restart Directory Server. Args: @@ -492,7 +492,7 @@ class DirSrvWrap(object): Exceptions: None: """ - # add tls port to ldap_port_t selinux label + # add TLS port to ldap_port_t SELinux label add_tls_port = ['semanage', 'port', '-a', '-t', 'ldap_port_t', '-p', 'tcp', str(self.ds_tls_port)] diff --git a/src/tests/python/sssd/testlib/common/libkrb5.py b/src/tests/python/sssd/testlib/common/libkrb5.py index 38b5e67..8df4449 100644 --- a/src/tests/python/sssd/testlib/common/libkrb5.py +++ b/src/tests/python/sssd/testlib/common/libkrb5.py @@ -6,13 +6,13 @@ import subprocess class krb5srv(object): - """ Base class to setup MIT kerberos server - Default Keberos Server realm is "EXAMPLE.TEST" + """ Base class to setup MIT Kerberos server + Default Kerberos Server realm is "EXAMPLE.TEST" Default Admin password is "Secret123" """ def __init__(self, multihost, krb_realm=None): - """ Initialize realm, host, ports kerberos admin password """ + """ Initialize realm, host, ports, Kerberos admin password """ if krb_realm is None: self.krb_realm = 'EXAMPLE.TEST' else: @@ -39,7 +39,7 @@ class krb5srv(object): def _config_krb5kdc(self): """ Configure kdc.conf and kadm5.acl :param: None - :return str: Return kerberos kdc.conf file path + :return str: Return Kerberos kdc.conf file path """ realm_def = """ { acl_file = %s @@ -67,7 +67,7 @@ class krb5srv(object): return krb_config_path def _krb_acl_config(self): - """ Create acl file + """ Create ACL file :param: None :return: Config file path """ @@ -79,7 +79,7 @@ class krb5srv(object): return acl_config_path def krb_setup_new(self): - """ Setup new kerberos REALM + """ Setup new Kerberos REALM :param: None :return: None :Exception: Raises subprocess.CalledProcessError @@ -139,24 +139,24 @@ class krb5srv(object): except subprocess.CalledProcessError: raise else: - self.multihost.log.info("krb5kdc service start successfully") + self.multihost.log.info("krb5kdc service start successful") try: self.multihost.run_command(['systemctl', 'start', 'kadmin']) except subprocess.CalledProcessError: raise else: - self.multihost.log.info("kadmin service started successfull") + self.multihost.log.info("kadmin service started successfully") def add_principal(self, principal=None, p_type='user', password=None, service=None, service_name=None): - """ Add server/user principals to kerberos server + """ Add server/user principals to Kerberos server :param str principal: principal name (foobar) :param str p_type: principal type (user/admin/None) - :param str password: password ('Secret123') - :param str service: service principal (host/http/nfs) + :param str password: password ('Secret123') + :param str service: service principal (host/http/nfs) :param str service_name: Hostname where service is run :return bool: True if principal is added :Exception: Raise subprocess.CalledProcessError @@ -189,11 +189,11 @@ class krb5srv(object): return True def destroy_krb5server(self): - """ Destroy kerberos database + """ Destroy Kerberos database :param: None :Exception: subprocess.CalledProcessError """ - # stop the kerberos server + # stop the Kerberos server try: self.multihost.run_command(['systemctl', 'stop', 'krb5kdc']) except subprocess.CalledProcessError: @@ -209,7 +209,7 @@ class krb5srv(object): else: self.multihost.log.info("stopped kadmin service") - # Destoy kerberos database + # destroy Kerberos database try: self.multihost.run_command(['kdb5_util', 'destroy', '-f', self.krb_realm]) diff --git a/src/tests/python/sssd/testlib/common/qe_class.py b/src/tests/python/sssd/testlib/common/qe_class.py index eb5ee96..30b050e 100644 --- a/src/tests/python/sssd/testlib/common/qe_class.py +++ b/src/tests/python/sssd/testlib/common/qe_class.py @@ -55,7 +55,7 @@ class QeConfig(pytest_multihost.config.Config): class QeBaseHost(pytest_multihost.host.BaseHost): - """QeBaseHost subclass of multhost plugin BaseHost class.""" + """QeBaseHost subclass of multihost plugin BaseHost class.""" pass @@ -147,7 +147,7 @@ class QeHost(QeBaseHost): return cmd.returncode def dnf_install(self, package): - """ Install packges through dnf + """ Install packages through dnf :param str package: Name of the package to be installed :return str: Returncode of the dnf command @@ -188,7 +188,7 @@ class QeWinHost(QeBaseHost, pytest_multihost.host.WinHost): Attributes: domainname (str): Return domainname of the AD Machine - realm (str): Return AD realm in uppper case + realm (str): Return AD realm in upper case """ @property @@ -250,7 +250,7 @@ class QeDomain(pytest_multihost.config.Domain): @pytest.yield_fixture(scope="session", autouse=True) def session_multihost(request): - """Mulithost plugin fixture for session scope""" + """Multihost plugin fixture for session scope""" if pytest.num_ad > 0: mh = make_multihost_fixture(request, descriptions=[ { diff --git a/src/tests/python/sssd/testlib/common/utils.py b/src/tests/python/sssd/testlib/common/utils.py index 7bfb001..f5e9c66 100644 --- a/src/tests/python/sssd/testlib/common/utils.py +++ b/src/tests/python/sssd/testlib/common/utils.py @@ -35,7 +35,7 @@ class sssdTools(object): self.authbackup = "/root/authconfig_backup" def update_resolv_conf(self, ip_addr): - """ Update /etc/resolv.conf with Windows AD ipaddress + """ Update /etc/resolv.conf with Windows AD IP address :param str ip_addr: IP Address to be added in resolv.conf :return: None @@ -46,7 +46,7 @@ class sssdTools(object): '/etc/resolv.conf.backup'], set_env=False, raiseonerr=False) if output.returncode == 0: - self.multihost.log.info("/etc/resolv.conf successfully backedup") + self.multihost.log.info("/etc/resolv.conf successfully backed up") self.multihost.log.info("Add ip addr %s in resolv.conf" % ip_addr) nameserver = 'nameserver %s\n' % ip_addr contents = self.multihost.get_file_contents('/etc/resolv.conf') @@ -57,11 +57,11 @@ class sssdTools(object): raise Exception("Updating resolv.conf with ip %s failed" % ip_addr) def config_authconfig(self, hostname, domainname): - """ Run authconfig to configure kerberos and sssd auth on remote host + """ Run authconfig to configure Kerberos and SSSD auth on remote host :param str hostname: Hostname of server(AD) to which client is configured to auth - :param domainame: Domain name of ipa/AD + :param domainname: domain name of IPA/AD :return: None :Exceptions: None """ @@ -83,7 +83,7 @@ class sssdTools(object): def config_smb_net_ads_join(self, domainname): """ Configure smb.conf as Domain Member to Windows AD - :param str domainname: Domainname of AD/ipa + :param str domainname: domain name of AD/IPA :return: None :Exception: None """ @@ -109,12 +109,12 @@ class sssdTools(object): server_software='active-directory', membership_software='adcli'): """ Join system to AD/IPA Domain using realmOA - :param str domainame: Domainname of AD/ipa + :param str domainname: domain name of AD/IPA :param str admin_password: Administrator password required to join :param str client_software: client software to be used (sssd/samba) :param str server_software: server software (active-directory/ipa) :param str membership_software: membership software (samba/adcli) - :return bool: True if successfully joined to AD/ipa + :return bool: True if successfully joined to AD/IPA else raises Exception :Exception: Raises exception(builtin) """ @@ -137,8 +137,8 @@ class sssdTools(object): def realm_leave(self, domainname): """ Leave system from AD/IPA Domain - :param str domainame: Domainname of AD/ipa - :return bool: True if successfully dis-joined to AD/ipa + :param str domainname: domain name of AD/IPA + :return bool: True if successfully dis-joined to AD/IPA else raises Exception :Exception: Raises exception(builtin) """ @@ -221,7 +221,7 @@ class sssdTools(object): def delete_sssd_domain_log(self, domainname): """ Remove the sssd domain log - :param str cache_path: Domainname from default configuration file + :param str cache_path: domain name from default configuration file :return bool: True if deletion is successful :Exception: Raises exception(builtin) """ @@ -490,7 +490,7 @@ class LdapOperations(object): return 'Success', True def posix_user(self, org_unit, basedn, user_attr): - """ Add Posix Users + """ Add POSIX Users :param str ou: Organizational unit (ou=Users) :param str basedn: Base dn ('dc=example,dc=test') :param dict user_attr: Entry attributes @@ -545,7 +545,7 @@ class LdapOperations(object): raise Exception('Unable to add User to ldap') def posix_group(self, org_unit, basedn, group_attr): - """ Add posix group + """ Add POSIX group :param str ou: Organizational unit (ou=Groups) :param str basedn: Base dn ('dc=example,dc=test') :param dict group_attr: Entry attributes @@ -620,7 +620,7 @@ nisMapName: auto.home""") % (basedn, basedn, basedn, basedn, basedn, basedn) class PkiTools(object): """ PkiTools consists of functions related to creation of - certificate requests, updating profile xml with certificate + certificate requests, updating profile XML with certificate requests. """ @@ -870,7 +870,7 @@ class ADOperations(object): """ Delete AD user :param str user_group: User or Group Name to be deleted - :Return bool: True if delete is successfull else false + :Return bool: True if delete is successful else false :Exceptions: None """ From c01eaec56b5d6cf1dd80e586d739ca90ea7d8600 Mon Sep 17 00:00:00 2001 From: René Genz Date: Jan 30 2018 23:19:03 +0000 Subject: [PATCH 3/3] Fix minor spelling mistakes and formatting in tests/python/* --- diff --git a/src/tests/python/README.rst b/src/tests/python/README.rst index dbabe15..16da90f 100644 --- a/src/tests/python/README.rst +++ b/src/tests/python/README.rst @@ -1,4 +1,4 @@ sssd_qe_tests ============= -`sssd.testlib`_ is a library containing shared functions to automtate `System Services Security Daemon __` using pytest framework. +`sssd.testlib` is a library containing shared functions to automate `System Services Security Daemon (SSSD)` using pytest framework. diff --git a/src/tests/python/docs/Install.rst b/src/tests/python/docs/Install.rst index f210e84..42fdd99 100644 --- a/src/tests/python/docs/Install.rst +++ b/src/tests/python/docs/Install.rst @@ -1,49 +1,47 @@ Install ======= - * sssd.testlib is a python library which contains shared functions to be used with - py.test to automate System Services Security Daemon(sssd). + py.test to automate System Services Security Daemon (SSSD). Dependencies ------------ - sssd.testlib requires following packages: - - 1. python-paramiko - 2. python-pytest-multihost - 3. PyYAML - 4. pytest +sssd.testlib requires the following packages: +1. python-paramiko +2. python-pytest-multihost +3. PyYAML +4. pytest RHEL7 -------- -To install above dependencies on RHEL7.4 get the +----- +To install above dependencies on RHEL7.4 get the: -* python-paramiko is available from 7.4 Extras, +* python-paramiko package (available at Extras repo) -* `pytest-multhost copr repo(epel7) `_.file:: +* `pytest-multihost copr repo(epel7) `_ file:: - wget -O /etc/yum.repos.d/pytest-multihost.repo \ + $ wget -O /etc/yum.repos.d/pytest-multihost.repo \ https://copr.fedorainfracloud.org/coprs/mrniranjan/python-pytest-multihost/repo/epel-7/mrniranjan-python-pytest-multihost-epel-7.repo - yum install python-pytest-multihost + $ yum install python-pytest-multihost -* `sssd-testlib copr repo(epel7) `_.file:: +* `sssd-testlib copr repo(epel7) `_ file:: - wget -O /etc/yum.repos.d/sssd-testlib.repo \ + $ wget -O /etc/yum.repos.d/sssd-testlib.repo \ https://copr.fedorainfracloud.org/coprs/mrniranjan/sssd-testlib/repo/epel-7/mrniranjan-sssd-testlib-epel-7.repo - yum install sssd-testlib + $ yum install sssd-testlib Fedora -------- -To install the above dependencies on Fedora get the +------ +To install the above dependencies on Fedora get the: -* `pytest-multhost copr repo(F26) `_.file:: +* `pytest-multihost copr repo(F26) `_ file:: - wget -O /etc/yum.repos.d/pytest-multihost.repo \ + $ wget -O /etc/yum.repos.d/pytest-multihost.repo \ https://copr.fedorainfracloud.org/coprs/mrniranjan/python-pytest-multihost/repo/fedora-24/mrniranjan-python-pytest-multihost-fedora-24.repo - dnf install python-pytest-multihost + $ dnf install python-pytest-multihost -* `sssd-testlib copr repo(f26) `_.file:: +* `sssd-testlib copr repo(f26) `_ file:: - wget -O /etc/yum.repos.d/sssd-testlib.repo \ + $ wget -O /etc/yum.repos.d/sssd-testlib.repo \ https://copr.fedorainfracloud.org/coprs/mrniranjan/sssd-testlib/repo/fedora-24/mrniranjan-sssd-testlib-fedora-24.repo - dnf install sssd-testlib + $ dnf install sssd-testlib diff --git a/src/tests/python/docs/ds_389.rst b/src/tests/python/docs/ds_389.rst index a143756..c832794 100644 --- a/src/tests/python/docs/ds_389.rst +++ b/src/tests/python/docs/ds_389.rst @@ -7,35 +7,34 @@ Design ------ * libdirsrv module consists of 2 classes the base class DirSrv and wrapper class DirSrvWrap. -* DirSrv class consits of methods to create DS config file, Setup Directory Server , Enable SSL - in Directory server and Remove DS Instances. This class is very generic and all the details like - instance name, hostname, suffix, ldap and tls ports should be provided. +* DirSrv class consists of methods to create DS config file, setup Directory Server, enable SSL + in Directory server and remove DS instances. This class is very generic and all the details like + instance name, hostname, suffix, LDAP and TLS ports should be provided. -* DirSrvWrap is a wrapper class of DirSrv , It sets up some default values like ldap and tls ports, - suffix , set selinux label ldap_t on ldap and tls ports etc. +* DirSrvWrap is a wrapper class of DirSrv, it sets up some default values like LDAP and TLS ports, + suffix, set SELinux label ldap_t on LDAP and TLS ports etc. -* The wrapper classes allows to create multiple instances without worring about what ports to be used - for each instance. port for unencrypted ldap ports are choosen from the below list: +* The wrapper class allows to create multiple instances without worrying about what ports to be used + for each instance. Port for unencrypted LDAP ports are chosen from the below list: `[389, 1389, 2389, 3389, 4389, 30389, 31389, 32389, 33389, 34389, 35389, 36389, 37389, 38389, 39389]` - and tls ports are choosen from below list: + and TLS ports are chosen from below list: `[636, 1636, 2636, 3636, 4636, 30636, 31636, 32636, 33636, 34636, 35636, 36636, 37636, 38636, 39636]` -* Though ports can be passed manully but verifying if those ports are available have to be done by the user. +* Though ports can be passed manually but user must verify if those ports are available. * The default suffix is 'dc=example,dc=org' -* To Enable ssl for Directory Server instance, A Directory containing the CA and Server certs(created on the - host where DS Instance) should be passed. To create these certs, PkiTools module can be used. PkiTools has - method `createselfsignedcerts` which creates a self-signed certs (CA and server-cert for each host). These +* To enable SSL for a Directory Server instance a directory containing the CA and server certs (created on the + host with DS instance) should be passed. To create these certs, PkiTools module can be used. PkiTools has + method `createselfsignedcerts` which creates self-signed certs (CA and server-cert for each host). These certs are copied to host on which Directory server instance should be created and `setup_certs` method of DirSrv class adds these certs to NSS DB of that - specific instance and Enables - TLS on Directory Server. + specific instance and enables TLS on Directory Server. -* Below are some of the examples of setting up DS instance in pytest +* below are some of the examples of setting up DS instance in pytest -Example-1: Setup DS Instance on single Host +Example-1: Setup DS instance on single host ------------------------------------------- * create a multihost config file mhc.yaml as below:: @@ -59,7 +58,7 @@ Example-1: Setup DS Instance on single Host return {'num_masters': 0, 'num_ad':0, 'num_atomic': 0, 'num_replicas': 0, 'num_clients':1, 'num_others': 0} -* Add a fixture specifed below in conftest.py:: +* add a fixture specified as below in conftest.py:: @pytest.fixture(scope="class") def setup_ldap(session_multihost): @@ -69,7 +68,7 @@ Example-1: Setup DS Instance on single Host * session_multihost is the session fixture which gets activated when py.test is run with --multihost-config=mhc.yaml parameter. This parameter connects to systems mentioned in mhc.yaml using paramiko - module and this session of each host is available through roles + module and the session of each host is available through roles defined in multihost config file. In the above example client[0] is the multihost handle for host `client1.example.test` @@ -77,8 +76,7 @@ Example-1: Setup DS Instance on single Host DirSrvWrap by passing the multihost session handle of client[0] to the DirSrvWrap object. - -* The fixture created 389_ds is of scope class which can be called in test file as below:: +* the fixture created by 389_ds is of scope class which can be called in a test file as below:: class TestCase(object): @@ -92,7 +90,7 @@ Example-1: Setup DS Instance on single Host def test3(self, session_multihost): pass -Example-2: Setup DS Instance with SSL on single Host: +Example-2: Setup DS instance with SSL on single host: ----------------------------------------------------- * create a multihost config file mhc.yaml as below:: @@ -132,7 +130,7 @@ Example-2: Setup DS Instance with SSL on single Host: else: return certdb -* Add another fixture to create a instance of `DirSrvWrap` passing the certdb +* add another fixture to create an instance of `DirSrvWrap` passing the certdb returned from above fixture:: @pytest.fixture(scope="class") @@ -140,7 +138,7 @@ Example-2: Setup DS Instance with SSL on single Host: ds_obj = DirSrvWrap(session_multihost.client[0], ssl=True, ssldb=nssdir) return ds_obj -* call the fixture setup_ldap from the test functions as show below:: +* call the fixture setup_ldap from the test functions as below:: class TestCase(object): @@ -154,7 +152,7 @@ Example-2: Setup DS Instance with SSL on single Host: def test3(self): pass -* To override the default suffix:: +* to override the default suffix:: class TestCase(object): @@ -168,10 +166,8 @@ Example-2: Setup DS Instance with SSL on single Host: def test3(self): pass - -Example-3: Setup DS Instance with on multiple hosts(2) --------------------------------------------------------- - +Example-3: Setup DS instance on multiple hosts(2) +------------------------------------------------- * create a multihost config file mhc.yaml as below:: root_password: 'redhat' @@ -215,7 +211,7 @@ Example-3: Setup DS Instance with on multiple hosts(2) else: return certdb -* Add another fixture to create a instance of `DirSrvWrap` passing the certdb +* add another fixture to create an instance of `DirSrvWrap` passing the certdb returned from above fixture:: @pytest.fixture(scope="class") @@ -227,7 +223,7 @@ Example-3: Setup DS Instance with on multiple hosts(2) return (client_ds_obj, master_ds_obj) -* call the fixture setup_ldap from the test functions as show below:: +* call the fixture setup_ldap from the test functions as below:: class TestCase(object): @@ -245,10 +241,8 @@ Example-3: Setup DS Instance with on multiple hosts(2) def test3(self): pass - -Example-4: Creating and Removing DS instance using setup/teardown methods +Example-4: Creating and removing DS instance using setup/teardown methods ------------------------------------------------------------------------- - * create a multihost config file mhc.yaml as below:: root_password: 'redhat' @@ -275,11 +269,11 @@ Example-4: Creating and Removing DS instance using setup/teardown methods return {'num_masters': 1, 'num_ad':0, 'num_atomic': 0, 'num_replicas': 0, 'num_clients':1, 'num_others': 0} -* Create a fixture of scope class to have a setup and teardown methods in class +* Create a fixture of scope class to have setup and teardown methods in class and these functions are run before and after tests are executed. In our test class we define a **setup_class** method which will be run before our tests run where we do all our setup required for tests and also define **class_teardown** - method at the end in **Testclass** which teardown all the setup done in + method at the end in **Testclass** which will teardown all the setup done in **class_setup**. To these functions we pass our fixtures setup_ldap:: @pytest.fixture(scope="class") @@ -289,7 +283,7 @@ Example-4: Creating and Removing DS instance using setup/teardown methods request.addfinalizer(lambda:request.cls().class_teardown(session_multihost, setup_ldap)) return session_multihost -* create a fixture to create CA and server-cert for each host in conftest.py:: +* create a fixture to create a CA and server-cert for each host in conftest.py:: from sssd.testlib.common.exceptions import PkiLibException from sssd.testlib.common.utils import PkiTools @@ -306,7 +300,7 @@ Example-4: Creating and Removing DS instance using setup/teardown methods else: return certdb -* Add another fixture to create a instance of `DirSrvWrap` passing the certdb +* add another fixture to create an instance of `DirSrvWrap` passing the certdb returned from above fixture:: @pytest.fixture(scope="class") @@ -318,7 +312,7 @@ Example-4: Creating and Removing DS instance using setup/teardown methods return (client_ds_obj, master_ds_obj) -* call the fixture setup_ldap from the test functions as show below:: +* call the fixture setup_ldap from the test functions as below:: class TestCase(object): @@ -340,9 +334,8 @@ Example-4: Creating and Removing DS instance using setup/teardown methods client_ds_obj.remove_ds_instance('example1') master_ds_obj.remove_ds_instance('example1') -Example-5: Creating and add Posix Users and Groups ---------------------------------------------------- - +Example-5: Creating and add POSIX Users and Groups +-------------------------------------------------- * create a multihost config file mhc.yaml as below:: root_password: 'redhat' @@ -365,11 +358,11 @@ Example-5: Creating and add Posix Users and Groups return {'num_masters': 1, 'num_ad':0, 'num_atomic': 0, 'num_replicas': 0, 'num_clients':0, 'num_others': 0} -* Create a fixture of scope class to have a setup and teardown methods in class +* Create a fixture of scope class to have setup and teardown methods in class and these functions are run before and after tests are executed. In our test class we define a **setup_class** method which will be run before our tests run where we do all our setup required for tests and also define **class_teardown** - method at the end in **Testclass** which teardown all the setup done in + method at the end in **Testclass** which will teardown all the setup done in **class_setup**. To these functions we pass our fixtures setup_ldap:: @pytest.fixture(scope="class") @@ -395,7 +388,7 @@ Example-5: Creating and add Posix Users and Groups else: return certdb -* Add another fixture to create a instance of `DirSrvWrap` passing the certdb +* Add another fixture to create an instance of `DirSrvWrap` passing the certdb returned from above fixture. With autouse=True, one doesn't have to explicitly state the fixture in the test functions:: @@ -411,7 +404,7 @@ Example-5: Creating and add Posix Users and Groups * Create another fixture to create posix users/groups here we create 10 users with dn uid=foo{1..10},ou=People,dc=example,dc=test, and a group called - ldapusers , where all the foo{1..10} are members of that group. The method + ldapusers, where all the foo{1..10} are members of that group. The method use for adding all the members to a group is we first add one user to the group while creating the group and then use ldap modify method to add other users to the group:: @@ -447,7 +440,7 @@ Example-5: Creating and add Posix Users and Groups assert ret == 'Success' -* call the fixture setup_ldap from the test functions as show below:: +* call the fixture setup_ldap from the test functions as below:: class TestCase(object): def class_setup(multihost, setup_ldap, create_posix_usersgroups) diff --git a/src/tests/python/docs/examples.rst b/src/tests/python/docs/examples.rst index c0458e2..f74d2ea 100644 --- a/src/tests/python/docs/examples.rst +++ b/src/tests/python/docs/examples.rst @@ -1,4 +1,4 @@ -Examples of using Multihost Plugin with Fixture for sssd +Examples of using Multihost Plugin with Fixture for SSSD ======================================================== * pytest multihost plugin uses paramiko/OpenSSHTransport to connect to hosts and provides methods to run commands and copy files. @@ -6,21 +6,21 @@ Examples of using Multihost Plugin with Fixture for sssd Namespace hook -------------- * With pytest multihost plugin we define the hosts under which the actual commands will be - running in a yaml/json file. This file is then read by multihost plugin. Each of the - host specified in the yaml file have a role, username/password, ip-address. + running in a YAML/JSON file. This file is then read by multihost plugin. Each of the + host specified in the YAML file have a role, username/password, IP address. -* pytest multihost provides modules and functions which takes this description of hosts in - yaml file , connect to the hosts and provides some common functions to run commands, copy/get - files etc. The main modules provided by multihost plugin are config, Domain, Host. To use - these modules we have to subclass them and change the behaviour to suite to our needs. +* pytest multihost provides modules and functions which takes the description of hosts in the + YAML file, connect to the hosts and provides some common functions to run commands, copy/get + files etc. The main modules provided by multihost plugin are config, domain, host. To use + these modules we have to subclass them and change their behaviour to suite our needs. -* For sssd qe we have subclass the config, domain and Host functions to suite our needs and - can be explanded. This is available through +* For SSSD QE we created subclasses of the config, domain and host functions to suite our needs and + expanded them. This is available through `qe_class.py `_. * qe_class.py also provides a global fixture called session_multihost which provides a session - scope fixture. This fixture can read the yaml file and provide a global multihost fixture - to all the tests. This fixture assumes that yaml file has hosts defined with any of these roles: + scope fixture. This fixture can read the YAML file and provide a global multihost fixture + to all the tests. This fixture assumes that the YAML file has hosts defined with any of these roles: - master - client @@ -32,7 +32,7 @@ Namespace hook * Below are the examples of using namespace hook: - - Single Host: + - Single host: * create a multihost config file mhc.yaml as below:: @@ -46,14 +46,15 @@ Namespace hook ip: 10.65.223.16 role: client - * Since we have 1 host with role client. we can create a namespace hook in conftest.py - to access the host as list + * since we have 1 host with role client we can create a namespace hook in conftest.py + to access the host as a list * create a conftest.py as below:: def pytest_namespace(): return { 'num_masters': 0, 'num_ad':0, 'num_atomic': 0, 'num_replicas': 0, 'num_clients':1, 'num_others': 0} - * In the actual testcase it can be accessed as below:: + + * in the actual testcase it can be accessed as below:: from sssd.testlib.common.qe_class import session_multihost class TestCase: @@ -76,18 +77,19 @@ Namespace hook ip: 10.65.223.16 role: client - name: client2 - external_hostname: client2.examplet.test + external_hostname: client2.example.test ip: 10.65.223.17 - role: cient + role: client - * Since we have 2 hosts with with role client. we can create a namespace hook in conftest.py - to access the hosts as list. + * since we have 2 hosts with role client we can create a namespace hook in conftest.py + to access the hosts as a list * create a conftest.py as below:: def pytest_namespace(): return { 'num_masters': 0, 'num_ad':0, 'num_atomic': 0, 'num_replicas': 0, 'num_clients':2, 'num_others': 0} - * In the actual testcase it can be accessed as below:: + + * in the actual testcase it can be accessed as below:: from sssd.testlib.common.qe_class import session_multihost class TestCase: @@ -100,7 +102,7 @@ Namespace hook - Multiple hosts of different roles: - * Create a multihost config file where we have 2 clients and 1 server:: + * create a multihost config file where we have 2 clients and 1 server:: root_password: 'redhat' domains: @@ -112,7 +114,7 @@ Namespace hook ip: 10.65.223.16 role: client - name: client2 - external_hostname: client2.examplet.test + external_hostname: client2.example.test ip: 10.65.223.17 role: client - name: server1 @@ -120,13 +122,14 @@ Namespace hook ip: 10.65.223.18 role: master - * Since we have 2 hosts with with role client and 1 host with role master we can create a namespace hook in conftest.py to access the hosts as list. + * since we have 2 hosts with with role client and 1 host with role master we can create a namespace hook in conftest.py to access the hosts as a list * create a conftest.py as below:: def pytest_namespace(): return { 'num_masters': 1, 'num_ad':0, 'num_atomic': 0, 'num_replicas': 0, 'num_clients':2, 'num_others': 0} - * In the actual testcase it can be accessed as below:: + + * in the actual testcase it can be accessed as below:: from sssd.testlib.common.qe_class import session_multihost class TestCase: @@ -137,8 +140,8 @@ Namespace hook session_multihost.master[0]. Example-1: Single host tests ------------------------------ -* create a multihost config file mhc.yaml with let's say 1 host:: +---------------------------- +* create a multihost config file mhc.yaml with 1 host as below:: root_password: 'redhat' domains: @@ -155,13 +158,14 @@ Example-1: Single host tests def pytest_namespace(): return { 'num_masters': 0, 'num_ad':0, 'num_atomic': 0, 'num_replicas': 0, 'num_clients':1, 'num_others':0 } -* create file called test1.py which contains testcases :: +* create file called test1.py which contains testcases:: from sssd.testlib.common.qe_class import session_multihost class TestCase: def test1(self, session_multihost): session_multihost.client[0].run_command(['ls', '-l']) -* Running the test:: + +* running the test:: $ py.test --multihost-config=mhc.yaml test1.py -s -v @@ -188,7 +192,7 @@ Example-2: Multiple hosts tests def pytest_namespace(): return { 'num_masters': 1, 'num_ad':0, 'num_atomic': 0, 'num_replicas': 0, 'num_clients':1, 'num_others':0 } -* create file called test1.py which contains testcases :: +* create file called test1.py which contains testcases:: from sssd.testlib.common.qe_class import session_multihost class TestCase: @@ -197,7 +201,8 @@ Example-2: Multiple hosts tests def test2(self, session_multihost): session_multihost.master[0].run_command(['ls', '-l']) -* Running the test:: + +* running the test:: $ py.test --multihost-config=mhc.yaml test1.py -s -v @@ -232,7 +237,7 @@ Example-3: Multiple hosts test with setup and teardown request.addfinalizer(lambda: request.cls().class_teardown(session_multihost)) return session_multihost -* create file called test1.py which contains testcases :: +* create file called test1.py which contains testcases:: class TestCase: def class_setup(self, session_multihost): @@ -245,13 +250,13 @@ Example-3: Multiple hosts test with setup and teardown def class_teardown(self, session_multihost): session_multihost.master[0].run_command(['userdel', 'foobar']) -* Running the test:: +* running the test:: $ py.test --multihost-config=mhc.yaml test1.py -s -v Example-4: Copying files to hosts using multihost plugin -------------------------------------------------------- -* scenario: Create a sssd.conf with specific configuration parameters. We create a local file on +* scenario: Create an sssd.conf file with specific configuration parameters. We create a local file on the system from which we are running py.test command (jslave/laptop/testsystem) and copy it to the actual hosts using transport.put_file method @@ -290,7 +295,6 @@ Example-5: Creating a fixture and calling a fixture * scenario: We want to configure sssd.conf before our test runs. we can create a function which configures sssd.conf and we call this function before our test runs - * create a file called conftest.py with below contents:: from sssd.testlib.common.qe_class import session_multihost @@ -340,17 +344,15 @@ Example-5: Creating a fixture and calling a fixture cmd = session_multihost.client[0].run_command(['service', 'sssd', 'stop']) assert cmd.returncode == 0 - -Example-6: Connecting to Windows system and running AD Specific commands -------------------------------------------------------------------------- - +Example-6: Connecting to Windows system and running AD specific commands +------------------------------------------------------------------------ * scenario: If the test requirement requires running any specific native commands on windows which cannot be fulfilled by adcli. Note: Connecting to Windows using multihost plugin requires ssh be running on Windows system. - for this multihost plugin has been tested only with OpenSSH provided using CYGWIN. So before - using multihost plugin please install CYGWIN and OpenSSH package. Configure OpenSSH on windows - and make sure firewall is allowing ssh port. + For this multihost plugin has been tested only with OpenSSH provided using CYGWIN. So before + using multihost plugin please install CYGWIN and OpenSSH package. Configure OpenSSH on Windows + and make sure its firewall is allowing ssh port. * create a multihost config file mhc.yaml with 2 hosts with roles master and client:: @@ -375,7 +377,7 @@ Example-6: Connecting to Windows system and running AD Specific commands def pytest_namespace(): return { 'num_masters': 0, 'num_ad':1, 'num_atomic': 0, 'num_replicas': 0, 'num_clients':1, 'num_others':0 } -* create file called test1.py which contains testcases :: +* create file called test1.py which contains testcases:: from sssd.testlib.common.qe_class import session_multihost class TestCase: diff --git a/src/tests/python/docs/kcm.rst b/src/tests/python/docs/kcm.rst index c0553f4..d8c32d2 100644 --- a/src/tests/python/docs/kcm.rst +++ b/src/tests/python/docs/kcm.rst @@ -1,11 +1,11 @@ -Examples of for testing KCM -=========================== +Examples of testing KCM +======================= Design ------ -* For testing KCM ccache, minimal requirements is to have a kerberos - server. sssd-testlib provides `libkrb5` module to setup kerberos servier. +* For testing KCM ccache, minimal requirements is to have a Kerberos + server. sssd-testlib provides `libkrb5` module to setup Kerberos server. * `sssd-testlib` now contains `utils` module which now contains functions to enable `sssd-kcm` @@ -13,16 +13,16 @@ Design * Below are some of the examples of using it in pytest -Example1: Using Single Host to test sssd-kcm ---------------------------------------------- -* Create a single host running Directory Server, krb5 server and configure - client to authenticate to ldap and kerberos server using sssd and enable KCM +Example1: Using single host to test sssd-kcm +-------------------------------------------- +* create a single host running Directory Server, krb5 server and configure + client to authenticate to LDAP and Kerberos server using SSSD and enable KCM * create a multihost config file mhc.yaml as below:: root_password: 'redhat' domains: - - name: testrelm.test + - name: testrealm.test type: sssd hosts: - name: idm1.example.test @@ -39,12 +39,12 @@ Example1: Using Single Host to test sssd-kcm return { 'num_masters': 0, 'num_ad':0, 'num_atomic': 0, num_replicas': 0, 'num_clients':1, 'num_others': 0} - * Create fixture to run Authconfig to authenticate to sssd:: + * create fixture to run Authconfig to authenticate to SSSD:: @pytest.fixture(scope="session") def config_authconfig(session_multihost, request): - """ Run authconfig to configure kerberos and - sssd auth on remote host + """ Run authconfig to configure Kerberos and + SSSD auth on remote host """ authconfig = RedHatAuthConfig(session_multihost.master[0]) session_multihost.master[0].log.info("Take backup of current authconfig") @@ -64,8 +64,7 @@ Example1: Using Single Host to test sssd-kcm request.addfinalizer(restore_authconfig) - - * Add a fixture to configure Directory Serverr:: + * add a fixture to configure Directory Server:: from sssd.testlib.common.libdirsrv import DirSrvWrap from sssd.testlib.common.utils import sssdTools, PkiTools @@ -88,7 +87,7 @@ Example1: Using Single Host to test sssd-kcm ds_obj.remove_ds_instance('example1') request.addfinalizer(remove_ldap) - * Add a fixture to configure kerberos server:: + * add a fixture to configure Kerberos server:: @pytest.fixture(scope='class') def setup_kerberos(session_multihost, request): @@ -101,7 +100,7 @@ Example1: Using Single Host to test sssd-kcm krb.destroy_krb5serer() request.addfinalizer(remove_kerberos) - * Add a fixture to setup sssd conf:: + * add a fixture to setup SSSD conf:: @pytest.fixture(scope='class', autouse=True) def setup_sssd(session_multihost, request): @@ -147,8 +146,7 @@ Example1: Using Single Host to test sssd-kcm session_multihost.master[0].run_command(journalctl_cmd) assert False - - * Add fixture to create some posix users and also create kerberos users with + * add fixture to create some POSIX users and also create Kerberos users with same names:: @pytest.fixture(scope='class', autouse=True) @@ -183,8 +181,8 @@ Example1: Using Single Host to test sssd-kcm (ret, return_value) = ldap_inst.modify_ldap(group_dn, add_member) assert ret == 'Success' - * Create a session fixture which calls config_authconfig, setup_ldap, - setup_kerber, fixture:: + * create a session fixture which calls config_authconfig, setup_ldap, + setup_kerberos:: @pytest.fixture(scope="session", autouse=True) def setup_session(request, session_multihost, @@ -196,9 +194,8 @@ Example1: Using Single Host to test sssd-kcm print("\n............Session teardown...............") request.addfinalizer(teardown) - - * Create a test suite file called test1.py, To test kcm as user, or - to check if the kerbeors user can ssh to the system, we can use + * create a test suite file called test1.py, to test KCM as user, or + to check if the Kerberos user can ssh to the system, we can use `SSHClient` module from `sssd.testlib.common.utils` module:: from sssd.testlib.common.utils import SSHClient @@ -206,7 +203,7 @@ Example1: Using Single Host to test sssd-kcm class TestBasicSSSD: - def test_kcm_sock(self, mulithost): + def test_kcm_sock(self, multihost): tools = sssdTools(session_multihost.master[0]) tools.enable_kcm() multihost.master[0].run_command(['systemctl', 'start', @@ -217,7 +214,7 @@ Example1: Using Single Host to test sssd-kcm assert cmd.returncode == 0 def test_ssh_user_login(self, multihost): - """ Check ssh login as ldap user with kerberos credentials """ + """ Check ssh login as LDAP user with Kerberos credentials """ ssh = SSHClient(multihost.master[0].sys_hostname, username='foo1', password='Secret123') assert ssh.connstatus diff --git a/src/tests/python/docs/krb5.rst b/src/tests/python/docs/krb5.rst index 3a87bc7..c877e4a 100644 --- a/src/tests/python/docs/krb5.rst +++ b/src/tests/python/docs/krb5.rst @@ -1,18 +1,18 @@ Examples of using libkrb5 module from sssd.testlib.common -=========================================================== -* sssd-testlib provides module libkrb5 which creates kerberos server instance +========================================================= +* sssd-testlib provides module libkrb5 which creates a Kerberos server instance Design ------ -* libkb5 module consists of class krb5Srv. +* libkb5 module consists of class krb5Srv -* krb5srv class consits of methods to create kerberos server +* krb5srv class consists of methods to create a Kerberos server -* Below are some of the examples of setting up kerberos server on RHEL7 +* below are some of the examples of setting up a Kerberos server on RHEL7 -Example-1: Setup kerberos Instance on single Host --------------------------------------------------- +Example-1: Setup a Kerberos instance on a single host +----------------------------------------------------- * create a multihost config file mhc.yaml as below:: root_password: 'redhat' @@ -35,7 +35,7 @@ Example-1: Setup kerberos Instance on single Host return {'num_masters': 1, 'num_ad':0, 'num_atomic': 0, 'num_replicas': 0, 'num_clients':1, 'num_others': 0} -* Add a fixture specifed below in conftest.py:: +* add a fixture specified below in conftest.py:: import subprocess @@ -47,7 +47,7 @@ Example-1: Setup kerberos Instance on single Host try: krb.krb_setup_new() except subprocess.CalledProcessError: - print("fail to setup kerberos") + print("fail to setup Kerberos") assert False * session_multihost is the session fixture which gets activated when @@ -57,12 +57,11 @@ Example-1: Setup kerberos Instance on single Host defined in multihost config file. In the above example client[0] is the multihost handle for host `server1.example.test` -* Importing the krb5srv module we are creating instance of +* importing the krb5srv module we are creating instance of krb5srv by passing the multihost session handle of master[0] to - the krb5srv object. + the krb5srv object - -* The fixture created setup_krb5 is of scope class which can be called in test file as below:: +* the fixture created by setup_krb5 is of scope class which can be called in a test file as below:: class TestCase(object): diff --git a/src/tests/python/docs/layout.rst b/src/tests/python/docs/layout.rst index 40b94db..698d72e 100644 --- a/src/tests/python/docs/layout.rst +++ b/src/tests/python/docs/layout.rst @@ -1,14 +1,13 @@ layout ====== -* This doc provides layout of sssd pytest framework and test suites directory. - +This doc provides the layout of SSSD pytest framework and test suites directory. module -------- - +------ * sssd.testlib - * This is the main top directory under which there are subdirectories containing various shared functions required to write tests using pytest + + This is the main top directory under which there are subdirectories containing various shared functions required to write tests using pytest * sssd.testlib/common - - * This directory contains shared functions which are generic in nature + + This directory contains shared functions which are generic in nature diff --git a/src/tests/python/docs/running.rst b/src/tests/python/docs/running.rst index f3b13c2..ea5c1af 100644 --- a/src/tests/python/docs/running.rst +++ b/src/tests/python/docs/running.rst @@ -1,44 +1,38 @@ running ======= - * Running Tests - Prerequisites ------------- +* pytest-multihost-plugin + + To execute tests with multiple tests, pytest-multihost plugin is required. + Refer to Install section for installing the plugin. - pytest-multihost-plugin - ----------------------- - To execute tests with multiple tests, pytest-multihost plugin is required. Refer to Install section for - installing the plugin - - sssd pytest framework - --------------------- - sssd pytest framework is mostly set of shared functions that is used in test cases for common tasks like authconfig, - setting up DS, kerberos, ipa, etc. sssd-testlib is the module provided by the framework. - +* SSSD pytest framework + + SSSD pytest framework is mostly set of shared functions that is used in test cases for common tasks like authconfig, setting up DS, Kerberos, IPA, etc. + sssd-testlib is the module provided by the framework. Getting Started ----------------- -* Functional Tests mostly written for SSSD require multiple hosts. Each of the hosts take a particular role. Below are the predifined roles used: - - * master: Node on which we have Direcory Server/Openldap Server/krb5 Server/IPA Server is running - * replica: Node on which is replica of Directory/Openldap Server/krb5 server - * client: Node on which sssd-client is configured - * ad: Node on which Microsoft Active Directory is running - * atomic: Atomic host Node +--------------- +* Functional Tests mostly written for SSSD require multiple hosts. Each of the hosts take a particular role. Below are the predefined roles used: + - master: Node on which we have Directory Server/OpenLDAP Server/krb5 Server/IPA Server is running + - replica: Node on which is replica of Directory/OpenLDAP Server/krb5 server + - client: Node on which sssd-client is configured + - ad: Node on which Microsoft Active Directory is running + - atomic: Atomic host Node config -------- - - * To run multihosts tests using pytest, we have to define the infrastructure containing RHEL and Windows systems in a file. Check Example config file:: +------ +* To run multihosts tests using pytest, we have to define the infrastructure containing RHEL and Windows systems in a file. Check Example config file:: root_password: 'redhat' test_dir: '/root/multihost' windows_test_dir: '/home/administrator' domains: - - name: testrelm.test + - name: testrealm.test type: sssd hosts: - name: hostname1 @@ -56,37 +50,39 @@ config username: Administrator password: Secret123 - Brief description of the above lines: +Brief description of the above lines: **root_password** is the root password of the systems, it's better to have common password of the RHEL systems that you would like to connect. - Instead of password , One can use ssh keys, in which the parameter is **ssh_key_filename: ~/.ssh/id_rsa** + Instead of password, you can use ssh keys, in which the parameter is **ssh_key_filename: ~/.ssh/id_rsa** **test_dir** directory to store test-specific data in, defaults to **/root/multihost_tests** **windows_test_dir** Directory to store test-specific data on Windows hosts, defaults to **/home/Administrator** - **Domains** is a list of domains under which the hosts that will run the commands reside , Domains are way of classifying - hosts, + **Domains** is a list of domains under which the hosts that will run the commands reside. Domains are a way of classifying hosts. - **name(Under Domains)** is the name of the domain , can be any name (resolvable/non-resolvable) + **name(under Domains)** is the name of the domain, can be any name (resolvable/non-resolvable) **type(under Domains)** is the type of hosts, a string specifying the type of the domain ('default' by default) **hosts(under Domains)** is a placeholder for list of hosts - **name(under hosts)** is a hostname to which multihost needs to connect , can be a short name in which case FQDN will be formed by combining name and domain + **name(under hosts)** is a hostname to which multihost needs to connect, can be a short name in which case the FQDN will be formed by combining name and domain name specified under domains. - **ip** is the ipaddress of the system + **ip** is the IP address of the system + **role** is the role that the host will be taking, like master/slave/replica/ad/atomic - **username** (optional) each host can have it's specific username to connect to, Example for connecting Windows systems we use username 'Administrator' + + **username** (optional) each host can have its specific username to connect to. For example for connecting to Windows systems we use username 'Administrator' + **password** password to connect to Executing Tests --------------- * To execute existing tests clone sssd-qe-tests repo and run py.test against any specific test suite directory. - * On RHEL7.2:: + - On RHEL7.2:: $ git clone git://git.app.eng.bos.redhat.com/sssd-qe-tests.git $ cd sssd-qe-tests/pytest @@ -94,24 +90,23 @@ Executing Tests * Before executing any tests, it's required to create a config file as specified in `config` section. - * Executing test suite:: + - Executing test suite:: $ cd sssd-qe-tests/pytest/ $ py.test --junit-xml=/tmp/junit.xml \ --multihost-config=mh_cfg.yaml \ -v - * Executing Individual Test sub-suite (module):: + - Executing Individual Test sub-suite (module):: $ cd sssd-qe-tests/pytest/ $ py.test --junit-xml=/tmp/junit.xml \ --multihost-config=mh_cfg.yaml \ -v - * Executing individual Test cases.:: + - Executing individual Test cases:: $ cd sssd-qe-tests/pytest/ - $ py.test --junit.xml=/tmp/junit.xml \ --multihosts-config=mh_cfg.yaml \ -v /.py:::: diff --git a/src/tests/python/sssd-testlib.spec b/src/tests/python/sssd-testlib.spec index 22f989c..6987d0e 100644 --- a/src/tests/python/sssd-testlib.spec +++ b/src/tests/python/sssd-testlib.spec @@ -18,7 +18,7 @@ Name: %{name} Version: %{version} Release: %{release}%{?dist} -Summary: System Services Security Daemon(sssd) PyTest Framework +Summary: System Services Security Daemon (SSSD) PyTest Framework License: GPLv3+ Source0: %{name}.tar.gz @@ -59,7 +59,7 @@ Requires: ipa-python %endif %description -An python framework for System Services Security Daemon(sssd) PyTest Framework. +A python framework for System Services Security Daemon (SSSD) PyTest Framework. %prep %setup -qn %{project} @@ -112,7 +112,7 @@ install -m 644 sssd/testlib/etc/* %{buildroot}/etc/sssd_testlib/ * Fri Jul 7 2017 Niranjan MR - 0.1-11 - pylint fixes * Sat Apr 19 2017 Niranjan MR - 0.1-10 -- Add functions to create posix users/groups +- Add functions to create POSIX users/groups - Add libkrb5 module to create kerberos server - Use paramiko to test ssh logins for non-root users - Update documentation @@ -125,7 +125,7 @@ install -m 644 sssd/testlib/etc/* %{buildroot}/etc/sssd_testlib/ - updated docs on setting up DS instances using multihost * Wed Nov 30 2016 Niranjan MR - 0.1-6 - Add functions related to configuring Directory Server, -- Add functions related to adding, removing, modifying AD users, +- Add functions related to adding, removing, modifying AD users, and adding UNIX attributes to Windows AD Users * Fri Oct 21 2016 Niranjan MR - 0.1-5 - Add functions to connect AD and move common fixtures @@ -139,6 +139,6 @@ install -m 644 sssd/testlib/etc/* %{buildroot}/etc/sssd_testlib/ - Use systemctl instead of service command for systemd based versions * Fri Jul 15 2016 Niranjan MR - 0.1-2 - Modified qe_class.py to make Windows AD details to be in separate domain -- Added ipa-python as as Runtime dependency +- Added ipa-python as a Runtime dependency * Thu Jun 30 2016 Niranjan MR - 0.1-1 - initial version- diff --git a/src/tests/python/sssd/testlib/etc/pylintrc b/src/tests/python/sssd/testlib/etc/pylintrc index f91e969..c6db192 100644 --- a/src/tests/python/sssd/testlib/etc/pylintrc +++ b/src/tests/python/sssd/testlib/etc/pylintrc @@ -71,7 +71,7 @@ disable=R0201,R0903,E1123,W0621,E1121 [REPORTS] # Set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html. You can also give a reporter class, eg +# (visual studio) and html. You can also give a reporter class, e.g. # mypackage.mymodule.MyReporterClass. output-format=text @@ -120,7 +120,7 @@ generated-members= [BASIC] -# List of builtins function names that should not be used, separated by a comma +# List of built-in function names that should not be used, separated by a comma bad-functions=map,filter,input # Good variable names which should always be accepted, separated by a comma @@ -242,8 +242,8 @@ init-import=no # not used). dummy-variables-rgx=_$|dummy -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. +# List of additional names supposed to be defined in built-ins. Remember that +# you should avoid to define new built-ins when possible. additional-builtins= # List of strings which can identify a callback function by name. A callback @@ -357,7 +357,7 @@ min-public-methods=2 # Maximum number of public methods for a class (see R0904). max-public-methods=20 -# Maximum number of boolean expressions in a if statement +# Maximum number of Boolean expressions in an if statement max-bool-expr=5