Commit 75af3060 authored by Christoph Berg's avatar Christoph Berg

t/TestLib.pm: Restrict check_clean to LISTENing sockets.

parent 76cbe9e7
......@@ -5,6 +5,7 @@ postgresql-common (202) UNRELEASED; urgency=medium
* pg_virtualenv: Disable fakeroot while creating clusters so we don't end up
running as root.
* t/135_pg_virtualenv.t: New test file.
* t/TestLib.pm: Restrict check_clean to LISTENing sockets.
* gitlab/gitlab-ci.yml: Run blhc; fail on lintian errors.
-- Christoph Berg <myon@debian.org> Fri, 07 Jun 2019 14:46:05 +0200
......
......@@ -298,8 +298,6 @@ is ((system "pg_dropcluster $MAJORS[-1] new1 --stop"), 0, "dropping $new1");
is ((system "pg_dropcluster $MAJORS[-1] new2 --stop"), 0, "dropping $new2");
is ((system "pg_dropcluster $MAJORS[0] old --stop"), 0, "dropping $old");
# unlike the others, this tests leaves TIME_WAIT on localhost behind (seen on CentOS; seen for PG <= 9.1)
wait_ports_close;
check_clean;
# vim: filetype=perl
......@@ -27,7 +27,6 @@ SKIP: {
like_program_out 'nobody', "fakeroot $virtualenv", 0, qr!id.root\ncurrent_user.nobody!, "running fakeroot pg_virtualenv as nobody";
}
wait_ports_close;
check_clean;
# vim: filetype=perl
......@@ -23,7 +23,7 @@ our $VERSION = 1.00;
our @ISA = ('Exporter');
our @EXPORT = qw/ps ok_dir exec_as deb_installed rpm_installed package_version
version_ge program_ok is_program_out like_program_out unlike_program_out
pidof pid_env wait_ports_close check_clean
pidof pid_env check_clean
@ALL_MAJORS @MAJORS $delay/;
our @ALL_MAJORS = get_versions(); # not affected by PG_VERSIONS/-v
......@@ -221,15 +221,6 @@ sub unlike_program_out {
unlike ($$outref, $_[3], (defined $_[4] ? $_[4] : "correct output of $_[1]")) or fail_debug;
}
# Wait for TCP ports to close. Necessary for some test files before calling check_clean
sub wait_ports_close {
note 'waiting for TCP ports to close';
for (1 .. 60) {
last if system 'netstat -avptn 2>/dev/null | grep -q ":543[2-9]\b"';
sleep 1;
}
}
# Check that all PostgreSQL related directories are empty and no
# postgres processes are running. Should be called at the end
# of all tests. Does 10 tests.
......@@ -250,7 +241,7 @@ sub check_clean {
# complain about missing directories
ok_dir '/var/log/postgresql', [], "No files in /var/log/postgresql left behind";
is_program_out 0, 'netstat -avptn 2>/dev/null | grep ":543[2-9]\\b"', 1, '',
is_program_out 0, 'netstat -avptn 2>/dev/null | grep ":543[2-9]\\b.*LISTEN"', 1, '',
'PostgreSQL TCP ports are closed';
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment