blob: 7e1bfd38d889e345714c8603fba111e3fa77e8e9 [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_VERSION=2.0
5#REQUIRE_OPTIONS=OPENSSL
Frédéric Lécaillec8f931c2019-05-07 11:11:00 +02006#REGTEST_TYPE=slow
Willy Tarreau596ce522019-05-07 07:53:54 +02007
Frédéric Lécaille4d789482019-03-18 14:08:46 +01008haproxy h1 -arg "-L A" -conf {
9 defaults
Willy Tarreauf6739232021-11-18 17:46:22 +010010 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
11 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
12 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille4d789482019-03-18 14:08:46 +010013
14 peers peers
15 table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
16 default-server ssl crt ${testdir}/common.pem verify none
17 bind "fd@${A}" ssl crt ${testdir}/common.pem
18 server A
19 server B ${h2_B_addr}:${h2_B_port}
20 server C ${h3_C_addr}:${h3_C_port}
21 server D ${h4_D_addr}:${h4_D_port}
22
23 frontend fe
24 bind "fd@${fe}"
Christopher Faulet1448d3a2019-10-14 16:10:52 +020025 tcp-request inspect-delay 100ms
Frédéric Lécaille4d789482019-03-18 14:08:46 +010026 tcp-request content track-sc0 url table peers/stkt
27 tcp-request content sc-inc-gpc0(0)
28}
29
30haproxy h2 -arg "-L B" -conf {
31 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020032 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010033 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
34 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
35 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille4d789482019-03-18 14:08:46 +010036
37 peers peers
38 table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
39 default-server ssl crt ${testdir}/common.pem verify none
40 bind "fd@${B}" ssl crt ${testdir}/common.pem
41 server A ${h1_A_addr}:${h1_A_port}
42 server B
43 server C ${h3_C_addr}:${h3_C_port}
44 server D ${h4_D_addr}:${h4_D_port}
45
46 frontend fe
47 bind "fd@${fe}"
48 http-request track-sc0 url table peers/stkt
49 http-request sc-inc-gpc0(0)
50}
51
52haproxy h3 -arg "-L C" -conf {
53 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020054 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010055 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
56 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
57 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille4d789482019-03-18 14:08:46 +010058
59 peers peers
60 table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
61 default-server ssl crt ${testdir}/common.pem verify none
62 bind "fd@${C}" ssl crt ${testdir}/common.pem
63 server A ${h1_A_addr}:${h1_A_port}
64 server B ${h2_B_addr}:${h2_B_port}
65 server C
66 server D ${h4_D_addr}:${h4_D_port}
67
68 frontend fe
69 bind "fd@${fe}"
70 http-request track-sc0 url table peers/stkt
71 http-request sc-inc-gpc0(0)
72}
73
74haproxy h4 -arg "-L D" -conf {
75 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020076 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010077 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
78 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
79 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille4d789482019-03-18 14:08:46 +010080
81 backend stkt
82
83 peers peers
84 table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
85 bind "fd@${D}"
86 server A ${h1_A_addr}:${h1_A_port}
87 server B ${h2_B_addr}:${h2_B_port}
88 server C ${h3_C_addr}:${h3_C_port}
89 server D
90
91 frontend fe
92 bind "fd@${fe}"
93 http-request track-sc0 url table peers/stkt
94 http-request sc-inc-gpc0(0)
95}
96
97client c1 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +020098 txreq -url "/c1_client"
Frédéric Lécaille4d789482019-03-18 14:08:46 +010099 expect_close
100} -start
101
102client c2 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200103 txreq -url "/c2_client"
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100104 expect_close
105} -start
106
107client c3 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200108 txreq -url "/c3_client"
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100109 expect_close
110} -start
111
112client c4 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200113 txreq -url "/c4_client"
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100114 expect_close
115} -start
116
117haproxy h1 -start
Willy Tarreauc3820052022-02-16 11:28:09 +0100118delay 0.02
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100119haproxy h2 -start
Willy Tarreauc3820052022-02-16 11:28:09 +0100120delay 0.02
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100121haproxy h3 -start
Willy Tarreauc3820052022-02-16 11:28:09 +0100122delay 0.02
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100123haproxy h4 -start
Willy Tarreauc3820052022-02-16 11:28:09 +0100124delay 0.02
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100125
126client c1 -wait
127client c2 -wait
128client c3 -wait
129client c4 -wait
130
Willy Tarreauc3820052022-02-16 11:28:09 +0100131delay 3
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100132
133haproxy h1 -cli {
134 send "show table peers/stkt"
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200135 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 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100136}
137
138haproxy h2 -cli {
139 send "show table peers/stkt"
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200140 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 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100141}
142
143haproxy h3 -cli {
144 send "show table peers/stkt"
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200145 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 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
Frédéric Lécaille4d789482019-03-18 14:08:46 +0100146}
147
148haproxy h4 -cli {
149 send "show table peers/stkt"
150 expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:0\n"
151}
152