blob: 531e84ea5f6b75d645585990b873c2be0e94b2c2 [file] [log] [blame]
Willy Tarreauf8462aa2020-09-23 09:02:13 +02001vtest "Test for balance roundrobin"
2feature ignore_unknown_macro
3
4server s1 {
5 rxreq
6 txresp -hdr "Server: s1"
7} -repeat 2 -start
8
9server s2 {
10 rxreq
11 txresp -hdr "Server: s2"
12} -repeat 2 -start
13
14server s3 {
15 rxreq
16 txresp -hdr "Server: s3"
17} -repeat 2 -start
18
19server s4 {
20 rxreq
21 txresp -hdr "Server: s4"
22} -repeat 2 -start
23
24haproxy h1 -arg "-L A" -conf {
25 defaults
26 mode http
27 timeout server 1s
28 timeout connect 1s
29 timeout client 1s
30
31 listen px
32 bind "fd@${px}"
33 balance roundrobin
34 server srv1 ${s1_addr}:${s1_port}
35 server srv2 ${s2_addr}:${s2_port}
36 server srv3 ${s3_addr}:${s3_port}
37 server srv4 ${s4_addr}:${s4_port}
38} -start
39
40client c1 -connect ${h1_px_sock} {
41 txreq -url "/url1"
42 rxresp
43 expect resp.status == 200
44 expect resp.http.Server ~ s1
45} -run
46
47client c2 -connect ${h1_px_sock} {
48 txreq -url "/url1"
49 rxresp
50 expect resp.status == 200
51 expect resp.http.Server ~ s2
52} -run
53
54client c3 -connect ${h1_px_sock} {
55 txreq -url "/url1"
56 rxresp
57 expect resp.status == 200
58 expect resp.http.Server ~ s3
59} -run
60
61client c4 -connect ${h1_px_sock} {
62 txreq -url "/url1"
63 rxresp
64 expect resp.status == 200
65 expect resp.http.Server ~ s4
66} -run
67
68client c5 -connect ${h1_px_sock} {
69 txreq -url "/url1"
70 rxresp
71 expect resp.status == 200
72 expect resp.http.Server ~ s1
73} -run