# HG changeset patch # User Maxim Dounin # Date 1255388719 -14400 # Node ID bb5b5e69b45efd10b3209fe2a52118277247e79a # Parent 8bc9de6559a1e174cf0212adbd7de2103cee593c Tests: empty cached subrequests shouldn't cause alerts. This problem was once fixed in 0.8.16. Make sure it won't be reintroduced. diff --git a/ssi.t b/ssi.t --- a/ssi.t +++ b/ssi.t @@ -21,7 +21,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->plan(13); +my $t = Test::Nginx->new()->plan(16); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -39,6 +39,9 @@ http { fastcgi_temp_path %%TESTDIR%%/fastcgi_temp; proxy_temp_path %%TESTDIR%%/proxy_temp; + proxy_cache_path %%TESTDIR%%/cache levels=1:2 + keys_zone=NAME:10m; + server { listen 127.0.0.1:8080; server_name localhost; @@ -49,6 +52,11 @@ http { ssi on; proxy_pass http://127.0.0.1:8080/local/; } + location /cache/ { + proxy_pass http://127.0.0.1:8080/local/; + proxy_cache NAME; + proxy_cache_valid 200 1h; + } location /local/ { ssi off; alias %%TESTDIR%%/; @@ -66,6 +74,8 @@ EOF $t->write_file('test-empty1.html', 'XX'); $t->write_file('test-empty2.html', 'XX'); +$t->write_file('test-empty3.html', + 'XX'); $t->write_file('empty.html', ''); $t->run(); @@ -94,5 +104,9 @@ unlike(http_get('/proxy/test1.html'), qr like(http_get('/test-empty1.html'), qr/HTTP/, 'empty with ssi'); like(http_get('/test-empty2.html'), qr/HTTP/, 'empty without ssi'); +like(http_get('/test-empty3.html'), qr/HTTP/, 'empty with proxy'); +like(http_get('/test-empty3.html'), qr/HTTP/, 'empty with proxy cached'); + +like(`grep -F '[alert]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no alerts'); ###############################################################################