comparison proxy-store.t @ 87:f2d09159a8f3

Tests: proxy_store leaving temporary files bug test. It shouldn't even if client closed prematurely connection.
author Maxim Dounin <mdounin@mdounin.ru>
date Sun, 26 Apr 2009 03:54:40 +0400
parents 726c3c2a8b8c
children a31296de1987
comparison
equal deleted inserted replaced
86:2dbe4ecdd254 87:f2d09159a8f3
7 ############################################################################### 7 ###############################################################################
8 8
9 use warnings; 9 use warnings;
10 use strict; 10 use strict;
11 11
12 use Test::More tests => 5; 12 use Test::More tests => 6;
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;
49 } 49 }
50 location /nostore { 50 location /nostore {
51 proxy_pass http://127.0.0.1:8080/index-nostore.html; 51 proxy_pass http://127.0.0.1:8080/index-nostore.html;
52 proxy_store on; 52 proxy_store on;
53 } 53 }
54 location /big {
55 proxy_pass http://127.0.0.1:8080/index-big.html;
56 proxy_store on;
57 }
54 location /index-nostore.html { 58 location /index-nostore.html {
55 add_header X-Accel-Expires 0; 59 add_header X-Accel-Expires 0;
60 }
61 location /index-big.html {
62 limit_rate 200k;
56 } 63 }
57 } 64 }
58 } 65 }
59 66
60 EOF 67 EOF
61 68
62 $t->write_file('index.html', 'SEE-THIS'); 69 $t->write_file('index.html', 'SEE-THIS');
63 $t->write_file('index-nostore.html', 'SEE-THIS'); 70 $t->write_file('index-nostore.html', 'SEE-THIS');
71 $t->write_file('index-big.html', 'x' x (100 << 10));
64 $t->run(); 72 $t->run();
65 73
66 ############################################################################### 74 ###############################################################################
67 75
68 like(http_get('/store'), qr/SEE-THIS/, 'proxy request'); 76 like(http_get('/store'), qr/SEE-THIS/, 'proxy request');
76 ok(!-e $t->testdir() . '/nostore', 'result not stored'); 84 ok(!-e $t->testdir() . '/nostore', 'result not stored');
77 } 85 }
78 86
79 ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, 'no temp files'); 87 ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, 'no temp files');
80 88
89 TODO: {
90 local $TODO = 'patch under review';
91
92 http_get('/big', aborted => 1, sleep => 0.1);
93 sleep(1);
94
95 ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0,
96 'no temp files after aborted request');
97 }
98
81 ############################################################################### 99 ###############################################################################