Mercurial > hg > nginx-tests
annotate debug_connection_unix.t @ 1990:85d88cd5091c
Tests: SSI include stub tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:42:55 +0300 |
parents | 5ac6efbe5552 |
children |
rev | line source |
---|---|
835
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
2 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
3 # (C) Nginx, Inc. |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
4 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
5 # Tests for debug_connection with unix socket. |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
6 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
7 ############################################################################### |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
8 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
9 use warnings; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
10 use strict; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
11 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
12 use Test::More; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
13 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
14 BEGIN { use FindBin; chdir($FindBin::Bin); } |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
15 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
16 use lib 'lib'; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
17 use Test::Nginx; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
18 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
19 ############################################################################### |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
20 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
21 select STDERR; $| = 1; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
22 select STDOUT; $| = 1; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
23 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
24 my $t = Test::Nginx->new()->has(qw/http --with-debug unix proxy/); |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
25 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
26 $t->write_file_expand('nginx.conf', <<'EOF'); |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
27 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
28 %%TEST_GLOBALS%% |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
29 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
30 daemon off; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
31 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
32 events { |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
33 debug_connection unix:; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
34 } |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
35 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
36 http { |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
37 %%TEST_GLOBALS_HTTP%% |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
38 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
39 error_log %%TESTDIR%%/debug1.log alert; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
40 error_log %%TESTDIR%%/debug2.log alert; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
41 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
42 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
43 listen 127.0.0.1:8080; |
835
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
44 listen unix:%%TESTDIR%%/unix.sock; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
45 server_name localhost; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
46 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
47 location /debug { |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
48 proxy_pass http://unix:%%TESTDIR%%/unix.sock:/; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
49 } |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
50 } |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
51 } |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
52 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
53 EOF |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
54 |
1693
5ac6efbe5552
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
55 $t->run()->plan(5); |
835
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
56 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
57 ############################################################################### |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
58 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
59 http_get('/'); |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
60 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
61 select undef, undef, undef, 0.1; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
62 is($t->read_file('debug1.log'), '', 'no debug_connection file 1'); |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
63 is($t->read_file('debug2.log'), '', 'no debug_connection file 2'); |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
64 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
65 http_get('/debug'); |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
66 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
67 select undef, undef, undef, 0.1; |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
68 like($t->read_file('debug1.log'), qr/\[debug\]/, 'debug_connection file 1'); |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
69 like($t->read_file('debug2.log'), qr/\[debug\]/, 'debug_connection file 2'); |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
70 is($t->read_file('debug1.log'), $t->read_file('debug2.log'), |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
71 'debug_connection file1 file2 match'); |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
72 |
650465c099e1
Tests: added unix tests for debug_connection directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
73 ############################################################################### |