# HG changeset patch # User Maxim Dounin # Date 1226403283 -10800 # Node ID bb6d65d833cdcd1ca1942c5b760e9a2a047757b0 # Parent 239a346b49131eafc8395b4796bee0dab59c5767 Tests: test for X-Accel-Expires switching off proxy_store. diff --git a/proxy-store.t b/proxy-store.t --- 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 @@ http { 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 @@ EOF 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'); + ###############################################################################