Hi List,
I'm trying to make a reg-test to verify some behavior for
server-state-file..
But i cant figure out why it fails at random places if ran like 10 times
in a row, can someone provide a clue? I've tried playing with 'delay
0.1' settings in between commands.. but that doesn't fix all..
Ive ran it against "HA-Proxy version 1.9-dev1-26e1a8f 2018/09/12"..
varnishtest -l -n 10 -t 5 -k ./seamless-reload/b00001-state.vtc
Any of the following error might pop up if ran like 30 times in a row..
---- h1 0.4 CLI expect failed ~ "1 srv1 127.0.0.1 2"
---- h1 0.4 CLI expect failed ~ "2 srv2 127.0.0.3 0"
---- c5 0.4 EXPECT resp.status (503) == "200" failed
---- c6 0.5 EXPECT resp.status (200) == "503" failed
Above errors appear randomly.. sometimes 9 out of 10 tests pass
sometimes less..
---- h1 0.9 CLI expect failed ~ " - 33 -" << The port change not
being picked up is a 'known bug' afaik.
Am i writing the test in a wrong way? Should i wait/lock/check something
after some steps and if so how?
Also its taking like a second or more to complete. is there a way to
make it faster, without loosing predictability?
Regards,
PiBa-NL (Pieter)
# Checks that changes to state are being preserved with statefile unless the
config changes
varnishtest "Seamless reload issue with abns sockets"
feature ignore_unknown_macro
server s1 {
rxreq
txresp
} -start
server s2 {
rxreq
txresp
} -repeat 23 -start
haproxy h1 -W -conf {
global
stats socket ${tmpdir}/h1/stats level admin expose-fd listeners
server-state-file ${tmpdir}/h1/hap_state2
defaults
load-server-state-from-file global
default-server init-addr last,libc,none
mode http
log global
option httplog
timeout connect 150ms
timeout client 2s
timeout server 2s
listen testme
bind "fd@${testme}"
server test_abns_server /tmp/wpproc1 send-proxy-v2
frontend test_abns
bind /tmp/wpproc1 accept-proxy
#http-request deny deny_status 200
default_backend test_be
backend test_be
server srv1 127.0.0.1:8080 weight 151
server srv2 localhost:8081 weight 150 backup
} -start
shell {
sed -i "" "s,127.0.0.1:8080,${s1_addr}:${s1_port}," ${tmpdir}/h1/cfg
kill -USR2 $(cat ${tmpdir}/h1/pid)
}
delay 0.1
haproxy h1 -cli {
send "show servers state"
expect ~ "srv1 127.0.0.1 2"
send "show servers state"
expect ~ "srv2 127.0.0.1 2"
}
client c1 -connect ${h1_testme_sock} {
txreq -url "/"
rxresp
expect resp.status == 200
} -run
shell {
sed -i "" "s,${s1_addr}:${s1_port},${s2_addr}:${s2_port}," ${tmpdir}/h1/cfg
kill -USR2 $(cat ${tmpdir}/h1/pid)
}
delay 0.1
client c2 -connect ${h1_testme_sock} {
txreq -url "/"
rxresp
expect resp.status == 200
} -run
haproxy h1 -cli {
send "show servers state"
expect ~ "srv1 127.0.0.1 2"
send "show servers state"
expect ~ "srv2 127.0.0.1 2"
send "set server test_be/srv1 state maint"
expect ~ ""
send "set server test_be/srv2 state maint"
expect ~ ""
}
haproxy h1 -cli {
send "show servers state"
expect ~ "srv1 127.0.0.1 0"
send "show servers state"
expect ~ "2 srv2 127.0.0.1 0"
}
client c3 -connect ${h1_testme_sock} {
txreq -url "/"
rxresp
expect resp.status == 503
} -run
haproxy h1 -cli {
send "set server test_be/srv2 addr 127.0.0.2"
expect ~ ""
send "show servers state"
expect ~ "srv2 127.0.0.2"
}
shell {
echo "show servers state" | socat stdio ${tmpdir}/h1/stats >
${tmpdir}/h1/hap_state2
}
shell {
kill -USR2 $(cat ${tmpdir}/h1/pid)
}
delay 0.1
haproxy h1 -cli {
send "show servers state"
expect ~ "2 srv2 127.0.0.2"
send "set server test_be/srv2 addr 127.0.0.3"
expect ~ ""
send "show servers state"
expect ~ "srv2 127.0.0.3"
}
client c4 -connect ${h1_testme_sock} {
txreq -url "/"
rxresp
expect resp.status == 503
} -run
haproxy h1 -cli {
send "set server test_be/srv1 state ready"
expect ~ ""
send "set server test_be/srv2 state maint"
expect ~ ""
send "show servers state"
expect ~ "1 srv1 127.0.0.1 2"
send "show servers state"
expect ~ "2 srv2 127.0.0.3 0"
}
client c5 -connect ${h1_testme_sock} {
txreq -url "/"
rxresp
expect resp.status == 200
} -repeat 1 -run
haproxy h1 -cli {
send "set server test_be/srv1 state maint"
expect ~ ""
}
shell {
echo "show servers state" | socat stdio ${tmpdir}/h1/stats >
${tmpdir}/h1/hap_state2
kill -USR2 $(cat ${tmpdir}/h1/pid)
}
delay 0.1
client c6 -connect ${h1_testme_sock} {
txreq -url "/"
rxresp
expect resp.status == 503
} -run
# A change in configuration should 'overwrite' what the state file contains,
changing server from s2_addr to 127.0.0.4
shell {
sed -i "" "s,${s2_addr}:${s2_port},127.0.0.4:${s2_port}," ${tmpdir}/h1/cfg
echo "show servers state" | socat stdio ${tmpdir}/h1/stats >
${tmpdir}/h1/hap_state2
kill -USR2 $(cat ${tmpdir}/h1/pid)
}
delay 0.2
haproxy h1 -cli {
send "show servers state"
# the changed port 33 should become the actual port of the server
expect ~ " srv1 127.0.0.4 "
}
# A change in configuration should 'overwrite' what the state file contains,
changing port from :s2_port to :33
shell {
sed -i "" "s,127.0.0.4:${s2_port},127.0.0.4:33," ${tmpdir}/h1/cfg
echo "show servers state" | socat stdio ${tmpdir}/h1/stats >
${tmpdir}/h1/hap_state2
kill -USR2 $(cat ${tmpdir}/h1/pid)
}
delay 0.2
haproxy h1 -cli {
send "show servers state"
# the changed port 33 should become the actual port of the server
expect ~ " - 33 -"
}