comparison http_resolver_aaaa.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 cf14cfe9ec8c
comparison
equal deleted inserted replaced
973:7d7aef8b9f3a 974:882267679006
35 35
36 http { 36 http {
37 %%TEST_GLOBALS_HTTP%% 37 %%TEST_GLOBALS_HTTP%%
38 38
39 server { 39 server {
40 listen 127.0.0.1:%%PORT_0%%; 40 listen 127.0.0.1:8080;
41 listen [::1]:%%PORT_0%%; 41 listen [::1]:%%PORT_8080%%;
42 server_name localhost; 42 server_name localhost;
43 43
44 location / { 44 location / {
45 resolver 127.0.0.1:%%PORT_1_UDP%%; 45 resolver 127.0.0.1:%%PORT_8081_UDP%%;
46 proxy_pass http://$host:%%PORT_0%%/backend; 46 proxy_pass http://$host:%%PORT_8080%%/backend;
47 47
48 proxy_next_upstream http_504 timeout error; 48 proxy_next_upstream http_504 timeout error;
49 proxy_intercept_errors on; 49 proxy_intercept_errors on;
50 proxy_connect_timeout 50ms; 50 proxy_connect_timeout 50ms;
51 error_page 504 502 /50x; 51 error_page 504 502 /50x;
52 add_header X-Host $upstream_addr; 52 add_header X-Host $upstream_addr;
53 } 53 }
54 location /two { 54 location /two {
55 resolver 127.0.0.1:%%PORT_1_UDP%% 127.0.0.1:%%PORT_2_UDP%%; 55 resolver 127.0.0.1:%%PORT_8081_UDP%% 127.0.0.1:%%PORT_8082_UDP%%;
56 proxy_pass http://$host:%%PORT_0%%/backend; 56 proxy_pass http://$host:%%PORT_8080%%/backend;
57 } 57 }
58 58
59 location /backend { 59 location /backend {
60 return 200; 60 return 200;
61 } 61 }
67 67
68 EOF 68 EOF
69 69
70 $t->try_run('no inet6 support')->plan(72); 70 $t->try_run('no inet6 support')->plan(72);
71 71
72 $t->run_daemon(\&dns_daemon, port(1), $t); 72 $t->run_daemon(\&dns_daemon, port(8081), $t);
73 $t->run_daemon(\&dns_daemon, port(2), $t); 73 $t->run_daemon(\&dns_daemon, port(8082), $t);
74 74
75 $t->waitforfile($t->testdir . '/' . port(1)); 75 $t->waitforfile($t->testdir . '/' . port(8081));
76 $t->waitforfile($t->testdir . '/' . port(2)); 76 $t->waitforfile($t->testdir . '/' . port(8082));
77 77
78 ############################################################################### 78 ###############################################################################
79 79
80 my (@n, $response); 80 my (@n, $response);
81 81
82 my $p0 = port(0); 82 my $p0 = port(8080);
83 83
84 like(http_host_header('aaaa.example.net', '/'), qr/\[fe80::1\]/, 'AAAA'); 84 like(http_host_header('aaaa.example.net', '/'), qr/\[fe80::1\]/, 'AAAA');
85 like(http_host_header('cname.example.net', '/'), qr/\[fe80::1\]/, 'CNAME'); 85 like(http_host_header('cname.example.net', '/'), qr/\[fe80::1\]/, 'CNAME');
86 like(http_host_header('cname.example.net', '/'), qr/\[fe80::1\]/, 86 like(http_host_header('cname.example.net', '/'), qr/\[fe80::1\]/,
87 'CNAME cached'); 87 'CNAME cached');
330 push @rdata, pack('n3N nn8', 0xc031, AAAA, IN, $ttl, 330 push @rdata, pack('n3N nn8', 0xc031, AAAA, IN, $ttl,
331 16, expand_ip6("::1")); 331 16, expand_ip6("::1"));
332 } 332 }
333 333
334 } elsif ($name eq '2.example.net') { 334 } elsif ($name eq '2.example.net') {
335 if ($port == port(1)) { 335 if ($port == port(8081)) {
336 $state->{twocnt}++; 336 $state->{twocnt}++;
337 } 337 }
338 if ($state->{twocnt} & 1) { 338 if ($state->{twocnt} & 1) {
339 $rcode = SERVFAIL; 339 $rcode = SERVFAIL;
340 } 340 }