Commit 4abcaa49 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add support for testing HA-proxy

Also a trivial coverage tes which runs if haproxy is in $PATH.

Submitted by:   Frederic Lecaille <flecaille@haproxy.com>
parent 39d6244a
......@@ -33,6 +33,7 @@ varnishtest_SOURCES = \
vtc.c \
vtc_barrier.c \
vtc_client.c \
vtc_haproxy.c \
vtc_h2_dectbl.h \
vtc_h2_enctbl.h \
vtc_h2_hpack.c \
......
......@@ -34,7 +34,7 @@ CMD(client)
CMD(delay)
CMD(err_shell)
CMD(feature)
//CMD(haproxy)
CMD(haproxy)
CMD(logexpect)
CMD(process)
CMD(server)
......
......@@ -27,6 +27,7 @@
*
*/
VTC_PROG(haproxy)
VTC_PROG(varnishadm)
VTC_PROG(varnishd)
VTC_PROG(varnishhist)
......
......@@ -21,6 +21,7 @@ Naming scheme
id ~ ^e --> ESI tests
id ~ ^f --> Security related tests
id ~ ^g --> GZIP tests
id ~ ^h --> HAproxy tests
id ~ ^j --> JAIL tests
id ~ ^l --> VSL tests
id ~ ^m --> VMOD tests excluding director
......
varnishtest "Basic HAproxy test"
feature ignore_unknown_macro
feature cmd {haproxy --version 2>&1 | grep -q 'HA-Proxy version'}
server s1 {
rxreq
txresp -body "s1 >>> Hello world!"
} -start
haproxy h1 -arg "-d" -conf {
defaults
mode http
timeout connect 5s
timeout server 30s
timeout client 30s
backend be1
server srv1 ${s1_addr}:${s1_port}
frontend http1
use_backend be1
bind "fd@${fe1}"
} -start
client c1 -connect ${h1_fe1_sock} {
txreq -url "/"
rxresp
expect resp.status == 200
expect resp.body == "s1 >>> Hello world!"
} -run
This diff is collapsed.
......@@ -160,14 +160,15 @@ vtc_wait4(struct vtclog *vl, long pid,
if (r < 0)
vtc_fatal(vl, "wait4 failed on pid %ld: %s",
pid, strerror(errno));
vtc_log(vl, 2, "WAIT4 pid=%ld r=%d status=0x%04x (user %.6f sys %.6f)",
pid, r, status,
assert(r == pid);
vtc_log(vl, 2, "WAIT4 pid=%ld status=0x%04x (user %.6f sys %.6f)",
pid, status,
ru.ru_utime.tv_sec + 1e-6 * ru.ru_utime.tv_usec,
ru.ru_stime.tv_sec + 1e-6 * ru.ru_stime.tv_usec
);
if (WIFEXITED(status) && expect_signal <= 0 &&
(WEXITSTATUS(status) == expect_status))
WEXITSTATUS(status) == expect_status)
return;
if (expect_signal < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment