comparison syslog.t @ 1580:9e142c0e34b2

Tests: allowed syslog messages arrival out-of-order. Reported by Dionna Amalie Glaze, see http://mailman.nginx.org/pipermail/nginx-devel/2020-June/013294.html
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 06 Jul 2020 18:01:10 +0300
parents 0f2dd1f239ba
children b61e820caa83
comparison
equal deleted inserted replaced
1579:14eeaa39599d 1580:9e142c0e34b2
24 select STDERR; $| = 1; 24 select STDERR; $| = 1;
25 select STDOUT; $| = 1; 25 select STDOUT; $| = 1;
26 26
27 plan(skip_all => 'win32') if $^O eq 'MSWin32'; 27 plan(skip_all => 'win32') if $^O eq 'MSWin32';
28 28
29 my $t = Test::Nginx->new()->has(qw/http limit_req/)->plan(61); 29 my $t = Test::Nginx->new()->has(qw/http limit_req/)->plan(62);
30 30
31 $t->write_file_expand('nginx.conf', <<'EOF'); 31 $t->write_file_expand('nginx.conf', <<'EOF');
32 32
33 %%TEST_GLOBALS%% 33 %%TEST_GLOBALS%%
34 34
218 http_get('/if/good?logme=1'); 218 http_get('/if/good?logme=1');
219 http_get('/if/work?logme=yes'); 219 http_get('/if/work?logme=yes');
220 220
221 get_syslog('/a'); 221 get_syslog('/a');
222 222
223 like($t->read_file('s_if.log'), qr/good:404.*work:404/s, 'syslog if success'); 223 like($t->read_file('s_if.log'), qr/good:404/s, 'syslog if success');
224 like($t->read_file('s_if.log'), qr/work:404/s, 'syslog if success 2');
224 unlike($t->read_file('s_if.log'), qr/(if:|empty:|zero:)404/, 'syslog if fail'); 225 unlike($t->read_file('s_if.log'), qr/(if:|empty:|zero:)404/, 'syslog if fail');
225 226
226 like(get_syslog('/nohostname'), 227 like(get_syslog('/nohostname'),
227 qr/^<(\d{1,3})> # PRI 228 qr/^<(\d{1,3})> # PRI
228 ([A-Z][a-z]{2})\s # mon 229 ([A-Z][a-z]{2})\s # mon