Skip to content

Commit 367665d

Browse files
committed
Logging: Add integration test for logging policy.
Signed-off-by: Eloy Coto <[email protected]>
1 parent 8085e5c commit 367665d

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

t/apicast-policy-logging.t

+41
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,44 @@ GET /
420420
[qr/^\{\"host\"\:\"echo\"\}/]
421421
--- no_error_log eval
422422
[qr/\[error/, qr/GET \/ HTTP\/1.1\" 200/]
423+
424+
=== TEST 11: Original request information can be retrieved correctly
425+
--- configuration
426+
{
427+
"services": [
428+
{
429+
"id": 42,
430+
"proxy": {
431+
"policy_chain": [
432+
{
433+
"name": "apicast.policy.logging",
434+
"configuration": {
435+
"custom_logging": "Status::{{ status }} {{service.id}} {{host}} {{original_request.host}}",
436+
"enable_json_logs": false
437+
}
438+
},
439+
{
440+
"name": "apicast.policy.upstream",
441+
"configuration":
442+
{
443+
"rules": [ { "regex": "/", "url": "http://echo" } ]
444+
}
445+
}
446+
]
447+
}
448+
}
449+
]
450+
}
451+
--- upstream
452+
location / {
453+
content_by_lua_block {
454+
ngx.say('yay, api backend');
455+
}
456+
}
457+
--- request
458+
GET /
459+
--- error_code: 200
460+
--- error_log eval
461+
[qr/^Status\:\:200 42 echo localhost/]
462+
--- no_error_log eval
463+
[qr/\[error/, qr/GET \/ HTTP\/1.1\" 200/]

0 commit comments

Comments
 (0)