Mercurial > hg > nginx-tests
comparison memcached.t @ 34:689174c36e94
Tests: memcached in 0.7.19 works only with next_upstream.
In 0.7.19 memcached module correctly handles keys not in memcached only if
configured with memcached_next_upstream not_found. Add a test to make sure
this workaround will work in the future.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 14 Oct 2008 22:42:18 +0400 |
parents | 71ea39729fa0 |
children | 7bf0e8a1d66c |
comparison
equal
deleted
inserted
replaced
33:4f57d57543e1 | 34:689174c36e94 |
---|---|
24 select STDOUT; $| = 1; | 24 select STDOUT; $| = 1; |
25 | 25 |
26 eval { require Cache::Memcached; }; | 26 eval { require Cache::Memcached; }; |
27 plain(skip_all => 'Cache::Memcached not installed') if $@; | 27 plain(skip_all => 'Cache::Memcached not installed') if $@; |
28 | 28 |
29 my $t = Test::Nginx->new()->has('rewrite')->has_daemon('memcached')->plan(2) | 29 my $t = Test::Nginx->new()->has('rewrite')->has_daemon('memcached')->plan(3) |
30 ->write_file_expand('nginx.conf', <<'EOF'); | 30 ->write_file_expand('nginx.conf', <<'EOF'); |
31 | 31 |
32 master_process off; | 32 master_process off; |
33 daemon off; | 33 daemon off; |
34 | 34 |
45 | 45 |
46 location / { | 46 location / { |
47 set $memcached_key $uri; | 47 set $memcached_key $uri; |
48 memcached_pass 127.0.0.1:8081; | 48 memcached_pass 127.0.0.1:8081; |
49 } | 49 } |
50 | |
51 location /next { | |
52 set $memcached_key $uri; | |
53 memcached_next_upstream not_found; | |
54 memcached_pass 127.0.0.1:8081; | |
55 } | |
50 } | 56 } |
51 } | 57 } |
52 | 58 |
53 EOF | 59 EOF |
54 | 60 |
60 my $memd = Cache::Memcached->new(servers => [ '127.0.0.1:8081' ]); | 66 my $memd = Cache::Memcached->new(servers => [ '127.0.0.1:8081' ]); |
61 $memd->set('/', 'SEE-THIS'); | 67 $memd->set('/', 'SEE-THIS'); |
62 | 68 |
63 like(http_get('/'), qr/SEE-THIS/, 'memcached request'); | 69 like(http_get('/'), qr/SEE-THIS/, 'memcached request'); |
64 like(http_get('/notfound'), qr/404/, 'memcached not found'); | 70 like(http_get('/notfound'), qr/404/, 'memcached not found'); |
71 like(http_get('/next'), qr/404/, 'not found with memcached_next_upstream'); | |
65 | 72 |
66 ############################################################################### | 73 ############################################################################### |