blob: b145ac862960c959be83c8f5110870f41a2962cc [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
10 timeout client 1s
11 timeout connect 1s
12 timeout server 1s
13
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
Frédéric Lécaille4d789482019-03-18 14:08:46 +010033 timeout client 1s
34 timeout connect 1s
35 timeout server 1s
36
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
Frédéric Lécaille4d789482019-03-18 14:08:46 +010055 timeout client 1s
56 timeout connect 1s
57 timeout server 1s
58
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
Frédéric Lécaille4d789482019-03-18 14:08:46 +010077 timeout client 1s
78 timeout connect 1s
79 timeout server 1s
80
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
118delay 0.2
119haproxy h2 -start
120delay 0.2
121haproxy h3 -start
122delay 0.2
123haproxy h4 -start
124delay 0.2
125
126client c1 -wait
127client c2 -wait
128client c3 -wait
129client c4 -wait
130
131delay 2
132
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