Mercurial > hg > nginx-tests
comparison geoip.t @ 1064:6508aa1cf9cb
Tests: skip geoip tests on hosts without GeoIP IPv6 support.
author | Andrey Zelenkov <zelenkov@nginx.com> |
---|---|
date | Wed, 19 Oct 2016 20:55:19 +0300 |
parents | 83357211563e |
children | cf14cfe9ec8c |
comparison
equal
deleted
inserted
replaced
1063:d62747c321a6 | 1064:6508aa1cf9cb |
---|---|
20 ############################################################################### | 20 ############################################################################### |
21 | 21 |
22 select STDERR; $| = 1; | 22 select STDERR; $| = 1; |
23 select STDOUT; $| = 1; | 23 select STDOUT; $| = 1; |
24 | 24 |
25 my $t = Test::Nginx->new()->has(qw/http http_geoip ipv6/)->plan(20) | 25 my $t = Test::Nginx->new()->has(qw/http http_geoip ipv6/) |
26 ->write_file_expand('nginx.conf', <<'EOF'); | 26 ->write_file_expand('nginx.conf', <<'EOF'); |
27 | 27 |
28 %%TEST_GLOBALS%% | 28 %%TEST_GLOBALS%% |
29 | 29 |
30 daemon off; | 30 daemon off; |
142 $data .= chr(5); | 142 $data .= chr(5); |
143 $data .= pack_node(32); | 143 $data .= pack_node(32); |
144 | 144 |
145 $t->write_file('org.dat', $data); | 145 $t->write_file('org.dat', $data); |
146 $t->write_file('index.html', ''); | 146 $t->write_file('index.html', ''); |
147 $t->run(); | 147 $t->try_run('no inet6 support')->plan(20); |
148 | 148 |
149 ############################################################################### | 149 ############################################################################### |
150 | 150 |
151 my $r = http_xff('10.0.0.1'); | 151 my $r = http_xff('10.0.0.1'); |
152 like($r, qr/X-Country-Code: RU/, 'geoip country code'); | 152 like($r, qr/X-Country-Code: RU/, 'geoip country code'); |