URL: https://github.com/SSSD/sssd/pull/5303 Author: pbrezina Title: #5303: tests: run TIER-0 multihost tests in PRCI Action: synchronized
To pull the PR as Git branch: git remote add ghsssd https://github.com/SSSD/sssd git fetch ghsssd pull/5303/head:pr5303 git checkout pr5303
From 38ad85b26b458908956aeb16b2f9d3c2b2ed1d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrez...@redhat.com> Date: Fri, 28 Aug 2020 13:09:22 +0200 Subject: [PATCH 1/4] multihost: move sssd.testlib closer to tests So it can be used directly without the need of installing the package. --- .gitignore | 6 ++++++ Makefile.am | 2 +- src/tests/{python => multihost}/MANIFEST.in | 0 src/tests/{python => multihost}/README.rst | 0 src/tests/multihost/{basic => }/conftest.py | 0 src/tests/{python => multihost}/docs/Install.rst | 0 src/tests/{python => multihost}/docs/Makefile | 0 src/tests/{python => multihost}/docs/MultihostPlugin.rst | 0 src/tests/{python => multihost}/docs/conf.py | 0 src/tests/{python => multihost}/docs/ds_389.rst | 0 src/tests/{python => multihost}/docs/examples.rst | 0 src/tests/{python => multihost}/docs/index.rst | 0 src/tests/{python => multihost}/docs/kcm.rst | 0 src/tests/{python => multihost}/docs/krb5.rst | 0 src/tests/{python => multihost}/docs/layout.rst | 0 src/tests/{python => multihost}/docs/running.rst | 0 src/tests/{python => multihost}/docs/sssd-testlib.rst | 0 src/tests/{python => multihost}/setup.py | 0 src/tests/{python => multihost}/sssd-testlib.spec | 0 src/tests/{python => multihost}/sssd/__init__.py | 0 src/tests/{python => multihost}/sssd/testlib/__init__.py | 0 .../{python => multihost}/sssd/testlib/common/__init__.py | 0 .../{python => multihost}/sssd/testlib/common/authconfig.py | 0 .../{python => multihost}/sssd/testlib/common/exceptions.py | 0 .../{python => multihost}/sssd/testlib/common/libdirsrv.py | 0 .../{python => multihost}/sssd/testlib/common/libkrb5.py | 0 .../{python => multihost}/sssd/testlib/common/qe_class.py | 0 .../{python => multihost}/sssd/testlib/common/utils.py | 0 src/tests/{python => multihost}/sssd/testlib/etc/pylintrc | 0 29 files changed, 7 insertions(+), 1 deletion(-) rename src/tests/{python => multihost}/MANIFEST.in (100%) rename src/tests/{python => multihost}/README.rst (100%) rename src/tests/multihost/{basic => }/conftest.py (100%) rename src/tests/{python => multihost}/docs/Install.rst (100%) rename src/tests/{python => multihost}/docs/Makefile (100%) rename src/tests/{python => multihost}/docs/MultihostPlugin.rst (100%) rename src/tests/{python => multihost}/docs/conf.py (100%) rename src/tests/{python => multihost}/docs/ds_389.rst (100%) rename src/tests/{python => multihost}/docs/examples.rst (100%) rename src/tests/{python => multihost}/docs/index.rst (100%) rename src/tests/{python => multihost}/docs/kcm.rst (100%) rename src/tests/{python => multihost}/docs/krb5.rst (100%) rename src/tests/{python => multihost}/docs/layout.rst (100%) rename src/tests/{python => multihost}/docs/running.rst (100%) rename src/tests/{python => multihost}/docs/sssd-testlib.rst (100%) rename src/tests/{python => multihost}/setup.py (100%) rename src/tests/{python => multihost}/sssd-testlib.spec (100%) rename src/tests/{python => multihost}/sssd/__init__.py (100%) rename src/tests/{python => multihost}/sssd/testlib/__init__.py (100%) rename src/tests/{python => multihost}/sssd/testlib/common/__init__.py (100%) rename src/tests/{python => multihost}/sssd/testlib/common/authconfig.py (100%) rename src/tests/{python => multihost}/sssd/testlib/common/exceptions.py (100%) rename src/tests/{python => multihost}/sssd/testlib/common/libdirsrv.py (100%) rename src/tests/{python => multihost}/sssd/testlib/common/libkrb5.py (100%) rename src/tests/{python => multihost}/sssd/testlib/common/qe_class.py (100%) rename src/tests/{python => multihost}/sssd/testlib/common/utils.py (100%) rename src/tests/{python => multihost}/sssd/testlib/etc/pylintrc (100%) diff --git a/.gitignore b/.gitignore index 82432e181b..0db85d90df 100644 --- a/.gitignore +++ b/.gitignore @@ -112,3 +112,9 @@ sss_ssh_knownhostsproxy sssd_ssh test-authtok /ci-build-* + +# multihost tests +!src/tests/multihost/sssd +!src/tests/multihost/docs/Makefile +!src/tests/multihost/setup.py +!src/tests/multihost/sssd-testlib.spec diff --git a/Makefile.am b/Makefile.am index 5fd44b169c..aa703c9874 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5486,7 +5486,7 @@ dist_noinst_DATA += \ contrib/sssd.spec.in \ BUILD.txt \ COPYING \ - src/tests/multihost/basic/conftest.py \ + src/tests/multihost/conftest.py \ src/tests/multihost/basic/mhc.yaml \ src/tests/multihost/basic/README.md \ src/tests/multihost/basic/test_basic.py \ diff --git a/src/tests/python/MANIFEST.in b/src/tests/multihost/MANIFEST.in similarity index 100% rename from src/tests/python/MANIFEST.in rename to src/tests/multihost/MANIFEST.in diff --git a/src/tests/python/README.rst b/src/tests/multihost/README.rst similarity index 100% rename from src/tests/python/README.rst rename to src/tests/multihost/README.rst diff --git a/src/tests/multihost/basic/conftest.py b/src/tests/multihost/conftest.py similarity index 100% rename from src/tests/multihost/basic/conftest.py rename to src/tests/multihost/conftest.py diff --git a/src/tests/python/docs/Install.rst b/src/tests/multihost/docs/Install.rst similarity index 100% rename from src/tests/python/docs/Install.rst rename to src/tests/multihost/docs/Install.rst diff --git a/src/tests/python/docs/Makefile b/src/tests/multihost/docs/Makefile similarity index 100% rename from src/tests/python/docs/Makefile rename to src/tests/multihost/docs/Makefile diff --git a/src/tests/python/docs/MultihostPlugin.rst b/src/tests/multihost/docs/MultihostPlugin.rst similarity index 100% rename from src/tests/python/docs/MultihostPlugin.rst rename to src/tests/multihost/docs/MultihostPlugin.rst diff --git a/src/tests/python/docs/conf.py b/src/tests/multihost/docs/conf.py similarity index 100% rename from src/tests/python/docs/conf.py rename to src/tests/multihost/docs/conf.py diff --git a/src/tests/python/docs/ds_389.rst b/src/tests/multihost/docs/ds_389.rst similarity index 100% rename from src/tests/python/docs/ds_389.rst rename to src/tests/multihost/docs/ds_389.rst diff --git a/src/tests/python/docs/examples.rst b/src/tests/multihost/docs/examples.rst similarity index 100% rename from src/tests/python/docs/examples.rst rename to src/tests/multihost/docs/examples.rst diff --git a/src/tests/python/docs/index.rst b/src/tests/multihost/docs/index.rst similarity index 100% rename from src/tests/python/docs/index.rst rename to src/tests/multihost/docs/index.rst diff --git a/src/tests/python/docs/kcm.rst b/src/tests/multihost/docs/kcm.rst similarity index 100% rename from src/tests/python/docs/kcm.rst rename to src/tests/multihost/docs/kcm.rst diff --git a/src/tests/python/docs/krb5.rst b/src/tests/multihost/docs/krb5.rst similarity index 100% rename from src/tests/python/docs/krb5.rst rename to src/tests/multihost/docs/krb5.rst diff --git a/src/tests/python/docs/layout.rst b/src/tests/multihost/docs/layout.rst similarity index 100% rename from src/tests/python/docs/layout.rst rename to src/tests/multihost/docs/layout.rst diff --git a/src/tests/python/docs/running.rst b/src/tests/multihost/docs/running.rst similarity index 100% rename from src/tests/python/docs/running.rst rename to src/tests/multihost/docs/running.rst diff --git a/src/tests/python/docs/sssd-testlib.rst b/src/tests/multihost/docs/sssd-testlib.rst similarity index 100% rename from src/tests/python/docs/sssd-testlib.rst rename to src/tests/multihost/docs/sssd-testlib.rst diff --git a/src/tests/python/setup.py b/src/tests/multihost/setup.py similarity index 100% rename from src/tests/python/setup.py rename to src/tests/multihost/setup.py diff --git a/src/tests/python/sssd-testlib.spec b/src/tests/multihost/sssd-testlib.spec similarity index 100% rename from src/tests/python/sssd-testlib.spec rename to src/tests/multihost/sssd-testlib.spec diff --git a/src/tests/python/sssd/__init__.py b/src/tests/multihost/sssd/__init__.py similarity index 100% rename from src/tests/python/sssd/__init__.py rename to src/tests/multihost/sssd/__init__.py diff --git a/src/tests/python/sssd/testlib/__init__.py b/src/tests/multihost/sssd/testlib/__init__.py similarity index 100% rename from src/tests/python/sssd/testlib/__init__.py rename to src/tests/multihost/sssd/testlib/__init__.py diff --git a/src/tests/python/sssd/testlib/common/__init__.py b/src/tests/multihost/sssd/testlib/common/__init__.py similarity index 100% rename from src/tests/python/sssd/testlib/common/__init__.py rename to src/tests/multihost/sssd/testlib/common/__init__.py diff --git a/src/tests/python/sssd/testlib/common/authconfig.py b/src/tests/multihost/sssd/testlib/common/authconfig.py similarity index 100% rename from src/tests/python/sssd/testlib/common/authconfig.py rename to src/tests/multihost/sssd/testlib/common/authconfig.py diff --git a/src/tests/python/sssd/testlib/common/exceptions.py b/src/tests/multihost/sssd/testlib/common/exceptions.py similarity index 100% rename from src/tests/python/sssd/testlib/common/exceptions.py rename to src/tests/multihost/sssd/testlib/common/exceptions.py diff --git a/src/tests/python/sssd/testlib/common/libdirsrv.py b/src/tests/multihost/sssd/testlib/common/libdirsrv.py similarity index 100% rename from src/tests/python/sssd/testlib/common/libdirsrv.py rename to src/tests/multihost/sssd/testlib/common/libdirsrv.py diff --git a/src/tests/python/sssd/testlib/common/libkrb5.py b/src/tests/multihost/sssd/testlib/common/libkrb5.py similarity index 100% rename from src/tests/python/sssd/testlib/common/libkrb5.py rename to src/tests/multihost/sssd/testlib/common/libkrb5.py diff --git a/src/tests/python/sssd/testlib/common/qe_class.py b/src/tests/multihost/sssd/testlib/common/qe_class.py similarity index 100% rename from src/tests/python/sssd/testlib/common/qe_class.py rename to src/tests/multihost/sssd/testlib/common/qe_class.py diff --git a/src/tests/python/sssd/testlib/common/utils.py b/src/tests/multihost/sssd/testlib/common/utils.py similarity index 100% rename from src/tests/python/sssd/testlib/common/utils.py rename to src/tests/multihost/sssd/testlib/common/utils.py diff --git a/src/tests/python/sssd/testlib/etc/pylintrc b/src/tests/multihost/sssd/testlib/etc/pylintrc similarity index 100% rename from src/tests/python/sssd/testlib/etc/pylintrc rename to src/tests/multihost/sssd/testlib/etc/pylintrc From 000e135a986dc0dea10db11657212f919ed7fed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrez...@redhat.com> Date: Fri, 28 Aug 2020 13:10:01 +0200 Subject: [PATCH 2/4] multihost: remove packaging files The test library is not currently published in pypi nor Fedora and it is not being reused by other projects so it makes no sense for us to keep maintaining these files. --- src/tests/multihost/MANIFEST.in | 3 - src/tests/multihost/README.rst | 4 - src/tests/multihost/requirements.txt | 5 + src/tests/multihost/setup.py | 38 ------- src/tests/multihost/sssd-testlib.spec | 144 -------------------------- 5 files changed, 5 insertions(+), 189 deletions(-) delete mode 100644 src/tests/multihost/MANIFEST.in delete mode 100644 src/tests/multihost/README.rst create mode 100644 src/tests/multihost/requirements.txt delete mode 100644 src/tests/multihost/setup.py delete mode 100644 src/tests/multihost/sssd-testlib.spec diff --git a/src/tests/multihost/MANIFEST.in b/src/tests/multihost/MANIFEST.in deleted file mode 100644 index f880c36cdd..0000000000 --- a/src/tests/multihost/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -include README.rst -recursive-include sssd/testlib/etc/ * -recursive-include docs * diff --git a/src/tests/multihost/README.rst b/src/tests/multihost/README.rst deleted file mode 100644 index 16da90f390..0000000000 --- a/src/tests/multihost/README.rst +++ /dev/null @@ -1,4 +0,0 @@ -sssd_qe_tests -============= - -`sssd.testlib` is a library containing shared functions to automate `System Services Security Daemon (SSSD)` using pytest framework. diff --git a/src/tests/multihost/requirements.txt b/src/tests/multihost/requirements.txt new file mode 100644 index 0000000000..84272a9eca --- /dev/null +++ b/src/tests/multihost/requirements.txt @@ -0,0 +1,5 @@ +paramiko +pytest +pytest_multihost +python-ldap +PyYAML diff --git a/src/tests/multihost/setup.py b/src/tests/multihost/setup.py deleted file mode 100644 index b0a2413da7..0000000000 --- a/src/tests/multihost/setup.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/python -# -# Copyright (C) 2016 sssd-qe contributors. -# -from setuptools import setup - -REQUIRES = [ - 'paramiko', - 'PyYAML', - 'python-ldap', - 'pytest_multihost', - 'pytest'] - -with open('README.rst', 'r') as f: - README = f.read() - -setup_args = dict( - name='sssd.testlib', - version='0.1-11', - description='System Services Security Daemon python test suite', - long_description=README, - author=u'SSSD QE Team', - url='http://git.app.eng.bos.redhat.com/git/sssd-qe-tests.git/', - packages=[ - 'sssd', - 'sssd.testlib', - 'sssd.testlib.common', - ], - package_data={'': ['LICENSE']}, - install_requires=REQUIRES, - license='GNU GPL v3.0', - classifiers=( - 'Programming Language :: Python', - 'Programming Language :: Python :: 2.7', - ), -) -if __name__ == '__main__': - setup(**setup_args) diff --git a/src/tests/multihost/sssd-testlib.spec b/src/tests/multihost/sssd-testlib.spec deleted file mode 100644 index 6987d0ed81..0000000000 --- a/src/tests/multihost/sssd-testlib.spec +++ /dev/null @@ -1,144 +0,0 @@ -%if 0%{?rhel} && 0%{?rhel} >= 8 -%global with_python3 1 -%else -%{!?__python2: %global __python2 /usr/bin/python2} -%{!?python2_sitelib2: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} -%endif -%if 0%{?fedora} >= 27 -%global with_python3 1 -%endif - -%define name sssd-testlib -%define owner sssd-qe -%define project sssd-testlib -%define version 0.1 -%define release 11 -%define srcname sssd-testlib - -Name: %{name} -Version: %{version} -Release: %{release}%{?dist} -Summary: System Services Security Daemon (SSSD) PyTest Framework -License: GPLv3+ -Source0: %{name}.tar.gz - -BuildArch: noarch -%if 0%{?with_python3} -BuildRequires: python3-devel -%else -%if 0%{?fedora} -BuildRequires: python2-devel -%else -BuildRequires: python-devel -%endif -%endif - -%if 0%{?fedora} -Requires: python3-paramiko -Requires: freeipa-python -Requires: python3-pytest-multihost >= 1.1 -Requires: python3-PyYAML -Requires: python3-pytest -Requires: python-dns -Requires: python-krbV -Requires: python-nss -%else -Requires: python-paramiko -Requires: python-pytest-multihost >= 1.1 -Requires: PyYAML -Requires: pytest -Requires: python-ldap -Requires: openldap-clients -Requires: python-dns -Requires: python-krbV -Requires: python-nss -%else -%if 0%{?rhel} -Requires: ipa-python -%endif -%endif - -%description -A python framework for System Services Security Daemon (SSSD) PyTest Framework. - -%prep -%setup -qn %{project} - -%if 0%{?with_python3} -echo %{py3dir} -rm -rf %{py3dir} -cp -a . %{py3dir} -%endif - -%build -%{__python2} setup.py build -%if 0%{?with_python3} -pushd %{py3dir} -%{__python3} setup.py build -popd -%endif - -%install -%{__python2} setup.py install -O1 --skip-build --root %{buildroot} -%if 0%{?with_python3} -%py_byte_compile %{__python2} %{buildroot}%{python_sitelib}/%{srcname} -%else -%{__python2} -m compileall %{buildroot}%{python_sitelib}/%{srcname} -%endif - -%if 0%{?with_python3} -pushd %{py3dir} -%{__python3} setup.py install --skip-build --root %{buildroot} -%py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/%{srcname} -popd -%endif - -mkdir -p %{buildroot}/etc/sssd_testlib -install -m 644 sssd/testlib/etc/* %{buildroot}/etc/sssd_testlib/ - -%files -%doc README.rst docs/* -%config /etc/sssd_testlib -%if 0%{?fedora} -%{python2_sitelib}/* -%endif -%if 0%{?with_python3} -%{python3_sitelib}/* -%else: -%{python2_sitelib}/* -%endif - -%changelog -* Fri Jul 7 2017 Niranjan MR <mrniran...@redhat.com> - 0.1-11 -- pylint fixes -* Sat Apr 19 2017 Niranjan MR <mrniran...@redhat.com> - 0.1-10 -- 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 -* Tue Mar 14 2017 Niranjan MR <mrniran...@redhat.com> - 0.1-9 -- Use adcli with realm to join system to Windows AD -* Mon Feb 20 2017 Niranjan MR <mrniran...@redhat.com> - 0.1-8 -- Fix indetation issues with qe_class.py -* Fri Feb 17 2017 Niranjan MR <mrniran...@redhat.com> - 0.1-7 -- pep8 fixes to sssd.testlib.common -- updated docs on setting up DS instances using multihost -* Wed Nov 30 2016 Niranjan MR <mrniran...@redhat.com> - 0.1-6 -- Add functions related to configuring Directory Server, -- Add functions related to adding, removing, modifying AD users, - and adding UNIX attributes to Windows AD Users -* Fri Oct 21 2016 Niranjan MR <mrniran...@redhat.com> - 0.1-5 -- Add functions to connect AD and move common fixtures - as sssdTools module in common -* Sat Sep 10 2016 Niranjan MR <mrniran...@redhat.com> - 0.1-4 -- Add Run time requirement to have pytest-multihost >= 1.1 -- Modify spec file to be built on fedora/rhel -- When using fedora 24 and above use python3 -* Wed Aug 24 2016 Niranjan MR <mrniran...@redhat.com> - 0.1-3 -- Add functions to start/stop/restart sssd based on RHEL versions -- Use systemctl instead of service command for systemd based versions -* Fri Jul 15 2016 Niranjan MR <mrnirna...@redhat.com> - 0.1-2 -- Modified qe_class.py to make Windows AD details to be in separate domain -- Added ipa-python as a Runtime dependency -* Thu Jun 30 2016 Niranjan MR <mrniran...@redhat.com> - 0.1-1 -- initial version- From a290b1e6f913d5c6036d6e283f6c6a91287ba693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrez...@redhat.com> Date: Thu, 17 Sep 2020 14:41:53 +0200 Subject: [PATCH 3/4] spec: enable kcm by default --- contrib/sssd.spec.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/sssd.spec.in b/contrib/sssd.spec.in index 1487251c7d..ed81da5356 100644 --- a/contrib/sssd.spec.in +++ b/contrib/sssd.spec.in @@ -838,6 +838,13 @@ install -m644 src/examples/logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/s mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rwtab.d install -m644 src/examples/rwtab $RPM_BUILD_ROOT%{_sysconfdir}/rwtab.d/sssd +# Kerberos KCM credential cache by default +%if (0%{?with_kcm} == 1) +mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/krb5.conf.d +cp $RPM_BUILD_ROOT/%{_datadir}/sssd-kcm/kcm_default_ccache \ + $RPM_BUILD_ROOT/%{_sysconfdir}/krb5.conf.d/kcm_default_ccache +%endif + %if (0%{?with_cifs_utils_plugin} == 1) # Create directory for cifs-idmap alternative # Otherwise this directory could not be owned by sssd-client @@ -1351,6 +1358,7 @@ done %if (0%{?with_secrets} == 1) %{_libexecdir}/%{servicename}/sssd_secrets %endif +%config(noreplace) %{_sysconfdir}/krb5.conf.d/kcm_default_ccache %dir %{_datadir}/sssd-kcm %{_datadir}/sssd-kcm/kcm_default_ccache %{_unitdir}/sssd-kcm.socket From 3e1f8c800db2ff2e057dd152d59777b37be670a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrez...@redhat.com> Date: Tue, 25 Aug 2020 10:21:01 +0200 Subject: [PATCH 4/4] tests: run TIER-0 multihost tests in PRCI --- Makefile.am | 2 +- contrib/ci/run-multihost | 55 ++++++++++++++ contrib/test-suite/test-suite.yml | 11 +++ src/tests/multihost/README.md | 49 +++++++++++++ src/tests/multihost/basic/README.md | 107 ---------------------------- src/tests/multihost/basic/mhc.yaml | 15 ++-- 6 files changed, 123 insertions(+), 116 deletions(-) create mode 100755 contrib/ci/run-multihost create mode 100644 src/tests/multihost/README.md delete mode 100644 src/tests/multihost/basic/README.md diff --git a/Makefile.am b/Makefile.am index aa703c9874..14c1725cf2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5486,9 +5486,9 @@ dist_noinst_DATA += \ contrib/sssd.spec.in \ BUILD.txt \ COPYING \ + src/tests/multihost/README.md \ src/tests/multihost/conftest.py \ src/tests/multihost/basic/mhc.yaml \ - src/tests/multihost/basic/README.md \ src/tests/multihost/basic/test_basic.py \ src/tests/multihost/basic/test_config.py \ src/tests/multihost/basic/test_files.py \ diff --git a/contrib/ci/run-multihost b/contrib/ci/run-multihost new file mode 100755 index 0000000000..8eaf119c93 --- /dev/null +++ b/contrib/ci/run-multihost @@ -0,0 +1,55 @@ +#!/bin/bash +# +# Run multihost tests. +# +# CAUTION: This script will modify your system so execute it with caution. It is +# supposed to be run only in SSSD CI and it expected that it is executed from +# SSSD source directory. +# +# Copyright (C) 2020 Red Hat +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +set -o nounset -o pipefail -o errexit -o xtrace +declare -r CI_DIR=`dirname "\`readlink -f \"\$0\"\`"` +export PATH=$CI_DIR:$PATH + +. distro.sh + +if [[ $DISTRO_FAMILY != redhat || + $DISTRO_BRANCH == -redhat-redhatenterprise*-7.*- || + $DISTRO_BRANCH == -redhat-centos-7.*- ]]; then + echo "Unsupported platform." + exit 0 +fi + +echo "Building SSSD" +autoreconf -if &> multihost-build.log +./configure &>> multihost-build.log +make rpms &>> multihost-build.log + +# Remove old packages to avoid conflict if something has changed +echo "Removing current SSSD packages" +sudo yum remove -y --noautoremove sssd\* &> multihost-remove.log + +echo "Installing SSSD" +sudo yum install -y ./rpmbuild/RPMS/*/*.rpm &> multihost-install.log + +DIR=src/tests/multihost + +echo "Installing python requirements" +sudo pip3 install -r $DIR/requirements.txt &> multihost-pip.log + +echo "Running tests" +pytest-3 -s --multihost-config=$DIR/basic/mhc.yaml $DIR &> multihost-pytest.log diff --git a/contrib/test-suite/test-suite.yml b/contrib/test-suite/test-suite.yml index 49763fa4b6..66f2606537 100644 --- a/contrib/test-suite/test-suite.yml +++ b/contrib/test-suite/test-suite.yml @@ -10,3 +10,14 @@ - ci-build-debug/test-suite.log - ci-build-debug/ci-mock-result/*.log timeout: 6 hours + +- name: Multihost tests Tier 0 + machines: + - client + tasks: + - name: Running ./contrib/ci/run-multihost + shell: | + ./contrib/ci/run-multihost + timeout: 6 hours + artifacts: + - multihost-*.log diff --git a/src/tests/multihost/README.md b/src/tests/multihost/README.md new file mode 100644 index 0000000000..6e5919abcb --- /dev/null +++ b/src/tests/multihost/README.md @@ -0,0 +1,49 @@ +# Instructions on executing tests + +Multihost tests uses the `python-multihost` framework to execute test commands +on remote machines. The tests themselves are run locally via pytest. + +## Install requirements + +``` +sudo pip3 install -r src/tests/multihost/requirements.txt +``` + +You can also install them in virtual environment using the virtualenv command +if you wish. + +## Prepare remote machines + +Existing tests currently requires only one remote machine where the SSSD version +that you want to test is installed. The machine must be Fedora or RHEL so it can +be correctly provisioned. The **tests will modify the machine** so use something +disposable. + +It is recommended to use [sssd-test-suite] project to create such machine. The +multihost tests can run out of the box using [sssd-test-suite] without any +further changes. + +[sssd-test-suite]: https://github.com/SSSD/sssd-test-suite + +## Prepare multihost configuration + +Edit `src/tests/multihost/basic/mhc.yaml`: + +```yaml +root_password: 'vagrant' # use remote machine root password +domains: +- name: tier0.tests + type: sssd + hosts: + - name: client + external_hostname: master.client.vm # your machine fully qualified name + role: master +``` + +Note: You can skip this step if you use machines from sssd-test-suite. + +## Run the tests + +``` +pytest-3 -s --multihost-config=src/tests/multihost/basic/mhc.yaml src/tests/multihost +``` diff --git a/src/tests/multihost/basic/README.md b/src/tests/multihost/basic/README.md deleted file mode 100644 index 95eb8aa564..0000000000 --- a/src/tests/multihost/basic/README.md +++ /dev/null @@ -1,107 +0,0 @@ -# Instructions on executing tests - -This Directory contains test written with pytest framework using pytest-multihost plugin. - - -## Requirements - -1. Controller Node/Jumphost from where pytest is invoked. pytest and pytest-multihost plugin needs -to be installed. - -2. Another Fedora/RHEL8 system(SUT/System under test) on which the actual commands specified in tests are run. - -## Steps: - -1. Setup required on Controller Node/Jumphost - -* On Fedora 30 , Install below packages using dnf: - - ```$ dnf install python3-pip nss-tools python3-virtualenv gcc git openldap-devel``` - -* Clone sssd using **git**:: - - ```$ git clone https://github.com/SSSD/sssd/``` - -* Create a Isolated Virtual Python Environment:: - - ```$ virtualenv /tmp/abc``` - -* Activate the Virtual environment:: - - ``` - $ source /tmp/abc/bin/activate - $ (abc) [root@master-7740 bin]# - ``` - -* Install the sssd-testlib on your virtualenv:: - - ``` - $ cd sssd/src/tests/python - $ python setup.py install - ``` -* Install **pytest, pytest-multihost, python-ldap, paramiko, PyYAML**:: - - ```$ pip install pytest pytest-multihost paramiko python-ldap PyYAML``` - -2. Setup required on Fedora/RHEL8 system (SUT). - -* Setup a FQDN Hostname for example **idm1.example.test**:: - - ``` - $ hostnamectl set-hostname idm1.example.test - ``` - -* Add the ipv4 ipaddress and the hostname to have local resolution in /etc/hosts - - ``` - $ cat /etc/hosts - 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 - ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 - 192.168.122.7 idm1.example.test - ``` - -3. On the Controller Node/Jump Host verify **idm1.example.test** is resolvable by -adding the SUT ipaddress and hostname in **/etc/hosts** - - ``` - $ ping -c 5 idm1.example.test - PING idm1.example.test (192.168.122.7) 56(84) bytes of data. - 64 bytes from idm1.example.test (192.168.122.7): icmp_seq=1 ttl=64 time=0.258 ms - 64 bytes from idm1.example.test (192.168.122.7): icmp_seq=2 ttl=64 time=0.295 ms - 64 bytes from idm1.example.test (192.168.122.7): icmp_seq=3 ttl=64 time=0.230 ms - 64 bytes from idm1.example.test (192.168.122.7): icmp_seq=4 ttl=64 time=0.081 ms - 64 bytes from idm1.example.test (192.168.122.7): icmp_seq=5 ttl=64 time=0.120 ms - ``` - - -4. Pytest Multihost plugin requires a configuration file in yaml format. -This configuration file contains the hosts and the roles the hosts are -playing required for a test suite. - -* Below is the example multihost configuration for a single host. Since -all the tests in multihost/basic directory are single hosts tests that sets -up the ldap(389-ds), kerberos server and also configures client to authenticate against -the ldap and kerberos on the same system. - -In the below example file **mhc.yaml**, multihost plugin connects to host *idm1.example.com* -using ssh and password **redhat*\:: - -``` - root_password: 'redhat' - domains: - - name: example.test - type: sssd - hosts: - - name: idm1.example.test - external_hostname: idm1.example.test - ip: 192.168.122.7 - role: master -``` - -5. Execute pytest:: - - ```$ pytest -s -v --multihost-config=mhc.yaml sssd/src/tests/multihost/basic/``` - -* To execute only specific test case:: - - ```$ pytest -s -v --multihost-config=mhc.yaml sssd/src/tests/multihost/basic/test_kcm.py``` diff --git a/src/tests/multihost/basic/mhc.yaml b/src/tests/multihost/basic/mhc.yaml index de73011bd5..6242f6ab06 100644 --- a/src/tests/multihost/basic/mhc.yaml +++ b/src/tests/multihost/basic/mhc.yaml @@ -1,9 +1,8 @@ -windows_test_dir: '/home/Administrator' -root_password: 'redhat' +root_password: 'vagrant' domains: - - name: testrealm.test - type: sssd - hosts: - - name: hostname1 - external_hostname: hostname1 - role: master +- name: tier0.tests + type: sssd + hosts: + - name: client + external_hostname: master.client.vm + role: master
_______________________________________________ sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/sssd-devel@lists.fedorahosted.org