comparison proxy-store.t @ 47:bb6d65d833cd

Tests: test for X-Accel-Expires switching off proxy_store.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 11 Nov 2008 14:34:43 +0300
parents 239a346b4913
children 726c3c2a8b8c
comparison
equal deleted inserted replaced
46:239a346b4913 47:bb6d65d833cd
7 ############################################################################### 7 ###############################################################################
8 8
9 use warnings; 9 use warnings;
10 use strict; 10 use strict;
11 11
12 use Test::More tests => 2; 12 use Test::More tests => 5;
13 13
14 BEGIN { use FindBin; chdir($FindBin::Bin); } 14 BEGIN { use FindBin; chdir($FindBin::Bin); }
15 15
16 use lib 'lib'; 16 use lib 'lib';
17 use Test::Nginx; 17 use Test::Nginx;
46 46
47 location /store { 47 location /store {
48 proxy_pass http://127.0.0.1:8080/index.html; 48 proxy_pass http://127.0.0.1:8080/index.html;
49 proxy_store on; 49 proxy_store on;
50 } 50 }
51 location /nostore {
52 proxy_pass http://127.0.0.1:8080/index-nostore.html;
53 proxy_store on;
54 }
55 location /index-nostore.html {
56 add_header X-Accel-Expires 0;
57 }
51 } 58 }
52 } 59 }
53 60
54 EOF 61 EOF
55 62
56 $t->write_file('index.html', 'SEE-THIS'); 63 $t->write_file('index.html', 'SEE-THIS');
64 $t->write_file('index-nostore.html', 'SEE-THIS');
57 $t->run(); 65 $t->run();
58 66
59 ############################################################################### 67 ###############################################################################
60 68
61 like(http_get('/store'), qr/SEE-THIS/, 'proxy request'); 69 like(http_get('/store'), qr/SEE-THIS/, 'proxy request');
62 ok(-e $t->testdir() . '/store', 'result stored'); 70 ok(-e $t->testdir() . '/store', 'result stored');
63 71
72 like(http_get('/nostore'), qr/SEE-THIS/, 'proxy request with x-accel-expires');
73
74 TODO: {
75 local $TODO = 'patch under review';
76
77 ok(!-e $t->testdir() . '/nostore', 'result not stored');
78 }
79
80 ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, 'no temp files');
81
64 ############################################################################### 82 ###############################################################################