File openstack-tempest.spec of Package openstack-tempest

# spec file for package openstack-tempest
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2013 B1 Systems GmbH, Vohburg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%define component tempest

%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run

%define version_unconverted 19.0.0

Name:           openstack-%{component}
Version:        19.0.0
Release:        0
Summary:        OpenStack Integration Test Suite (Tempest)
License:        Apache-2.0
Group:          System/Management
%if 0%{?suse_version} > 1230
Source10:       %name.conf
BuildRequires:  systemd
Patch0:         install_absolute.patch
# PATCH-FIX-UPSTREAM 0001-Normalize-endpoint-path-in-oauth-client.patch
Patch1:         0001-Normalize-endpoint-path-in-oauth-client.patch
# PATCH-FIX-UPSTREAM 0001-interfaces_by_fixed_ip-no-extra-port.patch
Patch2:         0001-interfaces_by_fixed_ip-no-extra-port.patch
# PATCH-FIX-UPSTREAM concurrency_int_type
Patch3:         concurrency_int_type.patch
# PATCH-FIX-UPSTREAM set_concurrency_default_value
Patch4:         set_concurrency_default_value.patch
# PATCH-FIX-UPSTREAM 0001-Remove-deprecated-services-from-cleanup.patch
Patch5:         0001-Remove-deprecated-services-from-cleanup.patch
# PATCH-FIX-UPSTREAM 0002-Fix-tempest-cleanup.patch
Patch6:         0002-Fix-tempest-cleanup.patch
# PATCH-FIX-UPSTREAM 0003-Add-NetworkSubnetPools-to-tempest-cleanup.patch
Patch7:         0003-Add-NetworkSubnetPools-to-tempest-cleanup.patch
# PATCH-FIX-UPSTREAM 0001-Handle-path-query-parameter-for-test_novnc.patch --
Patch8:         0001-Handle-path-query-parameter-for-test_novnc.patch
BuildRequires:  crudini
BuildRequires:  fdupes
BuildRequires:  openstack-suse-macros
BuildRequires:  python-base
BuildRequires:  python-jsonschema
BuildRequires:  python-oslo.concurrency
BuildRequires:  python-oslo.config
BuildRequires:  python-oslo.i18n
BuildRequires:  python-oslo.log
BuildRequires:  python-oslo.serialization
BuildRequires:  python-oslo.utils
BuildRequires:  python-pbr
BuildRequires:  python-testtools
BuildRequires:  python-urllib3
# Documentatin build requirements:
BuildRequires:  python-Sphinx
BuildRequires:  python-oslosphinx
%if 0%{?suse_version} > 1110
Requires(pre):  pwdutils
Requires(pre):  shadow-utils
Requires:       %name-test = %{version}
Requires:       git-core
Requires:       python >= 2.6.8
Requires:       python-PyYAML >= 3.12
Requires:       python-jsonschema >= 2.6.0
Requires:       python-tempest = %{version}
Requires:       python-testtools >= 2.2.0
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
BuildArch:      noarch

This is a set of integration tests to be run against a live OpenStack cluster.
Tempest has batteries of tests for OpenStack API validation, Scenarios, and
other specific tests useful in validating an OpenStack deployment.

%package test
Summary:        OpenStack Integration Test Suite (Tempest) - Test Package
Group:          Development/Languages/Python
Requires:       %{name} = %{version}

%description test
This is a set of integration tests to be run against a live OpenStack cluster.
Tempest has batteries of tests for OpenStack API validation, Scenarios, and
other specific tests useful in validating an OpenStack deployment.

%package -n python-tempest
Summary:        OpenStack Integration Test Suite (Tempest) - Python module
Group:          Development/Languages/Python
Requires:       python >= 2.6.8
Requires:       python-cliff >= 2.8.0
Requires:       python-fixtures >= 3.0.0
Requires:       python-jsonschema >= 2.6.0
Requires:       python-mock >= 2.0.0
Requires:       python-netaddr >= 0.7.18
%if 0%{?suse_version} <= 1110
# Yes, this is not (yet?) listed upstream as dependency
Requires:       python-unittest2 >= 1.1.0
Requires:       python-PrettyTable >= 0.7.1
Requires:       python-ddt
Requires:       python-debtcollector >= 1.2.0
Requires:       python-oslo.concurrency >= 3.26.0
Requires:       python-oslo.config >= 5.2.0
Requires:       python-oslo.i18n >= 2.1.0
Requires:       python-oslo.log >= 3.36.0
Requires:       python-oslo.serialization >= 2.18.0
Requires:       python-oslo.utils >= 3.33.0
Requires:       python-oslotest >= 3.2.0
Requires:       python-paramiko >= 2.0.0
Requires:       python-pbr >= 2.0.0
Requires:       python-python-subunit >= 1.0.0
Requires:       python-six >= 1.10.0
Requires:       python-stestr >= 1.0.0
Requires:       python-stevedore >= 1.20.0
Requires:       python-testscenarios >= 0.4
Requires:       python-testtools >= 2.2.0
Requires:       python-urllib3 >= 1.21.1

%description -n python-tempest
This package contains the core Python module of OpenStack Tempest.

%setup -q -n %{component}-%{version_unconverted}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1

python build
## python build_sphinx -b man

python install --prefix=%{_prefix} --root=%{buildroot}
install -d -m 755 %{buildroot}%{_localstatedir}/lib/tempest
install -d -m 700 %{buildroot}%{_rundir}/tempest
%if 0%{?suse_version} > 1230
install -D -m 644 %{SOURCE10} %{buildroot}/%_tmpfilesdir/%name.conf

### configuration files
PYTHONPATH=. oslo-config-generator --config-file %{_builddir}/%{component}-%{version_unconverted}/tempest/cmd/config-generator.tempest.conf --output-file %{buildroot}%{_sysconfdir}/tempest/tempest.conf
rm -f %{buildroot}/etc/tempest/config-generator.tempest.conf

install -d -m 755 %{buildroot}%{_sysconfdir}/tempest
for fn in logging.conf accounts.yaml ; do
    mv %{buildroot}%{_sysconfdir}/tempest/$fn{.sample,}
## install -d %{buildroot}%{_mandir}/man1
## install -m 644 doc/build/man/*.1 %{buildroot}%{_mandir}/man1
%fdupes %{buildroot}%{python_sitelib}/%{component}

# configuration fixes
crudini --set %{buildroot}/etc/tempest/tempest.conf oslo_concurrency lock_path /var/run/tempest
crudini --set %{buildroot}/etc/tempest/tempest.conf boto s3_materials_path ""
crudini --set %{buildroot}/etc/tempest/tempest.conf boto s3_url http://localhost:3333
crudini --set %{buildroot}/etc/tempest/tempest.conf service_available neutron true
crudini --set %{buildroot}/etc/tempest/tempest.conf service_available swift false
crudini --set %{buildroot}/etc/tempest/tempest.conf service_available heat false
crudini --set %{buildroot}/etc/tempest/tempest.conf auth admin_username admin
crudini --set %{buildroot}/etc/tempest/tempest.conf auth admin_tenant_name service
crudini --set %{buildroot}/etc/tempest/tempest.conf identity alt_username alt_demo
crudini --set %{buildroot}/etc/tempest/tempest.conf identity alt_tenant_name alt_demo

### test subpackage
cp -av .stestr.conf %{buildroot}/%{_localstatedir}/lib/%{name}-test/

%tmpfiles_create %{_tmpfilesdir}/%{name}.conf

%license LICENSE
%dir %{_sysconfdir}/tempest
%if 0%{?suse_version} > 1230
%ghost %dir %attr(700,root,root) %{_rundir}/tempest
%config(noreplace) %{_sysconfdir}/tempest/logging.conf
%config(noreplace) %{_sysconfdir}/tempest/tempest.conf
%config(noreplace) %{_sysconfdir}/tempest/accounts.yaml
%config(noreplace) %{_sysconfdir}/tempest/whitelist.yaml

%files test
%doc README.rst
%license LICENSE
## %{_mandir}/man1/tempest.1%{?ext_man}

%files -n python-tempest
%license LICENSE

openSUSE Build Service is sponsored by