Mercurial > hg > nginx-tests
comparison stream_upstream_least_conn.t @ 1235:3fc6817cd84a
Tests: explicit peer port in stream tests now required.
Notably, this eliminates extra port acquire for the default
port number in cases when it was not actually used.
author | Andrey Zelenkov <zelenkov@nginx.com> |
---|---|
date | Thu, 26 Oct 2017 16:36:13 +0300 |
parents | 882267679006 |
children | f3ba4c74de31 |
comparison
equal
deleted
inserted
replaced
1234:0defcc1c87ab | 1235:3fc6817cd84a |
---|---|
63 | 63 |
64 is(many(10), "$port1: 5, $port2: 5", 'balanced'); | 64 is(many(10), "$port1: 5, $port2: 5", 'balanced'); |
65 | 65 |
66 my @sockets; | 66 my @sockets; |
67 for (1 .. 2) { | 67 for (1 .. 2) { |
68 my $s = stream(); | 68 my $s = stream('127.0.0.1:' . port(8080)); |
69 $s->write('w'); | 69 $s->write('w'); |
70 push @sockets, $s; | 70 push @sockets, $s; |
71 } | 71 } |
72 | 72 |
73 select undef, undef, undef, 0.2; | 73 select undef, undef, undef, 0.2; |
79 sub many { | 79 sub many { |
80 my ($count) = @_; | 80 my ($count) = @_; |
81 my (%ports); | 81 my (%ports); |
82 | 82 |
83 for (1 .. $count) { | 83 for (1 .. $count) { |
84 if (stream()->io('.') =~ /(\d+)/) { | 84 if (stream('127.0.0.1:' . port(8080))->io('.') =~ /(\d+)/) { |
85 $ports{$1} = 0 unless defined $ports{$1}; | 85 $ports{$1} = 0 unless defined $ports{$1}; |
86 $ports{$1}++; | 86 $ports{$1}++; |
87 } | 87 } |
88 } | 88 } |
89 | 89 |