From 7b2332c9300d35690fb17f671c8c80ecebef1055 Mon Sep 17 00:00:00 2001 From: lin-hua-cheng Date: Mon, 13 Apr 2015 11:54:31 -0700 Subject: [PATCH] Package tests for horizon We put component unit tests to subpackage to make it possible to install and run them on another system. Change-Id: I43106a4de20fbdd9834f5fc028ba5c18e76a9367 Implements: blueprint package-unit-tests --- .../specs/python-django-horizon.spec | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/conf/templates/packaging/specs/python-django-horizon.spec b/conf/templates/packaging/specs/python-django-horizon.spec index 8436c8b8..21ecdde4 100644 --- a/conf/templates/packaging/specs/python-django-horizon.spec +++ b/conf/templates/packaging/specs/python-django-horizon.spec @@ -5,7 +5,10 @@ # * Alan Pevec # * Cole Robinson +%global python_name horizon %global os_version $version +%global no_tests $no_tests +%global tests_data_dir %{_datarootdir}/%{python_name}-tests %global with_compression 1 @@ -116,6 +119,30 @@ provides a reference implementation using the Django Horizon project, mostly consisting of JavaScript and CSS to tie it altogether as a standalone site. +%if ! 0%{?no_tests} +%package -n python-%{python_name}-tests +Summary: Tests for Horizon +Group: Development/Libraries + +Requires: %{name} = %{epoch}:%{version}-%{release} +Requires: openstack-dashboard = %{epoch}:%{version}-%{release} + +# Test requirements: +#for $i in $test_requires +Requires: ${i} +#end for + +%description -n python-%{python_name}-tests +Horizon is a Django application for providing Openstack UI components. +It allows performing site administrator (viewing account resource usage, +configuring users, accounts, quotas, flavors, etc.) and end user +operations (start/stop/delete instances, create/restore snapshots, view +instance VNC console, etc.) + +This package contains unit and functional tests for Horizon, with +simple runner (%{python_name}-make-test-env). +%endif + %if 0%{?with_doc} %package doc Summary: Documentation for Django Horizon @@ -273,7 +300,7 @@ install -d -m 755 %{buildroot}%{_sysconfdir}/openstack-dashboard # Copy everything to /usr/share mv %{buildroot}%{python_sitelib}/openstack_dashboard \ %{buildroot}%{_datadir}/openstack-dashboard -mv manage.py %{buildroot}%{_datadir}/openstack-dashboard +cp manage.py %{buildroot}%{_datadir}/openstack-dashboard rm -rf %{buildroot}%{python_sitelib}/openstack_dashboard # remove unnecessary .po files @@ -294,6 +321,11 @@ cp -a openstack_dashboard/static/* %{buildroot}%{_datadir}/openstack-dashboard/s cp -a horizon/static/* %{buildroot}%{_datadir}/openstack-dashboard/static cp -a static/* %{buildroot}%{_datadir}/openstack-dashboard/static +%if ! 0%{?no_tests} +install -d -m 755 %{buildroot}%{_bindir} +#include $part_fn("install_tests.sh") +%endif + %clean rm -rf %{buildroot} @@ -356,6 +388,12 @@ rm -rf %{buildroot} %config(noreplace) %attr(0640, root, apache) %{_sysconfdir}/openstack-dashboard/local_settings %endif +%if ! 0%{?no_tests} +%files -n python-%{python_name}-tests +%{tests_data_dir} +%{_bindir}/%{python_name}-make-test-env +%endif + %if 0%{?with_doc} %files doc %doc html