comparison proxy_store.t @ 687:89cfb7397ba1

Tests: added proxy_store tests with variable.
author Andrey Zelenkov <zelenkov@nginx.com>
date Fri, 11 Sep 2015 17:25:42 +0300
parents f175dc25f249
children e9064d691790
comparison
equal deleted inserted replaced
686:0af386a519d2 687:89cfb7397ba1
21 select STDERR; $| = 1; 21 select STDERR; $| = 1;
22 select STDOUT; $| = 1; 22 select STDOUT; $| = 1;
23 23
24 my $t = Test::Nginx->new(); 24 my $t = Test::Nginx->new();
25 25
26 $t->write_file_expand('nginx.conf', <<'EOF')->has(qw/http proxy ssi/)->plan(7); 26 $t->write_file_expand('nginx.conf', <<'EOF')->has(qw/http proxy ssi/)->plan(9);
27 27
28 %%TEST_GLOBALS%% 28 %%TEST_GLOBALS%%
29 29
30 daemon off; 30 daemon off;
31 31
40 server_name localhost; 40 server_name localhost;
41 41
42 location /store- { 42 location /store- {
43 proxy_pass http://127.0.0.1:8080/; 43 proxy_pass http://127.0.0.1:8080/;
44 proxy_store on; 44 proxy_store on;
45 }
46 location /store-string- {
47 proxy_pass http://127.0.0.1:8080/;
48 proxy_store %%TESTDIR%%$uri;
45 } 49 }
46 location /ssi.html { 50 location /ssi.html {
47 ssi on; 51 ssi on;
48 } 52 }
49 location /index-big.html { 53 location /index-big.html {
66 ############################################################################### 70 ###############################################################################
67 71
68 like(http_get('/store-index.html'), qr/SEE-THIS/, 'proxy request'); 72 like(http_get('/store-index.html'), qr/SEE-THIS/, 'proxy request');
69 ok(-e $t->testdir() . '/store-index.html', 'result stored'); 73 ok(-e $t->testdir() . '/store-index.html', 'result stored');
70 74
75 like(http_get('/store-string-index.html'), qr/SEE-THIS/,
76 'proxy string path request');
77 ok(-e $t->testdir() . '/store-string-index.html', 'string path result stored');
78
71 like(http_head('/store-index-nostore.html'), qr/200 OK/, 'head request'); 79 like(http_head('/store-index-nostore.html'), qr/200 OK/, 'head request');
72 ok(!-e $t->testdir() . '/store-index-nostore.html', 'result not stored'); 80 ok(!-e $t->testdir() . '/store-index-nostore.html', 'result not stored');
73 81
74 ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, 'no temp files'); 82 ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, 'no temp files');
75 83