Mercurial > hg > nginx-tests
comparison access_log.t @ 463:da1a459c9318
Tests: access_log "if=" tests with buffering.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 18 Sep 2014 12:38:31 +0400 |
parents | ae69f9bdba92 |
children | 43e05ac6c23c |
comparison
equal
deleted
inserted
replaced
462:cb0662e12d6e | 463:da1a459c9318 |
---|---|
54 access_log %%TESTDIR%%/filtered.log test | 54 access_log %%TESTDIR%%/filtered.log test |
55 if=$arg_logme; | 55 if=$arg_logme; |
56 return 200 OK; | 56 return 200 OK; |
57 } | 57 } |
58 | 58 |
59 location /complex { | 59 location /filtered/complex { |
60 access_log %%TESTDIR%%/complex.log test | 60 access_log %%TESTDIR%%/complex.log test |
61 if=$arg_logme$arg_logmetoo; | 61 if=$arg_logme$arg_logmetoo; |
62 return 200 OK; | |
63 } | |
64 | |
65 location /filtered/noreuse { | |
66 access_log %%TESTDIR%%/noreuse.log test buffer=16k | |
67 if=$arg_a; | |
68 access_log %%TESTDIR%%/noreuse.log test buffer=16k | |
69 if=$arg_b; | |
62 return 200 OK; | 70 return 200 OK; |
63 } | 71 } |
64 | 72 |
65 location /compressed { | 73 location /compressed { |
66 access_log %%TESTDIR%%/compressed.log test | 74 access_log %%TESTDIR%%/compressed.log test |
81 } | 89 } |
82 } | 90 } |
83 | 91 |
84 EOF | 92 EOF |
85 | 93 |
86 $t->try_run('no access_log if')->plan(8); | 94 $t->try_run('no access_log if')->plan(9); |
87 | 95 |
88 ############################################################################### | 96 ############################################################################### |
89 | 97 |
90 http_get('/combined'); | 98 http_get('/combined'); |
91 http_get('/combined/off'); | 99 http_get('/combined/off'); |
94 http_get('/filtered/empty?logme='); | 102 http_get('/filtered/empty?logme='); |
95 http_get('/filtered/zero?logme=0'); | 103 http_get('/filtered/zero?logme=0'); |
96 http_get('/filtered/good?logme=1'); | 104 http_get('/filtered/good?logme=1'); |
97 http_get('/filtered/work?logme=yes'); | 105 http_get('/filtered/work?logme=yes'); |
98 | 106 |
99 http_get('/complex'); | 107 http_get('/filtered/complex'); |
100 http_get('/complex/one?logme=1'); | 108 http_get('/filtered/complex/one?logme=1'); |
101 http_get('/complex/two?logmetoo=1'); | 109 http_get('/filtered/complex/two?logmetoo=1'); |
102 http_get('/complex/either1?logme=A&logmetoo=B'); | 110 http_get('/filtered/complex/either1?logme=A&logmetoo=B'); |
103 http_get('/complex/either2?logme=A'); | 111 http_get('/filtered/complex/either2?logme=A'); |
104 http_get('/complex/either3?logmetoo=B'); | 112 http_get('/filtered/complex/either3?logmetoo=B'); |
105 http_get('/complex/either4?logme=0&logmetoo=0'); | 113 http_get('/filtered/complex/either4?logme=0&logmetoo=0'); |
106 http_get('/complex/neither?logme=&logmetoo='); | 114 http_get('/filtered/complex/neither?logme=&logmetoo='); |
115 | |
116 http_get('/filtered/noreuse1/zero?a=0'); | |
117 http_get('/filtered/noreuse1/good?a=1'); | |
118 http_get('/filtered/noreuse2/zero?b=0'); | |
119 http_get('/filtered/noreuse2/good?b=1'); | |
107 | 120 |
108 http_get('/compressed'); | 121 http_get('/compressed'); |
109 | 122 |
110 http_get('/multi'); | 123 http_get('/multi'); |
111 | 124 |
155 | 168 |
156 | 169 |
157 # verify "if=" argument works with complex value | 170 # verify "if=" argument works with complex value |
158 | 171 |
159 my $exp_complex = <<'EOF'; | 172 my $exp_complex = <<'EOF'; |
160 /complex/one:200 | 173 /filtered/complex/one:200 |
161 /complex/two:200 | 174 /filtered/complex/two:200 |
162 /complex/either1:200 | 175 /filtered/complex/either1:200 |
163 /complex/either2:200 | 176 /filtered/complex/either2:200 |
164 /complex/either3:200 | 177 /filtered/complex/either3:200 |
165 /complex/either4:200 | 178 /filtered/complex/either4:200 |
166 EOF | 179 EOF |
167 | 180 |
168 $log = read_file($t, 'complex.log'); | 181 $log = read_file($t, 'complex.log'); |
169 is($log, $exp_complex, 'if with complex value'); | 182 is($log, $exp_complex, 'if with complex value'); |
183 | |
184 | |
185 # buffer created with false "if" is not reused among multiple access_log | |
186 | |
187 TODO: { | |
188 local $TODO = 'not yet' unless $t->has_version('1.7.5'); | |
189 | |
190 $log = read_file($t, '/noreuse.log'); | |
191 is($log, "/filtered/noreuse1/good:200\n/filtered/noreuse2/good:200\n", | |
192 'log filtering with buffering'); | |
193 | |
194 } | |
170 | 195 |
171 | 196 |
172 # multiple logs in a same location | 197 # multiple logs in a same location |
173 | 198 |
174 $log = read_file($t, 'multi1.log'); | 199 $log = read_file($t, 'multi1.log'); |