Mercurial > hg > nginx-tests
comparison realip.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 | 7189255c1b91 |
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 realip/)->plan(3); | 24 my $t = Test::Nginx->new()->has(qw/http realip/); |
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 |
51 EOF | 51 EOF |
52 | 52 |
53 $t->write_file('1', ''); | 53 $t->write_file('1', ''); |
54 $t->run(); | 54 $t->run(); |
55 | 55 |
56 plan(skip_all => 'no 127.0.0.1 on host') | |
57 if http_get('/1') !~ /X-IP: 127.0.0.1/m; | |
58 | |
59 $t->plan(2); | |
60 | |
56 ############################################################################### | 61 ############################################################################### |
57 | |
58 like(http_get('/1'), qr/^X-IP: 127.0.0.1/m, 'realip no ip'); | |
59 | 62 |
60 like(http_xff('192.0.2.1'), qr/^X-IP: 192.0.2.1/m, 'realip'); | 63 like(http_xff('192.0.2.1'), qr/^X-IP: 192.0.2.1/m, 'realip'); |
61 like(http_xff('10.0.0.1, 192.0.2.1'), qr/^X-IP: 192.0.2.1/m, 'realip multi'); | 64 like(http_xff('10.0.0.1, 192.0.2.1'), qr/^X-IP: 192.0.2.1/m, 'realip multi'); |
62 | 65 |
63 ############################################################################### | 66 ############################################################################### |