Disable tests by default in RHEL builds

The test dependencies are unwanted in RHEL, and therefore the tests are
skipped entirely there.  At a minimum, we can at least do an import check.
This commit is contained in:
Yaakov Selkowitz 2023-05-10 16:53:43 -04:00
parent 0048d9ca86
commit a96d2826de

View File

@ -1,6 +1,12 @@
%if 0%{?rhel}
%bcond_with tests
%else
%bcond_without tests
%endif
Name: cloud-init Name: cloud-init
Version: 23.1.2 Version: 23.1.2
Release: 4%{?dist} Release: 5%{?dist}
Summary: Cloud instance init scripts Summary: Cloud instance init scripts
License: Apache-2.0 or GPL-3.0-only License: Apache-2.0 or GPL-3.0-only
URL: https://github.com/canonical/cloud-init URL: https://github.com/canonical/cloud-init
@ -28,30 +34,32 @@ BuildRequires: python3-setuptools
BuildRequires: systemd BuildRequires: systemd
# For tests # For tests
BuildRequires: python3-pytest
BuildRequires: python3-pytest-mock
BuildRequires: iproute
BuildRequires: passwd
BuildRequires: python3-configobj BuildRequires: python3-configobj
# https://bugzilla.redhat.com/show_bug.cgi?id=1695953 # https://bugzilla.redhat.com/show_bug.cgi?id=1695953
BuildRequires: python3-distro BuildRequires: python3-distro
# https://bugzilla.redhat.com/show_bug.cgi?id=1417029 # https://bugzilla.redhat.com/show_bug.cgi?id=1417029
BuildRequires: python3-httpretty >= 0.8.14-2
BuildRequires: python3-jinja2 BuildRequires: python3-jinja2
BuildRequires: python3-jsonpatch BuildRequires: python3-jsonpatch
BuildRequires: python3-jsonschema BuildRequires: python3-jsonschema
BuildRequires: python3-tox
BuildRequires: python3-oauthlib BuildRequires: python3-oauthlib
BuildRequires: python3-prettytable BuildRequires: python3-prettytable
BuildRequires: python3-pyserial BuildRequires: python3-pyserial
BuildRequires: python3-PyYAML BuildRequires: python3-PyYAML
BuildRequires: python3-requests BuildRequires: python3-requests
BuildRequires: python3-responses
BuildRequires: python3-six BuildRequires: python3-six
BuildRequires: python3-netifaces BuildRequires: python3-netifaces
%if %{with tests}
BuildRequires: iproute
BuildRequires: passwd
BuildRequires: python3-httpretty >= 0.8.14-2
BuildRequires: python3-pytest
BuildRequires: python3-pytest-mock
BuildRequires: python3-responses
BuildRequires: python3-tox
# dnf is needed to make cc_ntp unit tests work # dnf is needed to make cc_ntp unit tests work
# https://bugs.launchpad.net/cloud-init/+bug/1721573 # https://bugs.launchpad.net/cloud-init/+bug/1721573
BuildRequires: /usr/bin/dnf BuildRequires: /usr/bin/dnf
%endif
Requires: dhcp-client Requires: dhcp-client
Requires: hostname Requires: hostname
@ -136,7 +144,11 @@ cp -a %{buildroot}/etc/systemd %{buildroot}/usr/lib
rm -rf %{buildroot}/etc/systemd rm -rf %{buildroot}/etc/systemd
%check %check
%if %{with tests}
python3 -m pytest tests/unittests python3 -m pytest tests/unittests
%else
%py3_check_import cloudinit
%endif
%post %post
%systemd_post cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service %systemd_post cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service
@ -188,6 +200,9 @@ python3 -m pytest tests/unittests
%changelog %changelog
* Tue May 16 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 23.1.2-5
- Disable tests by default in RHEL builds
* Thu May 11 2023 Major Hayden <major@redhat.com> - 23.1.2-4 * Thu May 11 2023 Major Hayden <major@redhat.com> - 23.1.2-4
- Add patch to allow > 3 nameservers to be applied - Add patch to allow > 3 nameservers to be applied