blob: 6a28eb1f4baf9506c2f642c103676e0c0006597e [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}"
25 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
31 timeout client 1s
32 timeout connect 1s
33 timeout server 1s
34
35 peers peers
36 table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
37 default-server ssl crt ${testdir}/common.pem verify none
38 bind "fd@${B}" ssl crt ${testdir}/common.pem
39 server A ${h1_A_addr}:${h1_A_port}
40 server B
41 server C ${h3_C_addr}:${h3_C_port}
42 server D ${h4_D_addr}:${h4_D_port}
43
44 frontend fe
45 bind "fd@${fe}"
46 http-request track-sc0 url table peers/stkt
47 http-request sc-inc-gpc0(0)
48}
49
50haproxy h3 -arg "-L C" -conf {
51 defaults
52 timeout client 1s
53 timeout connect 1s
54 timeout server 1s
55
56 peers peers
57 table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
58 default-server ssl crt ${testdir}/common.pem verify none
59 bind "fd@${C}" ssl crt ${testdir}/common.pem
60 server A ${h1_A_addr}:${h1_A_port}
61 server B ${h2_B_addr}:${h2_B_port}
62 server C
63 server D ${h4_D_addr}:${h4_D_port}
64
65 frontend fe
66 bind "fd@${fe}"
67 http-request track-sc0 url table peers/stkt
68 http-request sc-inc-gpc0(0)
69}
70
71haproxy h4 -arg "-L D" -conf {
72 defaults
73 timeout client 1s
74 timeout connect 1s
75 timeout server 1s
76
77 backend stkt
78
79 peers peers
80 table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
81 bind "fd@${D}"
82 server A ${h1_A_addr}:${h1_A_port}
83 server B ${h2_B_addr}:${h2_B_port}
84 server C ${h3_C_addr}:${h3_C_port}
85 server D
86
87 frontend fe
88 bind "fd@${fe}"
89 http-request track-sc0 url table peers/stkt
90 http-request sc-inc-gpc0(0)
91}
92
93client c1 -connect ${h1_fe_sock} {
94 txreq -url "c1_client"
95 expect_close
96} -start
97
98client c2 -connect ${h1_fe_sock} {
99 txreq -url "c2_client"
100 expect_close
101} -start
102
103client c3 -connect ${h1_fe_sock} {
104 txreq -url "c3_client"
105 expect_close
106} -start
107
108client c4 -connect ${h1_fe_sock} {
109 txreq -url "c4_client"
110 expect_close
111} -start
112
113haproxy h1 -start
114delay 0.2
115haproxy h2 -start
116delay 0.2
117haproxy h3 -start
118delay 0.2
119haproxy h4 -start
120delay 0.2
121
122client c1 -wait
123client c2 -wait
124client c3 -wait
125client c4 -wait
126
127delay 2
128
129haproxy h1 -cli {
130 send "show table peers/stkt"
131 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}"
132}
133
134haproxy h2 -cli {
135 send "show table peers/stkt"
136 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}"
137}
138
139haproxy h3 -cli {
140 send "show table peers/stkt"
141 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}"
142}
143
144haproxy h4 -cli {
145 send "show table peers/stkt"
146 expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:0\n"
147}
148