Mercurial > hg > nginx-tests
comparison proxy-store.t @ 89:abbe4b123795
Tests: simplify proxy-store tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 04 May 2009 23:04:20 +0400 |
parents | a31296de1987 |
children | 1d3c82227a05 |
comparison
equal
deleted
inserted
replaced
88:a31296de1987 | 89:abbe4b123795 |
---|---|
41 | 41 |
42 server { | 42 server { |
43 listen 127.0.0.1:8080; | 43 listen 127.0.0.1:8080; |
44 server_name localhost; | 44 server_name localhost; |
45 | 45 |
46 location /store { | 46 location /store- { |
47 proxy_pass http://127.0.0.1:8080/index.html; | 47 proxy_pass http://127.0.0.1:8080/; |
48 proxy_store on; | |
49 } | |
50 location /nostore { | |
51 proxy_pass http://127.0.0.1:8080/index-nostore.html; | |
52 proxy_store on; | |
53 } | |
54 location /big { | |
55 proxy_pass http://127.0.0.1:8080/index-big.html; | |
56 proxy_store on; | 48 proxy_store on; |
57 } | 49 } |
58 location /index-nostore.html { | 50 location /index-nostore.html { |
59 add_header X-Accel-Expires 0; | 51 add_header X-Accel-Expires 0; |
60 } | 52 } |
71 $t->write_file('index-big.html', 'x' x (100 << 10)); | 63 $t->write_file('index-big.html', 'x' x (100 << 10)); |
72 $t->run(); | 64 $t->run(); |
73 | 65 |
74 ############################################################################### | 66 ############################################################################### |
75 | 67 |
76 like(http_get('/store'), qr/SEE-THIS/, 'proxy request'); | 68 like(http_get('/store-index.html'), qr/SEE-THIS/, 'proxy request'); |
77 ok(-e $t->testdir() . '/store', 'result stored'); | 69 ok(-e $t->testdir() . '/store-index.html', 'result stored'); |
78 | 70 |
79 like(http_get('/nostore'), qr/SEE-THIS/, 'proxy request with x-accel-expires'); | 71 like(http_get('/store-index-nostore.html'), qr/SEE-THIS/, |
72 'proxy request with x-accel-expires'); | |
80 | 73 |
81 TODO: { | 74 TODO: { |
82 local $TODO = 'patch under review'; | 75 local $TODO = 'patch under review'; |
83 | 76 |
84 ok(!-e $t->testdir() . '/nostore', 'result not stored'); | 77 ok(!-e $t->testdir() . '/store-index-nostore.html', 'result not stored'); |
85 } | 78 } |
86 | 79 |
87 ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, 'no temp files'); | 80 ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, 'no temp files'); |
88 | 81 |
89 http_get('/big', aborted => 1, sleep => 0.1); | 82 http_get('/store-index-big.html', aborted => 1, sleep => 0.1); |
90 sleep(1); | 83 sleep(1); |
91 | 84 |
92 ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, | 85 ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, |
93 'no temp files after aborted request'); | 86 'no temp files after aborted request'); |
94 | 87 |