Fixes of tests

- Remove net-tools (netstat) dependency and replace it with iproute (ss)
- Disable running tests during build by default (conditional run_build_tests)

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
This commit is contained in:
Jan Friesse 2020-09-29 15:29:49 +02:00
parent 5149534389
commit 5b57687bf6
2 changed files with 56 additions and 5 deletions

View File

@ -0,0 +1,41 @@
From eda7abe337e5e37ef8d1d8ff7abdce334fa9bd21 Mon Sep 17 00:00:00 2001
From: Jan Friesse <jfriesse@redhat.com>
Date: Tue, 29 Sep 2020 14:22:30 +0200
Subject: [PATCH] test: Add compatibility with iproute ss command
ensure_boothd_not_running is now exectured only when single instance is
used, but if so, it requires netstat command. Netstat is deprecated for
some time and it is slowly disappearing from distributions, so add
support for iproute ss command.
Parameters for both ss and netstat are same, but sadly output differs so
both netstat and ss output is matched.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
---
test/boothtestenv.py.in | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/test/boothtestenv.py.in b/test/boothtestenv.py.in
index 26a40cb..8a23615 100644
--- a/test/boothtestenv.py.in
+++ b/test/boothtestenv.py.in
@@ -31,11 +31,13 @@ class BoothTestEnvironment(unittest.TestCase, BoothAssertions):
def ensure_boothd_not_running(self):
# Need to redirect STDERR in case we're not root, in which
- # case netstat's -p option causes a warning. However we only
+ # case netstat's -p option causes a warning (ss doesn't). However we only
# want to kill boothd processes which we own; -p will list the
# pid for those and only those, which is exactly what we want
# here.
- subprocess.call("netstat -tpln 2>&1 | perl -lne 'm,LISTEN\s+(\d+)/boothd, and kill 15, $1'", shell=True)
+ subprocess.call("(netstat -tlnp || ss -tlnp) 2>&1 | " +
+ "perl -lne '(m,LISTEN\s+(\d+)/boothd, || /\"boothd\".*pid=(\d+)/) and kill 15, $1'",
+ shell=True)
def get_tempfile(self, identity):
tf = tempfile.NamedTemporaryFile(
--
2.18.2

View File

@ -21,6 +21,7 @@
%bcond_with html_man %bcond_with html_man
%bcond_with glue %bcond_with glue
%bcond_with run_build_tests
## User and group to use for nonprivileged services (should be in sync with pacemaker) ## User and group to use for nonprivileged services (should be in sync with pacemaker)
%global uname hacluster %global uname hacluster
@ -61,12 +62,13 @@
Name: booth Name: booth
Version: %{boothver} Version: %{boothver}
Release: %{boothrel}%{?dist}.4 Release: %{boothrel}%{?dist}.5
Summary: Ticket Manager for Multi-site Clusters Summary: Ticket Manager for Multi-site Clusters
License: GPLv2+ License: GPLv2+
Url: https://github.com/%{github_owner}/%{name} Url: https://github.com/%{github_owner}/%{name}
Source0: https://github.com/%{github_owner}/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz Source0: https://github.com/%{github_owner}/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
Patch0: 0001-build-Do-not-link-with-pcmk-libraries.patch Patch0: 0001-build-Do-not-link-with-pcmk-libraries.patch
Patch1: 0002-test-Add-compatibility-with-iproute-ss-command.patch
# direct build process dependencies # direct build process dependencies
BuildRequires: autoconf BuildRequires: autoconf
@ -102,8 +104,10 @@ BuildRequires: sed
BuildRequires: systemd BuildRequires: systemd
## for autosetup ## for autosetup
BuildRequires: git BuildRequires: git
# check scriptlet (for perl and netstat) %if 0%{?with_run_build_tests}
BuildRequires: perl-interpreter net-tools # check scriptlet (for perl and ss)
BuildRequires: perl-interpreter iproute
%endif
# this is for a composite-requiring-its-components arranged # this is for a composite-requiring-its-components arranged
# as an empty package (empty files section) requiring subpackages # as an empty package (empty files section) requiring subpackages
@ -182,8 +186,8 @@ Requires: %{name}-site = %{version}-%{release}
Requires: gdb Requires: gdb
Requires: %{__python3} Requires: %{__python3}
Requires: python3-pexpect Requires: python3-pexpect
# runtests.py suite (for perl and netstat) # runtests.py suite (for perl and ss)
Requires: perl-interpreter net-tools Requires: perl-interpreter iproute
%description test %description test
Automated tests for running Booth, ticket manager for multi-site clusters. Automated tests for running Booth, ticket manager for multi-site clusters.
@ -246,7 +250,9 @@ sed -e 's#PYTHON_SHEBANG#%{__python3} -Es#g' \
%check %check
# alternatively: test/runtests.py # alternatively: test/runtests.py
%if 0%{?with_run_build_tests}
VERBOSE=1 make check VERBOSE=1 make check
%endif
%files core %files core
%license COPYING %license COPYING
@ -292,6 +298,10 @@ VERBOSE=1 make check
%{_usr}/lib/ocf/resource.d/booth/sharedrsc %{_usr}/lib/ocf/resource.d/booth/sharedrsc
%changelog %changelog
* Tue Sep 29 2020 Jan Friesse <jfriesse@redhat.com> - 1.0-6.ac1d34c.git.5
- Remove net-tools (netstat) dependency and replace it with iproute (ss)
- Disable running tests during build by default (conditional run_build_tests)
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-6.ac1d34c.git.4 * Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-6.ac1d34c.git.4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild