Mercurial > hg > nginx-tests
comparison syslog.t @ 974:882267679006
Tests: simplified parallel modifications in tests.
Mail tests were simplified in c227348453db.
author | Andrey Zelenkov <zelenkov@nginx.com> |
---|---|
date | Tue, 12 Jul 2016 17:39:03 +0300 |
parents | e9064d691790 |
children | 196d33c2bb45 |
comparison
equal
deleted
inserted
replaced
973:7d7aef8b9f3a | 974:882267679006 |
---|---|
28 | 28 |
29 $t->write_file_expand('nginx.conf', <<'EOF'); | 29 $t->write_file_expand('nginx.conf', <<'EOF'); |
30 | 30 |
31 %%TEST_GLOBALS%% | 31 %%TEST_GLOBALS%% |
32 | 32 |
33 error_log syslog:server=127.0.0.1:%%PORT_1_UDP%% info; | 33 error_log syslog:server=127.0.0.1:%%PORT_8081_UDP%% info; |
34 error_log %%TESTDIR%%/f_glob.log info; | 34 error_log %%TESTDIR%%/f_glob.log info; |
35 | 35 |
36 daemon off; | 36 daemon off; |
37 | 37 |
38 events { | 38 events { |
44 limit_req_zone $binary_remote_addr zone=one:1m rate=1r/m; | 44 limit_req_zone $binary_remote_addr zone=one:1m rate=1r/m; |
45 | 45 |
46 log_format empty ""; | 46 log_format empty ""; |
47 log_format logf "$uri:$status"; | 47 log_format logf "$uri:$status"; |
48 | 48 |
49 error_log syslog:server=127.0.0.1:%%PORT_2_UDP%% info; | 49 error_log syslog:server=127.0.0.1:%%PORT_8082_UDP%% info; |
50 error_log %%TESTDIR%%/f_http.log info; | 50 error_log %%TESTDIR%%/f_http.log info; |
51 | 51 |
52 server { | 52 server { |
53 listen 127.0.0.1:%%PORT_0%%; | 53 listen 127.0.0.1:8080; |
54 server_name localhost; | 54 server_name localhost; |
55 | 55 |
56 location /e { | 56 location /e { |
57 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%%; | 57 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%; |
58 } | 58 } |
59 location /a { | 59 location /a { |
60 access_log syslog:server=127.0.0.1:%%PORT_4_UDP%%; | 60 access_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%; |
61 } | 61 } |
62 location /ef { | 62 location /ef { |
63 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%%,facility=user; | 63 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%,facility=user; |
64 } | 64 } |
65 location /es { | 65 location /es { |
66 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%%,severity=alert; | 66 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%,severity=alert; |
67 } | 67 } |
68 location /et { | 68 location /et { |
69 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%%,tag=SEETHIS; | 69 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%,tag=SEETHIS; |
70 } | 70 } |
71 location /af { | 71 location /af { |
72 access_log syslog:server=127.0.0.1:%%PORT_4_UDP%%,facility=user; | 72 access_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%,facility=user; |
73 } | 73 } |
74 location /as { | 74 location /as { |
75 # put severity inside to catch possible parsing programming errors | 75 # put severity inside to catch possible parsing programming errors |
76 access_log syslog:severity=alert,server=127.0.0.1:%%PORT_4_UDP%%; | 76 access_log syslog:severity=alert,server=127.0.0.1:%%PORT_8084_UDP%%; |
77 } | 77 } |
78 location /at { | 78 location /at { |
79 access_log syslog:server=127.0.0.1:%%PORT_4_UDP%%,tag=SEETHIS; | 79 access_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%,tag=SEETHIS; |
80 } | 80 } |
81 location /e2 { | 81 location /e2 { |
82 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%%; | 82 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%; |
83 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%%; | 83 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%; |
84 } | 84 } |
85 location /a2 { | 85 location /a2 { |
86 access_log syslog:server=127.0.0.1:%%PORT_4_UDP%%; | 86 access_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%; |
87 access_log syslog:server=127.0.0.1:%%PORT_4_UDP%%; | 87 access_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%; |
88 } | 88 } |
89 location /a_logf { | 89 location /a_logf { |
90 access_log syslog:server=127.0.0.1:%%PORT_4_UDP%% logf; | 90 access_log syslog:server=127.0.0.1:%%PORT_8084_UDP%% logf; |
91 } | 91 } |
92 location /if { | 92 location /if { |
93 access_log syslog:server=127.0.0.1:%%PORT_3_UDP%% logf | 93 access_log syslog:server=127.0.0.1:%%PORT_8083_UDP%% logf |
94 if=$arg_logme; | 94 if=$arg_logme; |
95 } | 95 } |
96 | 96 |
97 location /nohostname { | 97 location /nohostname { |
98 access_log syslog:server=127.0.0.1:%%PORT_4_UDP%%,nohostname; | 98 access_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%,nohostname; |
99 } | 99 } |
100 | 100 |
101 location /debug { | 101 location /debug { |
102 limit_req zone=one; | 102 limit_req zone=one; |
103 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%% debug; | 103 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%% debug; |
104 } | 104 } |
105 location /info { | 105 location /info { |
106 limit_req zone=one; | 106 limit_req zone=one; |
107 limit_req_log_level info; | 107 limit_req_log_level info; |
108 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%% info; | 108 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%% info; |
109 } | 109 } |
110 location /notice { | 110 location /notice { |
111 limit_req zone=one; | 111 limit_req zone=one; |
112 limit_req_log_level notice; | 112 limit_req_log_level notice; |
113 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%% notice; | 113 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%% notice; |
114 } | 114 } |
115 location /warn { | 115 location /warn { |
116 limit_req zone=one; | 116 limit_req zone=one; |
117 limit_req_log_level warn; | 117 limit_req_log_level warn; |
118 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%% warn; | 118 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%% warn; |
119 } | 119 } |
120 location /error { | 120 location /error { |
121 limit_req zone=one; | 121 limit_req zone=one; |
122 limit_req_log_level error; | 122 limit_req_log_level error; |
123 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%%; | 123 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%; |
124 } | 124 } |
125 location /low { | 125 location /low { |
126 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%% warn; | 126 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%% warn; |
127 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%%; | 127 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%; |
128 } | 128 } |
129 location /dup { | 129 location /dup { |
130 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%%; | 130 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%; |
131 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%%; | 131 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%; |
132 } | 132 } |
133 location /high { | 133 location /high { |
134 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%% emerg; | 134 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%% emerg; |
135 error_log syslog:server=127.0.0.1:%%PORT_4_UDP%%; | 135 error_log syslog:server=127.0.0.1:%%PORT_8084_UDP%%; |
136 } | 136 } |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 EOF | 140 EOF |
141 | 141 |
142 $t->run_daemon(\&syslog_daemon, port(1), $t, 's_glob.log'); | 142 $t->run_daemon(\&syslog_daemon, port(8081), $t, 's_glob.log'); |
143 $t->run_daemon(\&syslog_daemon, port(2), $t, 's_http.log'); | 143 $t->run_daemon(\&syslog_daemon, port(8082), $t, 's_http.log'); |
144 $t->run_daemon(\&syslog_daemon, port(3), $t, 's_if.log'); | 144 $t->run_daemon(\&syslog_daemon, port(8083), $t, 's_if.log'); |
145 | 145 |
146 $t->waitforfile($t->testdir . '/s_glob.log'); | 146 $t->waitforfile($t->testdir . '/s_glob.log'); |
147 $t->waitforfile($t->testdir . '/s_http.log'); | 147 $t->waitforfile($t->testdir . '/s_http.log'); |
148 $t->waitforfile($t->testdir . '/s_if.log'); | 148 $t->waitforfile($t->testdir . '/s_if.log'); |
149 | 149 |
249 local $SIG{ALRM} = sub { die "timeout\n" }; | 249 local $SIG{ALRM} = sub { die "timeout\n" }; |
250 local $SIG{PIPE} = sub { die "sigpipe\n" }; | 250 local $SIG{PIPE} = sub { die "sigpipe\n" }; |
251 alarm(1); | 251 alarm(1); |
252 $s = IO::Socket::INET->new( | 252 $s = IO::Socket::INET->new( |
253 Proto => 'udp', | 253 Proto => 'udp', |
254 LocalAddr => '127.0.0.1:' . port(4) | 254 LocalAddr => '127.0.0.1:' . port(8084) |
255 ); | 255 ); |
256 alarm(0); | 256 alarm(0); |
257 }; | 257 }; |
258 alarm(0); | 258 alarm(0); |
259 if ($@) { | 259 if ($@) { |