# HG changeset patch # User Sergey Kandaurov # Date 1526897127 -10800 # Node ID fda0bf1cc6015c5d6bb9798763d7c2b2a14f36c5 # Parent f80176242a7edf19d4c5d31352481733dd9a41b8 Tests: syslog send error handling test added. diff --git a/syslog.t b/syslog.t --- a/syslog.t +++ b/syslog.t @@ -26,7 +26,7 @@ select STDOUT; $| = 1; plan(skip_all => 'win32') if $^O eq 'MSWin32'; -my $t = Test::Nginx->new()->has(qw/http limit_req/)->plan(59); +my $t = Test::Nginx->new()->has(qw/http limit_req/)->plan(61); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -231,6 +231,27 @@ like(get_syslog('/nohostname'), (.*)/x, # MSG 'nohostname'); +# send error handling + +ok(get_syslog('/a'), 'send success'); + +close $s; + +get_syslog('/a'); +get_syslog('/a'); + +$s = IO::Socket::INET->new( + Proto => 'udp', + LocalAddr => '127.0.0.1:' . port(8984) +) + or die "Can't open syslog socket: $!"; + +ok(get_syslog('/a'), 'send error - recover'); + +# broken in fa0e093b64d7 + +$t->todo_alerts() if $t->has_version('1.15.0'); + ############################################################################### sub syslog_lines {