about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-01-22 01:52:25 +0000
committerEric Wong <e@80x24.org>2017-01-22 01:54:40 +0000
commit7ed712c9bb535d621fbf4290bbf770a5d3f49d3e (patch)
tree2b8a7f6d7fd3f9872d3226d5b85b4f95ef10eb3c /t
parent5505b483b66dfa43d6e356502fca3eb58638447c (diff)
downloadpublic-inbox-7ed712c9bb535d621fbf4290bbf770a5d3f49d3e.tar.gz
I've hit random test failures on this, so attempt to improve
diagnostics and improve documentation for this test.
Diffstat (limited to 't')
-rw-r--r--t/httpd-unix.t7
1 files changed, 5 insertions, 2 deletions
diff --git a/t/httpd-unix.t b/t/httpd-unix.t
index 4b0f116e..5ebe2f50 100644
--- a/t/httpd-unix.t
+++ b/t/httpd-unix.t
@@ -4,6 +4,7 @@
 use strict;
 use warnings;
 use Test::More;
+use Carp qw(carp);
 
 foreach my $mod (qw(Plack::Util Plack::Builder Danga::Socket
                         HTTP::Date HTTP::Status)) {
@@ -54,7 +55,7 @@ ok(-S $unix, 'UNIX socket was bound by -httpd');
 sub check_sock ($) {
         my ($unix) = @_;
         my $sock = IO::Socket::UNIX->new(Peer => $unix, Type => SOCK_STREAM);
-        warn "E: $! connecting to $unix\n" unless defined $sock;
+        carp "E: $! connecting to $unix\n" unless defined $sock;
         ok($sock, 'client UNIX socket connected');
         ok($sock->write("GET /host-port HTTP/1.0\r\n\r\n"),
                 'wrote req to server');
@@ -95,11 +96,13 @@ SKIP: {
         eval 'require Net::Server::Daemonize';
         skip('Net::Server missing for pid-file/daemonization test', 10) if $@;
 
-        # wait for daemonization
+        # wait for daemonization, PublicInbox::Daemon should bind
+        # listener BEFORE the grandparent exits.
         $spawn_httpd->("-l$unix", '-D', '-P', "$tmpdir/pid");
         my $kpid = $pid;
         $pid = undef;
         is(waitpid($kpid, 0), $kpid, 'existing httpd terminated');
+        ok(-S $unix, 'unix socket exists');
         check_sock($unix);
 
         ok(-f "$tmpdir/pid", 'pid file written');