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
|
varnishtest "Basic log load-balancing test"
feature ignore_unknown_macro
barrier b1 cond 2 -cyclic
barrier b2 cond 2 -cyclic
barrier b3 cond 2 -cyclic
barrier b4 cond 2 -cyclic
barrier b5 cond 2 -cyclic
server s1 {
rxreq
txresp
} -repeat 500 -start
syslog Slg_1 -level info {
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c1 HTTP/1.1\""
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c2 HTTP/1.1\""
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c3 HTTP/1.1\""
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c4 HTTP/1.1\""
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c5 HTTP/1.1\""
} -repeat 50 -start
# Here are the syslog messages received by Slg_2:
syslog Slg_2 -level info {
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c6 HTTP/1.1\""
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c8 HTTP/1.1\""
} -repeat 50 -start
haproxy h1 -conf {
global
nbthread 1
defaults
mode http
option httplog
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
frontend fe1
bind "fd@${fe_1}"
log ${Slg_1_addr}:${Slg_1_port} local0
default_backend be
frontend fe2
bind "fd@${fe_2}"
log ${Slg_2_addr}:${Slg_2_port} sample 1,3:5 local0
default_backend be
backend be
server app1 ${s1_addr}:${s1_port}
} -start
# The following client are started in background and synchronized
client c1 -connect ${h1_fe_1_sock} {
txreq -url "/client_c1"
rxresp
expect resp.status == 200
barrier b1 sync
barrier b5 sync
} -repeat 50 -start
client c2 -connect ${h1_fe_1_sock} {
barrier b1 sync
txreq -url "/client_c2"
rxresp
expect resp.status == 200
barrier b2 sync
} -repeat 50 -start
client c3 -connect ${h1_fe_1_sock} {
barrier b2 sync
txreq -url "/client_c3"
rxresp
expect resp.status == 200
barrier b3 sync
} -repeat 50 -start
client c4 -connect ${h1_fe_1_sock} {
barrier b3 sync
txreq -url "/client_c4"
rxresp
expect resp.status == 200
barrier b4 sync
} -repeat 50 -start
client c5 -connect ${h1_fe_1_sock} {
barrier b4 sync
txreq -url "/client_c5"
rxresp
expect resp.status == 200
barrier b5 sync
} -repeat 50 -start
syslog Slg_1 -wait
client c1 -wait
client c2 -wait
client c3 -wait
client c4 -wait
client c5 -wait
# Same test as before but with fe2 frontend.
# The following client are started in background and synchronized
client c6 -connect ${h1_fe_2_sock} {
txreq -url "/client_c6"
rxresp
expect resp.status == 200
barrier b1 sync
barrier b5 sync
} -repeat 50 -start
client c7 -connect ${h1_fe_2_sock} {
barrier b1 sync
txreq -url "/client_c7"
rxresp
expect resp.status == 200
barrier b2 sync
} -repeat 50 -start
client c8 -connect ${h1_fe_2_sock} {
barrier b2 sync
txreq -url "/client_c8"
rxresp
expect resp.status == 200
barrier b3 sync
} -repeat 50 -start
client c9 -connect ${h1_fe_2_sock} {
barrier b3 sync
txreq -url "/client_c9"
rxresp
expect resp.status == 200
barrier b4 sync
} -repeat 50 -start
client c10 -connect ${h1_fe_2_sock} {
barrier b4 sync
txreq -url "/client_c10"
rxresp
expect resp.status == 200
barrier b5 sync
} -repeat 50 -start
syslog Slg_2 -wait
client c6 -wait
client c7 -wait
client c8 -wait
client c9 -wait
client c10 -wait
|