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