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