comparison stream_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 f1cc64e4e67d
children cf14cfe9ec8c
comparison
equal deleted inserted replaced
1063:d62747c321a6 1064:6508aa1cf9cb
24 24
25 select STDERR; $| = 1; 25 select STDERR; $| = 1;
26 select STDOUT; $| = 1; 26 select STDOUT; $| = 1;
27 27
28 my $t = Test::Nginx->new()->has(qw/stream stream_geoip stream_return ipv6/) 28 my $t = Test::Nginx->new()->has(qw/stream stream_geoip stream_return ipv6/)
29 ->has('stream_realip')->plan(20); 29 ->has('stream_realip');
30 30
31 $t->write_file_expand('nginx.conf', <<'EOF'); 31 $t->write_file_expand('nginx.conf', <<'EOF');
32 32
33 %%TEST_GLOBALS%% 33 %%TEST_GLOBALS%%
34 34
140 $data .= chr(0xFF) x 3; 140 $data .= chr(0xFF) x 3;
141 $data .= chr(5); 141 $data .= chr(5);
142 $data .= pack_node(32); 142 $data .= pack_node(32);
143 143
144 $t->write_file('org.dat', $data); 144 $t->write_file('org.dat', $data);
145 $t->run(); 145 $t->try_run('no inet6 support')->plan(20);
146 146
147 ############################################################################### 147 ###############################################################################
148 148
149 my %data = stream_pp('10.0.0.1') =~ /(\w+):(.*)/g; 149 my %data = stream_pp('10.0.0.1') =~ /(\w+):(.*)/g;
150 is($data{country_code}, 'RU', 'geoip country code'); 150 is($data{country_code}, 'RU', 'geoip country code');