Tests: test for X-Accel-Expires switching off proxy_store.
diff --git a/proxy-store.t b/proxy-store.t index 90d3aaf..8844079 100644 --- a/proxy-store.t +++ b/proxy-store.t
@@ -9,7 +9,7 @@ use warnings; use strict; -use Test::More tests => 2; +use Test::More tests => 5; BEGIN { use FindBin; chdir($FindBin::Bin); } @@ -48,12 +48,20 @@ proxy_pass http://127.0.0.1:8080/index.html; proxy_store on; } + location /nostore { + proxy_pass http://127.0.0.1:8080/index-nostore.html; + proxy_store on; + } + location /index-nostore.html { + add_header X-Accel-Expires 0; + } } } EOF $t->write_file('index.html', 'SEE-THIS'); +$t->write_file('index-nostore.html', 'SEE-THIS'); $t->run(); ############################################################################### @@ -61,4 +69,14 @@ like(http_get('/store'), qr/SEE-THIS/, 'proxy request'); ok(-e $t->testdir() . '/store', 'result stored'); +like(http_get('/nostore'), qr/SEE-THIS/, 'proxy request with x-accel-expires'); + +TODO: { +local $TODO = 'patch under review'; + +ok(!-e $t->testdir() . '/nostore', 'result not stored'); +} + +ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, 'no temp files'); + ###############################################################################