Skip to content

Commit

Permalink
REGTESTS: add some tests for 'do-log' action
Browse files Browse the repository at this point in the history
Now that 'do-log' action may be used for all existing action contexts,
let's add some tests in reg-tests/log/log_profile.vtc to ensure it works
as expected. quic-ini is not tested as it may not be builtin depending on
build options..
  • Loading branch information
Darlelet committed Oct 4, 2024
1 parent 3ba924a commit 3f4a788
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion reg-tests/log/log_profiles.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ barrier b5 cond 2 -cyclic
server s1 {
rxreq
txresp
} -repeat 5 -start
} -repeat 6 -start

syslog Slg1 -level info {
recv
Expand Down Expand Up @@ -95,6 +95,21 @@ syslog Slg5 -level info {
expect ~ ".* haproxy ${h1_pid} .* close"
} -start

syslog Slg6 -level info {
#rfc5424, logprof5:
# tcp-req-conn, http-req, http-res, http-after-res, txn.close
recv
expect ~ ".* haproxy ${h1_pid} .* start:tcp-req-conn"
recv
expect ~ ".* haproxy ${h1_pid} .* http-req"
recv
expect ~ ".* haproxy ${h1_pid} .* http-res"
recv
expect ~ ".* haproxy ${h1_pid} .* http-after-res"
recv
expect ~ ".* haproxy ${h1_pid} .* txn_close"
} -start

haproxy h1 -conf {
defaults
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
Expand Down Expand Up @@ -158,6 +173,19 @@ haproxy h1 -conf {
log udp@${Slg5_addr}:${Slg5_port} format rfc5424 profile logprof4 local0
default_backend be

listen fe7
bind "fd@${fe_7}"
mode http
log-format "dummy"
log-steps close
log udp@${Slg6_addr}:${Slg6_port} format rfc5424 profile logprof5 local0
default_backend be

tcp-request connection do-log
http-request do-log
http-response do-log
http-after-response do-log

log-profile logprof1
on close format "close" sd "sdclose"

Expand All @@ -177,6 +205,10 @@ haproxy h1 -conf {
on response format "response"
on close format "close"

log-profile logprof5
on tcp-req-conn format "start:tcp-req-conn"
on any format "%OG"

backend be
mode http
server app1 ${s1_addr}:${s1_port}
Expand Down Expand Up @@ -239,8 +271,15 @@ client c6 -connect ${h1_fe_6_sock} {
expect resp.status == 200
} -start -wait

client c7 -connect ${h1_fe_7_sock} {
txreq -url "/"
rxresp
expect resp.status == 200
} -start -wait

syslog Slg1 -wait
syslog Slg2 -wait
syslog Slg3 -wait
syslog Slg4 -wait
syslog Slg5 -wait
syslog Slg6 -wait

0 comments on commit 3f4a788

Please sign in to comment.