changeset 1326:fda0bf1cc601

Tests: syslog send error handling test added.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 21 May 2018 13:05:27 +0300
parents f80176242a7e
children ecbd984ffe04
files syslog.t
diffstat 1 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 {