Mercurial > hg > nginx-tests
comparison ssi.t @ 105:bb5b5e69b45e
Tests: empty cached subrequests shouldn't cause alerts.
This problem was once fixed in 0.8.16. Make sure it won't be reintroduced.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 13 Oct 2009 03:05:19 +0400 |
parents | 9f723d3ba52d |
children | 7a712d3909ba |
comparison
equal
deleted
inserted
replaced
104:8bc9de6559a1 | 105:bb5b5e69b45e |
---|---|
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()->plan(13); | 24 my $t = Test::Nginx->new()->plan(16); |
25 | 25 |
26 $t->write_file_expand('nginx.conf', <<'EOF'); | 26 $t->write_file_expand('nginx.conf', <<'EOF'); |
27 | 27 |
28 master_process off; | 28 master_process off; |
29 daemon off; | 29 daemon off; |
37 | 37 |
38 client_body_temp_path %%TESTDIR%%/client_body_temp; | 38 client_body_temp_path %%TESTDIR%%/client_body_temp; |
39 fastcgi_temp_path %%TESTDIR%%/fastcgi_temp; | 39 fastcgi_temp_path %%TESTDIR%%/fastcgi_temp; |
40 proxy_temp_path %%TESTDIR%%/proxy_temp; | 40 proxy_temp_path %%TESTDIR%%/proxy_temp; |
41 | 41 |
42 proxy_cache_path %%TESTDIR%%/cache levels=1:2 | |
43 keys_zone=NAME:10m; | |
44 | |
42 server { | 45 server { |
43 listen 127.0.0.1:8080; | 46 listen 127.0.0.1:8080; |
44 server_name localhost; | 47 server_name localhost; |
45 location / { | 48 location / { |
46 ssi on; | 49 ssi on; |
47 } | 50 } |
48 location /proxy/ { | 51 location /proxy/ { |
49 ssi on; | 52 ssi on; |
50 proxy_pass http://127.0.0.1:8080/local/; | 53 proxy_pass http://127.0.0.1:8080/local/; |
54 } | |
55 location /cache/ { | |
56 proxy_pass http://127.0.0.1:8080/local/; | |
57 proxy_cache NAME; | |
58 proxy_cache_valid 200 1h; | |
51 } | 59 } |
52 location /local/ { | 60 location /local/ { |
53 ssi off; | 61 ssi off; |
54 alias %%TESTDIR%%/; | 62 alias %%TESTDIR%%/; |
55 } | 63 } |
64 $t->write_file('test3.html', | 72 $t->write_file('test3.html', |
65 'X<!--#set var="blah" value="test" --><!--#echo var="blah" -->X'); | 73 'X<!--#set var="blah" value="test" --><!--#echo var="blah" -->X'); |
66 $t->write_file('test-empty1.html', 'X<!--#include virtual="/empty.html" -->X'); | 74 $t->write_file('test-empty1.html', 'X<!--#include virtual="/empty.html" -->X'); |
67 $t->write_file('test-empty2.html', | 75 $t->write_file('test-empty2.html', |
68 'X<!--#include virtual="/local/empty.html" -->X'); | 76 'X<!--#include virtual="/local/empty.html" -->X'); |
77 $t->write_file('test-empty3.html', | |
78 'X<!--#include virtual="/cache/empty.html" -->X'); | |
69 $t->write_file('empty.html', ''); | 79 $t->write_file('empty.html', ''); |
70 | 80 |
71 $t->run(); | 81 $t->run(); |
72 | 82 |
73 ############################################################################### | 83 ############################################################################### |
92 unlike(http_get('/proxy/test1.html'), qr/Last-Modified|Accept-Ranges/im, | 102 unlike(http_get('/proxy/test1.html'), qr/Last-Modified|Accept-Ranges/im, |
93 'cleared headers from proxy'); | 103 'cleared headers from proxy'); |
94 | 104 |
95 like(http_get('/test-empty1.html'), qr/HTTP/, 'empty with ssi'); | 105 like(http_get('/test-empty1.html'), qr/HTTP/, 'empty with ssi'); |
96 like(http_get('/test-empty2.html'), qr/HTTP/, 'empty without ssi'); | 106 like(http_get('/test-empty2.html'), qr/HTTP/, 'empty without ssi'); |
107 like(http_get('/test-empty3.html'), qr/HTTP/, 'empty with proxy'); | |
108 like(http_get('/test-empty3.html'), qr/HTTP/, 'empty with proxy cached'); | |
109 | |
110 like(`grep -F '[alert]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no alerts'); | |
97 | 111 |
98 ############################################################################### | 112 ############################################################################### |