Mercurial > hg > nginx-tests
comparison memcached-fake.t @ 128:25047dc6ae9b
Tests: add test for memcached parsing problem as fixed in 0.6.14.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 19 Feb 2010 22:26:38 +0300 |
parents | 2bf0c4c80aa7 |
children | e7371b38cd2c |
comparison
equal
deleted
inserted
replaced
127:2bf0c4c80aa7 | 128:25047dc6ae9b |
---|---|
20 ############################################################################### | 20 ############################################################################### |
21 | 21 |
22 select STDERR; $| = 1; | 22 select STDERR; $| = 1; |
23 select STDOUT; $| = 1; | 23 select STDOUT; $| = 1; |
24 | 24 |
25 my $t = Test::Nginx->new()->has(qw/http rewrite memcached/)->plan(2) | 25 my $t = Test::Nginx->new()->has(qw/http rewrite memcached ssi/)->plan(3) |
26 ->write_file_expand('nginx.conf', <<'EOF'); | 26 ->write_file_expand('nginx.conf', <<'EOF'); |
27 | 27 |
28 %%TEST_GLOBALS%% | 28 %%TEST_GLOBALS%% |
29 | 29 |
30 master_process off; | 30 master_process off; |
42 | 42 |
43 location / { | 43 location / { |
44 set $memcached_key $uri; | 44 set $memcached_key $uri; |
45 memcached_pass 127.0.0.1:8081; | 45 memcached_pass 127.0.0.1:8081; |
46 } | 46 } |
47 | |
48 location /ssi { | |
49 default_type text/html; | |
50 ssi on; | |
51 } | |
47 } | 52 } |
48 } | 53 } |
49 | 54 |
50 EOF | 55 EOF |
51 | 56 |
57 $t->write_file('ssi.html', '<!--#include virtual="/" set="blah" -->blah: <!--#echo var="blah" -->'); | |
52 $t->run_daemon(\&memcached_fake_daemon); | 58 $t->run_daemon(\&memcached_fake_daemon); |
53 $t->run(); | 59 $t->run(); |
54 | 60 |
55 ############################################################################### | 61 ############################################################################### |
56 | 62 |
57 like(http_get('/'), qr/SEE-THIS/, 'memcached split trailer'); | 63 like(http_get('/'), qr/SEE-THIS/, 'memcached split trailer'); |
64 | |
65 like(http_get('/ssi.html'), qr/SEE-THIS/, 'memcached ssi var'); | |
58 | 66 |
59 TODO: { | 67 TODO: { |
60 local $TODO = 'patch under review'; | 68 local $TODO = 'patch under review'; |
61 | 69 |
62 like(`grep -F '[error]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no error'); | 70 like(`grep -F '[error]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no error'); |
80 while (<$client>) { | 88 while (<$client>) { |
81 last if (/\x0d\x0a$/); | 89 last if (/\x0d\x0a$/); |
82 } | 90 } |
83 | 91 |
84 print $client 'VALUE / 0 8' . CRLF; | 92 print $client 'VALUE / 0 8' . CRLF; |
85 print $client 'SEE-THIS'; | 93 print $client 'SEE-TH'; |
94 select(undef, undef, undef, 0.1); | |
95 print $client 'IS'; | |
86 select(undef, undef, undef, 0.1); | 96 select(undef, undef, undef, 0.1); |
87 print $client CRLF . 'EN'; | 97 print $client CRLF . 'EN'; |
88 select(undef, undef, undef, 0.1); | 98 select(undef, undef, undef, 0.1); |
89 print $client 'D' . CRLF; | 99 print $client 'D' . CRLF; |
90 close $client; | 100 close $client; |