Mercurial > hg > nginx-tests
comparison access_log.t @ 1188:074e05b33b1a
Tests: added access_log test with long line in log_format.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 15 Jun 2017 16:01:08 +0300 |
parents | 717030fd5a94 |
children | 1c703303feee |
comparison
equal
deleted
inserted
replaced
1187:0a7d942d549b | 1188:074e05b33b1a |
---|---|
19 ############################################################################### | 19 ############################################################################### |
20 | 20 |
21 select STDERR; $| = 1; | 21 select STDERR; $| = 1; |
22 select STDOUT; $| = 1; | 22 select STDOUT; $| = 1; |
23 | 23 |
24 my $t = Test::Nginx->new()->has(qw/http rewrite gzip/)->plan(10) | 24 my $t = Test::Nginx->new()->has(qw/http rewrite gzip/)->plan(11) |
25 ->write_file_expand('nginx.conf', <<'EOF'); | 25 ->write_file_expand('nginx.conf', <<'EOF'); |
26 | 26 |
27 %%TEST_GLOBALS%% | 27 %%TEST_GLOBALS%% |
28 | 28 |
29 daemon off; | 29 daemon off; |
33 | 33 |
34 http { | 34 http { |
35 %%TEST_GLOBALS_HTTP%% | 35 %%TEST_GLOBALS_HTTP%% |
36 | 36 |
37 log_format test "$uri:$status"; | 37 log_format test "$uri:$status"; |
38 log_format long "long line $uri:$status"; | |
38 log_format binary $binary_remote_addr; | 39 log_format binary $binary_remote_addr; |
39 | 40 |
40 server { | 41 server { |
41 listen 127.0.0.1:8080; | 42 listen 127.0.0.1:8080; |
42 server_name localhost; | 43 server_name localhost; |
78 } | 79 } |
79 | 80 |
80 location /multi { | 81 location /multi { |
81 access_log %%TESTDIR%%/multi1.log test; | 82 access_log %%TESTDIR%%/multi1.log test; |
82 access_log %%TESTDIR%%/multi2.log test; | 83 access_log %%TESTDIR%%/multi2.log test; |
84 access_log %%TESTDIR%%/long.log long; | |
83 return 200 OK; | 85 return 200 OK; |
84 } | 86 } |
85 | 87 |
86 location /varlog { | 88 location /varlog { |
87 access_log %%TESTDIR%%/varlog_${arg_logname} test; | 89 access_log %%TESTDIR%%/varlog_${arg_logname} test; |
198 | 200 |
199 # same content in the second log | 201 # same content in the second log |
200 | 202 |
201 is($t->read_file('multi2.log'), "/multi:200\n", 'multiple logs 2'); | 203 is($t->read_file('multi2.log'), "/multi:200\n", 'multiple logs 2'); |
202 | 204 |
205 is($t->read_file('long.log'), "long line /multi:200\n", 'long line format'); | |
206 | |
203 # test log destinations with variables | 207 # test log destinations with variables |
204 | 208 |
205 is($t->read_file('varlog_0'), "/varlog:200\n", 'varlog literal zero name'); | 209 is($t->read_file('varlog_0'), "/varlog:200\n", 'varlog literal zero name'); |
206 is($t->read_file('varlog_filename'), "/varlog:200\n", 'varlog good name'); | 210 is($t->read_file('varlog_filename'), "/varlog:200\n", 'varlog good name'); |
207 | 211 |