comparison proxy_websocket.t @ 974:882267679006

Tests: simplified parallel modifications in tests. Mail tests were simplified in c227348453db.
author Andrey Zelenkov <zelenkov@nginx.com>
date Tue, 12 Jul 2016 17:39:03 +0300
parents e9064d691790
children
comparison
equal deleted inserted replaced
973:7d7aef8b9f3a 974:882267679006
45 45
46 http { 46 http {
47 %%TEST_GLOBALS_HTTP%% 47 %%TEST_GLOBALS_HTTP%%
48 48
49 server { 49 server {
50 listen 127.0.0.1:%%PORT_0%%; 50 listen 127.0.0.1:8080;
51 server_name localhost; 51 server_name localhost;
52 52
53 location / { 53 location / {
54 proxy_pass http://127.0.0.1:%%PORT_1%%; 54 proxy_pass http://127.0.0.1:8081;
55 proxy_http_version 1.1; 55 proxy_http_version 1.1;
56 proxy_set_header Upgrade $http_upgrade; 56 proxy_set_header Upgrade $http_upgrade;
57 proxy_set_header Connection "Upgrade"; 57 proxy_set_header Connection "Upgrade";
58 proxy_read_timeout 2s; 58 proxy_read_timeout 2s;
59 send_timeout 2s; 59 send_timeout 2s;
64 EOF 64 EOF
65 65
66 $t->run_daemon(\&websocket_fake_daemon); 66 $t->run_daemon(\&websocket_fake_daemon);
67 $t->run(); 67 $t->run();
68 68
69 $t->waitforsocket('127.0.0.1:' . port(1)) 69 $t->waitforsocket('127.0.0.1:' . port(8081))
70 or die "Can't start test backend"; 70 or die "Can't start test backend";
71 71
72 ############################################################################### 72 ###############################################################################
73 73
74 # establish websocket connection 74 # establish websocket connection
123 sub websocket_connect { 123 sub websocket_connect {
124 my ($message) = @_; 124 my ($message) = @_;
125 125
126 my $s = IO::Socket::INET->new( 126 my $s = IO::Socket::INET->new(
127 Proto => 'tcp', 127 Proto => 'tcp',
128 PeerAddr => '127.0.0.1:' . port(0) 128 PeerAddr => '127.0.0.1:' . port(8080)
129 ) 129 )
130 or die "Can't connect to nginx: $!\n"; 130 or die "Can't connect to nginx: $!\n";
131 131
132 my $h = Protocol::WebSocket::Handshake::Client->new( 132 my $h = Protocol::WebSocket::Handshake::Client->new(
133 url => 'ws://localhost'); 133 url => 'ws://localhost');
208 ############################################################################### 208 ###############################################################################
209 209
210 sub websocket_fake_daemon { 210 sub websocket_fake_daemon {
211 my $server = IO::Socket::INET->new( 211 my $server = IO::Socket::INET->new(
212 Proto => 'tcp', 212 Proto => 'tcp',
213 LocalAddr => '127.0.0.1:' . port(1), 213 LocalAddr => '127.0.0.1:' . port(8081),
214 Listen => 5, 214 Listen => 5,
215 Reuse => 1 215 Reuse => 1
216 ) 216 )
217 or die "Can't create listening socket: $!\n"; 217 or die "Can't create listening socket: $!\n";
218 218