blob: bf467084b8cf467c6aef14876d77d894ab7e376b [file] [log] [blame]
Frédéric Lécaille4d789482019-03-18 14:08:46 +01001vtest "Basic test for peers protocol over SSL/TLS with stick-table declared in peers sections"
2feature ignore_unknown_macro
3
Willy Tarreau596ce522019-05-07 07:53:54 +02004#REQUIRE_OPTIONS=OPENSSL
Frédéric Lécaillec8f931c2019-05-07 11:11:00 +02005#REGTEST_TYPE=slow
Willy Tarreau596ce522019-05-07 07:53:54 +02006
Frédéric Lécaille4d789482019-03-18 14:08:46 +01007haproxy h1 -arg "-L A" -conf {
8 defaults
Willy Tarreauf6739232021-11-18 17:46:22 +01009 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
10 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
11 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille4d789482019-03-18 14:08:46 +010012
13 peers peers
14 table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
15 default-server ssl crt ${testdir}/common.pem verify none
16 bind "fd@${A}" ssl crt ${testdir}/common.pem
17 server A
18 server B ${h2_B_addr}:${h2_B_port}
19 server C ${h3_C_addr}:${h3_C_port}
20 server D ${h4_D_addr}:${h4_D_port}
21
22 frontend fe
23 bind "fd@${fe}"
Christopher Faulet1448d3a2019-10-14 16:10:52 +020024 tcp-request inspect-delay 100ms
Frédéric Lécaille4d789482019-03-18 14:08:46 +010025 tcp-request content track-sc0 url table peers/stkt
26 tcp-request content sc-inc-gpc0(0)
27}
28
29haproxy h2 -arg "-L B" -conf {
30 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020031 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010032 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
33 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
34 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille4d789482019-03-18 14:08:46 +010035
36 peers peers
37 table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
38 default-server ssl crt ${testdir}/common.pem verify none
39 bind "fd@${B}" ssl crt ${testdir}/common.pem
40 server A ${h1_A_addr}:${h1_A_port}
41 server B
42 server C ${h3_C_addr}:${h3_C_port}
43 server D ${h4_D_addr}:${h4_D_port}
44
45 frontend fe
46 bind "fd@${fe}"
47 http-request track-sc0 url table peers/stkt
48 http-request sc-inc-gpc0(0)
49}
50
51haproxy h3 -arg "-L C" -conf {
52 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020053 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010054 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
55 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
56 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille4d789482019-03-18 14:08:46 +010057
58 peers peers
59 table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
60 default-server ssl crt ${testdir}/common.pem verify none
61 bind "fd@${C}" ssl crt ${testdir}/common.pem
62 server A ${h1_A_addr}:${h1_A_port}
63 server B ${h2_B_addr}:${h2_B_port}
64 server C
65 server D ${h4_D_addr}:${h4_D_port}
66
67 frontend fe
68 bind "fd@${fe}"
69 http-request track-sc0 url table peers/stkt
70 http-request sc-inc-gpc0(0)
71}
72
73haproxy h4 -arg "-L D" -conf {
74 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020075 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010076 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
77 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
78 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille4d789482019-03-18 14:08:46 +010079
80 backend stkt
81
82 peers peers
83 table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
84 bind "fd@${D}"
85 server A ${h1_A_addr}:${h1_A_port}
86 server B ${h2_B_addr}:${h2_B_port}
87 server C ${h3_C_addr}:${h3_C_port}
88 server D
89
90 frontend fe
91 bind "fd@${fe}"
92 http-request track-sc0 url table peers/stkt
93 http-request sc-inc-gpc0(0)
94}
95
96client c1 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +020097 txreq -url "/c1_client"
Frédéric Lécaille4d789482019-03-18 14:08:46 +010098 expect_close
99} -start
100
101client c2 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200102 txreq -url "/c2_client"
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100103 expect_close
104} -start
105
106client c3 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200107 txreq -url "/c3_client"
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100108 expect_close
109} -start
110
111client c4 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200112 txreq -url "/c4_client"
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100113 expect_close
114} -start
115
116haproxy h1 -start
Willy Tarreauc3820052022-02-16 11:28:09 +0100117delay 0.02
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100118haproxy h2 -start
Willy Tarreauc3820052022-02-16 11:28:09 +0100119delay 0.02
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100120haproxy h3 -start
Willy Tarreauc3820052022-02-16 11:28:09 +0100121delay 0.02
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100122haproxy h4 -start
Willy Tarreauc3820052022-02-16 11:28:09 +0100123delay 0.02
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100124
125client c1 -wait
126client c2 -wait
127client c3 -wait
128client c4 -wait
129
Willy Tarreauc3820052022-02-16 11:28:09 +0100130delay 3
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100131
132haproxy h1 -cli {
133 send "show table peers/stkt"
Willy Tarreau5a63e722022-11-29 16:29:12 +0100134 expect ~ "# table: peers/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}"
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100135}
136
137haproxy h2 -cli {
138 send "show table peers/stkt"
Willy Tarreau5a63e722022-11-29 16:29:12 +0100139 expect ~ "# table: peers/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}"
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100140}
141
142haproxy h3 -cli {
143 send "show table peers/stkt"
Willy Tarreau5a63e722022-11-29 16:29:12 +0100144 expect ~ "# table: peers/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}"
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100145}
146
147haproxy h4 -cli {
148 send "show table peers/stkt"
149 expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:0\n"
150}
151