Willy Tarreau | 1949090 | 2020-09-23 09:02:13 +0200 | [diff] [blame] | 1 | vtest "Test for balance roundrobin" |
| 2 | feature ignore_unknown_macro |
| 3 | |
| 4 | server s1 { |
| 5 | rxreq |
| 6 | txresp -hdr "Server: s1" |
| 7 | } -repeat 2 -start |
| 8 | |
| 9 | server s2 { |
| 10 | rxreq |
| 11 | txresp -hdr "Server: s2" |
| 12 | } -repeat 2 -start |
| 13 | |
| 14 | server s3 { |
| 15 | rxreq |
| 16 | txresp -hdr "Server: s3" |
| 17 | } -repeat 2 -start |
| 18 | |
| 19 | server s4 { |
| 20 | rxreq |
| 21 | txresp -hdr "Server: s4" |
| 22 | } -repeat 2 -start |
| 23 | |
| 24 | haproxy 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 | |
| 40 | client 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 | |
| 47 | client 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 | |
| 54 | client 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 | |
| 61 | client 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 | |
| 68 | client c5 -connect ${h1_px_sock} { |
| 69 | txreq -url "/url1" |
| 70 | rxresp |
| 71 | expect resp.status == 200 |
| 72 | expect resp.http.Server ~ s1 |
| 73 | } -run |