blob: 035abbe6c161e8be2aa2e6d22de43e1eae12daba [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écailleffe30f72019-04-19 11:20:52 +02003#REQUIRE_VERSION=2.0
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +01004feature ignore_unknown_macro
5
Frédéric Lécailledc1a3bd2019-03-29 15:07:24 +01006#REGTEST_TYPE=slow
7
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +01008haproxy h1 -arg "-L A" -conf {
9 defaults
10 timeout client 1s
11 timeout connect 1s
12 timeout server 1s
13
14 backend stkt
15 stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
16
17 peers peers
18 default-server ssl crt ${testdir}/common.pem verify none
19 bind "fd@${A}" ssl crt ${testdir}/common.pem
20 server A
21 server B ${h2_B_addr}:${h2_B_port}
22 server C ${h3_C_addr}:${h3_C_port}
23 server D ${h4_D_addr}:${h4_D_port}
24
25 frontend fe
26 bind "fd@${fe}"
Christopher Faulet1448d3a2019-10-14 16:10:52 +020027 tcp-request inspect-delay 100ms
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010028 tcp-request content track-sc0 url table stkt
29 tcp-request content sc-inc-gpc0(0)
30}
31
32haproxy h2 -arg "-L B" -conf {
33 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020034 mode http
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010035 timeout client 1s
36 timeout connect 1s
37 timeout server 1s
38
39 backend stkt
40 stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
41
42 peers peers
43 default-server ssl crt ${testdir}/common.pem verify none
44 bind "fd@${B}" ssl crt ${testdir}/common.pem
45 server A ${h1_A_addr}:${h1_A_port}
46 server B
47 server C ${h3_C_addr}:${h3_C_port}
48 server D ${h4_D_addr}:${h4_D_port}
49
50 frontend fe
51 bind "fd@${fe}"
52 http-request track-sc0 url table stkt
53 http-request sc-inc-gpc0(0)
54}
55
56haproxy h3 -arg "-L C" -conf {
57 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020058 mode http
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010059 timeout client 1s
60 timeout connect 1s
61 timeout server 1s
62
63 backend stkt
64 stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
65
66 peers peers
67 default-server ssl crt ${testdir}/common.pem verify none
68 bind "fd@${C}" ssl crt ${testdir}/common.pem
69 server A ${h1_A_addr}:${h1_A_port}
70 server B ${h2_B_addr}:${h2_B_port}
71 server C
72 server D ${h4_D_addr}:${h4_D_port}
73
74 frontend fe
75 bind "fd@${fe}"
76 http-request track-sc0 url table stkt
77 http-request sc-inc-gpc0(0)
78}
79
80haproxy h4 -arg "-L D" -conf {
81 defaults
Christopher Faulet1448d3a2019-10-14 16:10:52 +020082 mode http
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +010083 timeout client 1s
84 timeout connect 1s
85 timeout server 1s
86
87 backend stkt
88 stick-table type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000) peers peers
89
90 peers peers
91 bind "fd@${D}"
92 server A ${h1_A_addr}:${h1_A_port}
93 server B ${h2_B_addr}:${h2_B_port}
94 server C ${h3_C_addr}:${h3_C_port}
95 server D
96
97 frontend fe
98 bind "fd@${fe}"
99 http-request track-sc0 url table stkt
100 http-request sc-inc-gpc0(0)
101}
102
103client c1 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200104 txreq -url "/c1_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100105 expect_close
106} -start
107
108client c2 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200109 txreq -url "/c2_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100110 expect_close
111} -start
112
113client c3 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200114 txreq -url "/c3_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100115 expect_close
116} -start
117
118client c4 -connect ${h1_fe_sock} {
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200119 txreq -url "/c4_client"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100120 expect_close
121} -start
122
123haproxy h1 -start
124delay 0.2
125haproxy h2 -start
126delay 0.2
127haproxy h3 -start
128delay 0.2
129haproxy h4 -start
130delay 0.2
131
132client c1 -wait
133client c2 -wait
134client c3 -wait
135client c4 -wait
136
137delay 2
138
139haproxy h1 -cli {
140 send "show table stkt"
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200141 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 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100142}
143
144haproxy h2 -cli {
145 send "show table stkt"
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200146 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 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100147}
148
149haproxy h3 -cli {
150 send "show table stkt"
Christopher Faulet1448d3a2019-10-14 16:10:52 +0200151 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 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
Frédéric Lécaille3c4fb952019-01-17 16:15:33 +0100152}
153
154haproxy h4 -cli {
155 send "show table stkt"
156 expect ~ "# table: stkt, type: string, size:1048[0-9]{4}, used:0\n"
157}
158