Changeset 1036:38ed3dda3279 in nginx-tests


Ignore:
Timestamp:
09/19/16 10:58:34 (4 years ago)
Author:
Sergey Kandaurov <pluknet@…>
Branch:
default
Phase:
public
Message:

Tests: $upstream_addr tests in hash module with no live upstream.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • upstream_hash.t

    r974 r1036  
    2323select STDOUT; $| = 1;
    2424
    25 my $t = Test::Nginx->new()->has(qw/http proxy rewrite upstream_hash/)->plan(11);
     25my $t = Test::Nginx->new()->has(qw/http proxy rewrite upstream_hash/)->plan(13);
    2626
    2727$t->write_file_expand('nginx.conf', <<'EOF');
     
    115115        location /cbad {
    116116            proxy_pass http://cbad;
     117        }
     118        location /busy {
     119            proxy_pass http://bad/busy;
     120            add_header X-IP $upstream_addr always;
     121        }
     122        location /cbusy {
     123            proxy_pass http://cbad/busy;
     124            add_header X-IP $upstream_addr always;
    117125        }
    118126        location /pnu {
     
    140148            return 204;
    141149        }
     150
     151        location /busy {
     152            return 444;
     153        }
    142154    }
    143155
     
    184196@res = grep { $_ == $p1 } iter('/cbad', 20);
    185197is(@res, 20, 'all hashed peers - bad consistent');
     198
     199like(http_get('/busy'), qr/X-IP: 127.0.0.1:$p1, bad/,
     200        'upstream name - busy');
     201
     202TODO: {
     203local $TODO = 'not yet' unless $t->has_version('1.11.5');
     204
     205like(http_get('/cbusy'), qr/X-IP: 127.0.0.1:$p1, cbad/,
     206        'upstream name - busy consistent');
     207
     208}
    186209
    187210###############################################################################
Note: See TracChangeset for help on using the changeset viewer.