blob: 23c9a9afd1dc38de54b441ad73a286e077ce8342 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
vtest "A reg test for stickiness"
feature ignore_unknown_macro
#REGTEST_TYPE=slow
# The aim of this test is to check that "stick on" rules
# do the job they are supposed to do.
# If we remove one of the "stick on" rule, this script fails.
server s_not_used_1 {}
server s_not_used_2 {}
server s_not_used_3 {}
server s_not_used_4 {}
server s_not_used_5 {}
server s_not_used_6 {}
server s_not_used_7 {}
server s_not_used_8 {}
server s_not_used_9 {}
server s_not_used_10 {}
server s_not_used_11 {}
server s_not_used_12 {}
# h1/be1 servers
server s1 {
rxreq
txresp -hdr "Server: be1/s1"
} -repeat 2 -start
server s2 {
rxreq
txresp -hdr "Server: be1/s2"
} -repeat 2 -start
# h1/be2 servers
server s3 {
rxreq
txresp -hdr "Server: be2/s3"
} -repeat 2 -start
server s4 {
rxreq
txresp -hdr "Server: be2/s4"
} -repeat 2 -start
haproxy h1 -arg "-L A" -conf {
defaults
mode http
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
log stdout format raw local0 debug
peers mypeers
bind "fd@${A}"
server A
server B ${h2_B_addr}:${h2_B_port}
table mytable type string size 10m
backend be1
balance roundrobin
stick on urlp(client) table mypeers/mytable
server srv1 ${s1_addr}:${s1_port}
server srv2 ${s2_addr}:${s2_port}
backend be2
balance roundrobin
stick on urlp(client) table mypeers/mytable
server s_not_used_1 ${s_not_used_1_addr}:${s_not_used_1_port}
server s_not_used_2 ${s_not_used_2_addr}:${s_not_used_2_port}
server s_not_used_3 ${s_not_used_3_addr}:${s_not_used_3_port}
server srv2 ${s4_addr}:${s4_port}
server s_not_used_4 ${s_not_used_4_addr}:${s_not_used_4_port}
server s_not_used_5 ${s_not_used_5_addr}:${s_not_used_5_port}
server s_not_used_6 ${s_not_used_6_addr}:${s_not_used_6_port}
server srv1 ${s3_addr}:${s3_port}
frontend fe
acl acl_be1 path_beg /be1
acl acl_be2 path_beg /be2
use_backend be1 if acl_be1
use_backend be2 if acl_be2
bind "fd@${fe}"
}
# h2/be1 servers
server s5 {
rxreq
txresp -hdr "Server: be1/s5"
} -repeat 2 -start
server s6 {
rxreq
txresp -hdr "Server: be1/s6"
} -repeat 2 -start
# h2/be2 servers
server s7 {
rxreq
txresp -hdr "Server: be2/s7"
} -repeat 2 -start
server s8 {
rxreq
txresp -hdr "Server: be2/s8"
} -repeat 2 -start
haproxy h2 -arg "-L B" -conf {
defaults
mode http
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
peers mypeers
bind "fd@${B}"
server A ${h1_A_addr}:${h1_A_port}
server B
table mytable type string size 10m
backend be1
balance roundrobin
stick on urlp(client) table mypeers/mytable
server s_not_used_7 ${s_not_used_7_addr}:${s_not_used_7_port}
server s_not_used_8 ${s_not_used_8_addr}:${s_not_used_8_port}
server s_not_used_9 ${s_not_used_9_addr}:${s_not_used_9_port}
server srv1 ${s5_addr}:${s5_port}
server s_not_used_10 ${s_not_used_10_addr}:${s_not_used_10_port}
server s_not_used_11 ${s_not_used_11_addr}:${s_not_used_11_port}
server s_not_used_12 ${s_not_used_12_addr}:${s_not_used_12_port}
server srv2 ${s6_addr}:${s6_port}
backend be2
balance roundrobin
stick on urlp(client) table mypeers/mytable
server s_not_used_1 ${s_not_used_1_addr}:${s_not_used_1_port}
server s_not_used_2 ${s_not_used_2_addr}:${s_not_used_2_port}
server s_not_used_3 ${s_not_used_3_addr}:${s_not_used_3_port}
server s_not_used_4 ${s_not_used_4_addr}:${s_not_used_4_port}
server s_not_used_5 ${s_not_used_5_addr}:${s_not_used_5_port}
server s_not_used_6 ${s_not_used_6_addr}:${s_not_used_6_port}
server srv1 ${s7_addr}:${s7_port}
server srv2 ${s8_addr}:${s8_port}
frontend fe
acl acl_be1 path_beg /be1
acl acl_be2 path_beg /be2
use_backend be1 if acl_be1
use_backend be2 if acl_be2
bind "fd@${fe}"
}
haproxy h1 -start
delay 0.2
haproxy h2 -start
delay 2
client cx -connect ${h1_fe_sock} {
txreq -url "/be1?client=c1"
rxresp
expect resp.status == 200
expect resp.http.Server ~ be1/s1
} -repeat 2 -run
haproxy h1 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
haproxy h2 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
client cy -connect ${h1_fe_sock} {
txreq -url "/be2?client=c1"
rxresp
expect resp.status == 200
expect resp.http.Server ~ be2/s3
} -repeat 2 -run
haproxy h1 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
haproxy h2 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
client cx -connect ${h2_fe_sock} {
txreq -url "/be1?client=c1"
rxresp
expect resp.status == 200
expect resp.http.Server ~ be1/s5
} -repeat 2 -run
haproxy h1 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
haproxy h2 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
client cy -connect ${h2_fe_sock} {
txreq -url "/be2?client=c1"
rxresp
expect resp.status == 200
expect resp.http.Server ~ be2/s7
} -repeat 2 -run
haproxy h1 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
haproxy h2 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
client cX -connect ${h1_fe_sock} {
txreq -url "/be1?client=c2"
rxresp
expect resp.status == 200
expect resp.http.Server ~ be1/s2
} -repeat 2 -run
haproxy h1 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
haproxy h2 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
client cY -connect ${h1_fe_sock} {
txreq -url "/be2?client=c2"
rxresp
expect resp.status == 200
expect resp.http.Server ~ be2/s4
} -repeat 2 -run
haproxy h1 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
haproxy h2 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
client cX -connect ${h2_fe_sock} {
txreq -url "/be1?client=c2"
rxresp
expect resp.status == 200
expect resp.http.Server ~ be1/s6
} -repeat 2 -run
haproxy h1 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
haproxy h2 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
client cY -connect ${h2_fe_sock} {
txreq -url "/be2?client=c2"
rxresp
expect resp.status == 200
expect resp.http.Server ~ be2/s8
} -repeat 2 -run
haproxy h1 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
haproxy h2 -cli {
send "show table mypeers/mytable"
expect ~ .*
}
|