Mercurial > hg > nginx-tests
comparison geo.t @ 217:ea574aae77cb
Tests: unbreak geo and realip tests in jails.
There is no real 127.0.0.1 in jails, skip these tests if 127.0.0.1 isn't
here.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sat, 12 May 2012 14:27:02 +0400 |
parents | f2f37a52e42e |
children | 9d7805b05f0f |
comparison
equal
deleted
inserted
replaced
216:f2f37a52e42e | 217:ea574aae77cb |
---|---|
19 ############################################################################### | 19 ############################################################################### |
20 | 20 |
21 select STDERR; $| = 1; | 21 select STDERR; $| = 1; |
22 select STDOUT; $| = 1; | 22 select STDOUT; $| = 1; |
23 | 23 |
24 my $t = Test::Nginx->new()->has(qw/http geo/)->plan(6); | 24 my $t = Test::Nginx->new()->has(qw/http geo/); |
25 | 25 |
26 $t->write_file_expand('nginx.conf', <<'EOF'); | 26 $t->write_file_expand('nginx.conf', <<'EOF'); |
27 | 27 |
28 %%TEST_GLOBALS%% | 28 %%TEST_GLOBALS%% |
29 | 29 |
58 server { | 58 server { |
59 listen 127.0.0.1:8080; | 59 listen 127.0.0.1:8080; |
60 server_name localhost; | 60 server_name localhost; |
61 | 61 |
62 location / { | 62 location / { |
63 add_header X-IP $remote_addr; | |
63 add_header X-Geo $geo; | 64 add_header X-Geo $geo; |
64 add_header X-Arg $geo_from_arg; | 65 add_header X-Arg $geo_from_arg; |
65 add_header X-XFF $geo_proxy; | 66 add_header X-XFF $geo_proxy; |
66 } | 67 } |
67 } | 68 } |
69 | 70 |
70 EOF | 71 EOF |
71 | 72 |
72 $t->write_file('1', ''); | 73 $t->write_file('1', ''); |
73 $t->run(); | 74 $t->run(); |
75 | |
76 plan(skip_all => 'no 127.0.0.1 on host') | |
77 if http_get('/1') !~ /X-IP: 127.0.0.1/m; | |
78 | |
79 $t->plan(6); | |
74 | 80 |
75 ############################################################################### | 81 ############################################################################### |
76 | 82 |
77 like(http_get('/1'), qr/^X-Geo: loopback/m, 'geo'); | 83 like(http_get('/1'), qr/^X-Geo: loopback/m, 'geo'); |
78 | 84 |