changeset 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 8bc9de6559a1
children 7a712d3909ba
files ssi.t
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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', 'X<!--#include virtual="/empty.html" -->X');
 $t->write_file('test-empty2.html',
 	'X<!--#include virtual="/local/empty.html" -->X');
+$t->write_file('test-empty3.html',
+	'X<!--#include virtual="/cache/empty.html" -->X');
 $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');
 
 ###############################################################################