annotate debug_connection.t @ 489:3036e3af0e08

Tests: more Vary normalization tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 21 Oct 2014 03:46:20 +0400
parents 43e05ac6c23c
children 089c4174e269
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
301
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1 #!/usr/bin/perl
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2
303
ad51e58c2d7a Tests: fixed typo in copyright.
Sergey Kandaurov <pluknet@nginx.com>
parents: 301
diff changeset
3 # (C) Nginx, Inc.
301
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
5 # Tests for debug_connection.
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
6
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
7 ###############################################################################
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
8
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
9 use warnings;
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
10 use strict;
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
11
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
12 use Test::More;
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
13
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
14 BEGIN { use FindBin; chdir($FindBin::Bin); }
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
15
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
16 use lib 'lib';
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
17 use Test::Nginx;
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
18
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
19 ###############################################################################
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
20
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
21 select STDERR; $| = 1;
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
22 select STDOUT; $| = 1;
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
23
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
24 my $t = Test::Nginx->new()->has(qw/http --with-debug ipv6 proxy/);
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
25
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
26 $t->write_file_expand('nginx.conf', <<'EOF');
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
27
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
28 %%TEST_GLOBALS%%
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
29
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
30 daemon off;
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
31
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
32 events {
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
33 debug_connection ::1;
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
34 }
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
35
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
36 http {
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
37 %%TEST_GLOBALS_HTTP%%
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
38
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
39 error_log %%TESTDIR%%/debug1.log alert;
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
40 error_log %%TESTDIR%%/debug2.log alert;
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
41
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
42 server {
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
43 listen 127.0.0.1:8080;
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
44 listen [::1]:8080;
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
45 server_name localhost;
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
46
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
47 location /debug {
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
48 proxy_pass http://[::1]:8080/;
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
49 }
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
50 }
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
51 }
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
52
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
53 EOF
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
54
392
c28ecaef065f Tests: try_run() introduced.
Maxim Dounin <mdounin@mdounin.ru>
parents: 303
diff changeset
55 $t->try_run('no inet6 support')->plan(5);
301
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
56
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
57 ###############################################################################
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
58
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
59 http_get('/');
467
43e05ac6c23c Tests: the read_file function added in Test::Nginx.
Sergey Kandaurov <pluknet@nginx.com>
parents: 397
diff changeset
60 is($t->read_file('debug1.log'), '', 'no debug_connection file 1');
43e05ac6c23c Tests: the read_file function added in Test::Nginx.
Sergey Kandaurov <pluknet@nginx.com>
parents: 397
diff changeset
61 is($t->read_file('debug2.log'), '', 'no debug_connection file 1');
301
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
62
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
63 http_get('/debug');
467
43e05ac6c23c Tests: the read_file function added in Test::Nginx.
Sergey Kandaurov <pluknet@nginx.com>
parents: 397
diff changeset
64 like($t->read_file('debug1.log'), qr/\[debug\]/, 'debug_connection file 1');
43e05ac6c23c Tests: the read_file function added in Test::Nginx.
Sergey Kandaurov <pluknet@nginx.com>
parents: 397
diff changeset
65 like($t->read_file('debug2.log'), qr/\[debug\]/, 'debug_connection file 2');
43e05ac6c23c Tests: the read_file function added in Test::Nginx.
Sergey Kandaurov <pluknet@nginx.com>
parents: 397
diff changeset
66 is($t->read_file('debug1.log'), $t->read_file('debug2.log'),
301
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
67 'debug_connection file1 file2 match');
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
68
a107552ac714 Tests: added tests for debug_connection.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
69 ###############################################################################