blob: 95e3d736e31c05e53291f46e5cdf95a2f62b7319 [file] [log] [blame]
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +01001vtest "Basic test for peers protocol over SSL/TLS"
Ilya Shipitsin9ab31382019-04-17 12:19:56 +05002#REQUIRE_OPTIONS=OPENSSL
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +01003feature ignore_unknown_macro
4
Frédéric Lécailledc1a3bd2019-03-29 15:07:24 +01005#REGTEST_TYPE=slow
6
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +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écaille3c4fb952019-01-17 16:15:33 +010012
13 backend stkt
14 stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
15
16 peers peers
17 default-server ssl crt ${testdir}/common.pem verify none
18 bind "fd@${A}" ssl crt ${testdir}/common.pem
19 server A
20 server B ${h2_B_addr}:${h2_B_port}
21 server C ${h3_C_addr}:${h3_C_port}
22 server D ${h4_D_addr}:${h4_D_port}
23
24 frontend fe
25 bind "fd@${fe}"
Christopher Faulet1448d3a2019-10-14 16:10:52 +020026 tcp-request inspect-delay 100ms
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010027 tcp-request content track-sc0 url table stkt
28 tcp-request content sc-inc-gpc0(0)
29}
30
31haproxy h2 -arg "-L B" -conf {
32 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020033 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010034 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
35 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
36 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010037
38 backend stkt
39 stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
40
41 peers peers
42 default-server ssl crt ${testdir}/common.pem verify none
43 bind "fd@${B}" ssl crt ${testdir}/common.pem
44 server A ${h1_A_addr}:${h1_A_port}
45 server B
46 server C ${h3_C_addr}:${h3_C_port}
47 server D ${h4_D_addr}:${h4_D_port}
48
49 frontend fe
50 bind "fd@${fe}"
51 http-request track-sc0 url table stkt
52 http-request sc-inc-gpc0(0)
53}
54
55haproxy h3 -arg "-L C" -conf {
56 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020057 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010058 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
59 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
60 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010061
62 backend stkt
63 stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
64
65 peers peers
66 default-server ssl crt ${testdir}/common.pem verify none
67 bind "fd@${C}" ssl crt ${testdir}/common.pem
68 server A ${h1_A_addr}:${h1_A_port}
69 server B ${h2_B_addr}:${h2_B_port}
70 server C
71 server D ${h4_D_addr}:${h4_D_port}
72
73 frontend fe
74 bind "fd@${fe}"
75 http-request track-sc0 url table stkt
76 http-request sc-inc-gpc0(0)
77}
78
79haproxy h4 -arg "-L D" -conf {
80 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020081 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010082 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
83 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
84 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010085
86 backend stkt
87 stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
88
89 peers peers
90 bind "fd@${D}"
91 server A ${h1_A_addr}:${h1_A_port}
92 server B ${h2_B_addr}:${h2_B_port}
93 server C ${h3_C_addr}:${h3_C_port}
94 server D
95
96 frontend fe
97 bind "fd@${fe}"
98 http-request track-sc0 url table stkt
99 http-request sc-inc-gpc0(0)
100}
101
102client c1 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200103 txreq -url "/c1_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100104 expect_close
105} -start
106
107client c2 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200108 txreq -url "/c2_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100109 expect_close
110} -start
111
112client c3 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200113 txreq -url "/c3_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100114 expect_close
115} -start
116
117client c4 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200118 txreq -url "/c4_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100119 expect_close
120} -start
121
122haproxy h1 -start
123delay 0.2
124haproxy h2 -start
125delay 0.2
126haproxy h3 -start
127delay 0.2
128haproxy h4 -start
129delay 0.2
130
131client c1 -wait
132client c2 -wait
133client c3 -wait
134client c4 -wait
135
136delay 2
137
138haproxy h1 -cli {
139 send "show table stkt"
Willy Tarreau5a63e722022-11-29 16:29:12 +0100140 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}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100141}
142
143haproxy h2 -cli {
144 send "show table stkt"
Willy Tarreau5a63e722022-11-29 16:29:12 +0100145 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}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100146}
147
148haproxy h3 -cli {
149 send "show table stkt"
Willy Tarreau5a63e722022-11-29 16:29:12 +0100150 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}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100151}
152
153haproxy h4 -cli {
154 send "show table stkt"
155 expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:0\n"
156}
157