haproxy/reg-tests/peers/tls_basic_sync.vtc
Frederic Lecaille 6e94b69665 REGTESTS: ssl: Move all the SSL certificates, keys, crt-lists inside "certs" directory
Move all these files and others for OCSP tests found into reg-tests/ssl
to reg-test/ssl/certs and adapt all the VTC files which use them.

This patch is needed by other tests which have to include the SSL tests.
Indeed, some VTC commands contain paths to these files which cannot
be customized with environment variables, depending on the location the VTC file
is runi from, because VTC does not resolve the environment variables. Only macros
as ${testdir} can be resolved.

For instance this command run from a VTC file from reg-tests/ssl directory cannot
be reused from another directory, except if we add a symbolic link for each certs,
key etc.

 haproxy h1 -cli {
   send "del ssl crt-list ${testdir}/localhost.crt-list ${testdir}/common.pem:1"
 }

This is not what we want. We add a symbolic link to reg-test/ssl/certs to the
directory and modify the command above as follows:

 haproxy h1 -cli {
   send "del ssl crt-list ${testdir}/certs/localhost.crt-list ${testdir}/certs/common.pem:1"
 }
2025-12-08 10:40:59 +01:00

177 lines
4.6 KiB
Text

vtest "Basic test for peers protocol over SSL/TLS"
#REQUIRE_OPTIONS=OPENSSL
feature ignore_unknown_macro
#REGTEST_TYPE=slow
haproxy h1 -arg "-L A" -conf {
global
.if feature(THREAD)
thread-groups 1
.endif
defaults
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
backend stkt
stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
peers peers
default-server ssl crt ${testdir}/certs/common.pem verify none
bind "fd@${A}" ssl crt ${testdir}/certs/common.pem
server A
server B ${h2_B_addr}:${h2_B_port}
server C ${h3_C_addr}:${h3_C_port}
server D ${h4_D_addr}:${h4_D_port}
frontend fe
bind "fd@${fe}"
tcp-request inspect-delay 100ms
tcp-request content track-sc0 url table stkt
tcp-request content sc-inc-gpc0(0)
}
haproxy h2 -arg "-L B" -conf {
global
.if feature(THREAD)
thread-groups 1
.endif
defaults
mode http
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
backend stkt
stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
peers peers
default-server ssl crt ${testdir}/certs/common.pem verify none
bind "fd@${B}" ssl crt ${testdir}/certs/common.pem
server A ${h1_A_addr}:${h1_A_port}
server B
server C ${h3_C_addr}:${h3_C_port}
server D ${h4_D_addr}:${h4_D_port}
frontend fe
bind "fd@${fe}"
http-request track-sc0 url table stkt
http-request sc-inc-gpc0(0)
}
haproxy h3 -arg "-L C" -conf {
global
.if feature(THREAD)
thread-groups 1
.endif
defaults
mode http
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
backend stkt
stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
peers peers
default-server ssl crt ${testdir}/certs/common.pem verify none
bind "fd@${C}" ssl crt ${testdir}/certs/common.pem
server A ${h1_A_addr}:${h1_A_port}
server B ${h2_B_addr}:${h2_B_port}
server C
server D ${h4_D_addr}:${h4_D_port}
frontend fe
bind "fd@${fe}"
http-request track-sc0 url table stkt
http-request sc-inc-gpc0(0)
}
haproxy h4 -arg "-L D" -conf {
global
.if feature(THREAD)
thread-groups 1
.endif
defaults
mode http
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
backend stkt
stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
peers peers
bind "fd@${D}"
server A ${h1_A_addr}:${h1_A_port}
server B ${h2_B_addr}:${h2_B_port}
server C ${h3_C_addr}:${h3_C_port}
server D
frontend fe
bind "fd@${fe}"
http-request track-sc0 url table stkt
http-request sc-inc-gpc0(0)
}
client c1 -connect ${h1_fe_sock} {
txreq -url "/c1_client"
expect_close
} -start
client c2 -connect ${h1_fe_sock} {
txreq -url "/c2_client"
expect_close
} -start
client c3 -connect ${h1_fe_sock} {
txreq -url "/c3_client"
expect_close
} -start
client c4 -connect ${h1_fe_sock} {
txreq -url "/c4_client"
expect_close
} -start
haproxy h1 -start
delay 0.2
haproxy h2 -start
delay 0.2
haproxy h3 -start
delay 0.2
haproxy h4 -start
delay 0.2
client c1 -wait
client c2 -wait
client c3 -wait
client c4 -wait
delay 2
haproxy h1 -cli {
send "show table stkt"
expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
}
haproxy h2 -cli {
send "show table stkt"
expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
}
haproxy h3 -cli {
send "show table stkt"
expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 shard=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
}
haproxy h4 -cli {
send "show table stkt"
expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:0\n"
}