Ignore:
Timestamp:
01/16/09 19:58:58 (3 years ago)
Author:
George Potapov <nephrite@…>
Branches:
master-v0.7, upstream_count_limit
Children:
cd26d0
Parents:
3f2f24
git-author:
George Potapov <nephrite@…> (01/16/09 19:58:58)
git-committer:
George Potapov <nephrite@…> (01/16/09 19:58:58)
Message:

updated to latest upstream_keepalive (ngx_http_upstream_keepalive-067ddc059ee0.tar.gz) from Maxim Dounin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • upstream_keepalive/t/memcached-keepalive.t

    r2904d4 rca37e8  
    2121plain(skip_all => 'Cache::Memcached not installed') if $@; 
    2222 
    23 my $t = Test::Nginx->new()->has('rewrite')->has_daemon('memcached')->plan(10) 
     23my $t = Test::Nginx->new()->has('rewrite')->has_daemon('memcached')->plan(16) 
    2424    ->write_file_expand('nginx.conf', <<'EOF'); 
    2525 
     
    9595EOF 
    9696 
    97 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081'); 
    98 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082'); 
     97if (`memcached -h` =~ /repcached/) { 
     98    # repcached patches adds additional listen socket memcached 
     99    # that should be different too 
     100 
     101    $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081', 
     102        '-X', '8091'); 
     103    $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082', 
     104        '-X', '8092'); 
     105 
     106} else { 
     107    $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081'); 
     108    $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082'); 
     109} 
     110 
    99111$t->run(); 
     112 
     113$t->waitforsocket('127.0.0.1:8081') 
     114    or die "Unable to start memcached"; 
     115$t->waitforsocket('127.0.0.1:8082') 
     116    or die "Unable to start second memcached"; 
    100117 
    101118############################################################################### 
     
    106123$memd1->set('/', 'SEE-THIS'); 
    107124$memd2->set('/', 'SEE-THIS'); 
     125$memd1->set('/big', 'X' x 1000000); 
    108126 
    109127my $total = $memd1->stats()->{total}->{total_connections}; 
     
    120138    'only one connection used'); 
    121139 
     140# Since nginx doesn't read all data from connection in some situations (head 
     141# requests, post_action, errors writing to client) we have to close such 
     142# connections.  Check if we really do close them. 
     143 
     144$total = $memd1->stats()->{total}->{total_connections}; 
     145 
     146unlike(http_head('/'), qr/SEE-THIS/, 'head request'); 
     147like(http_get('/'), qr/SEE-THIS/, 'get after head'); 
     148 
     149is($memd1->stats()->{total}->{total_connections}, $total + 1, 
     150    'head request closes connection'); 
     151 
     152$total = $memd1->stats()->{total}->{total_connections}; 
     153 
     154unlike(http_head('/big'), qr/XXX/, 'big head'); 
     155like(http_get('/'), qr/SEE-THIS/, 'get after big head'); 
     156 
     157is($memd1->stats()->{total}->{total_connections}, $total + 1, 
     158    'big head request closes connection'); 
     159 
    122160# two backends with 'single' option - should establish only one connection 
    123161 
Note: See TracChangeset for help on using the changeset viewer.