forked from 3scale/APIcast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapicast-syslog.t
57 lines (50 loc) · 1.23 KB
/
apicast-syslog.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use lib 't';
use Test::APIcast::Blackbox 'no_plan';
repeat_each(3);
run_tests();
__DATA__
=== TEST 1: sends access logs to syslog
--- env random_port eval
(
'APICAST_ACCESS_LOG_FILE' => "syslog:server=127.0.0.1:$ENV{TEST_NGINX_RANDOM_PORT}",
)
--- configuration fixture=echo.json
--- request
GET /
--- response_body
GET / HTTP/1.1
X-Real-IP: 127.0.0.1
Host: echo
--- error_code: 200
--- udp_listen random_port env: $TEST_NGINX_RANDOM_PORT
--- udp_query eval: qr{"GET / HTTP/1.1" 200}
--- udp_reply
=== TEST 2: sends error logs to syslog
--- error_log_file env random_port eval
"syslog:server=127.0.0.1:$ENV{TEST_NGINX_RANDOM_PORT}"
--- log_level: emerg
--- configuration
{
"services": [{
"proxy": {
"policy_chain": [
{
"name": "apicast.policy.phase_logger",
"configuration": { "log_level": "emerg" }
},
{ "name": "apicast.policy.upstream",
"configuration": { "rules": [ { "regex": "/", "url": "http://echo" } ] } }
]
}
}]
}
--- request
GET /
--- response_body
GET / HTTP/1.1
X-Real-IP: 127.0.0.1
Host: echo
--- error_code: 200
--- udp_listen random_port env: $TEST_NGINX_RANDOM_PORT
--- udp_query eval: qr{\[lua\] phase_logger.lua:\d+: running phase: rewrite}
--- udp_reply