On 06/19/2018 10:18 AM, Willy Tarreau wrote:
On Mon, Jun 18, 2018 at 07:50:38PM +0200, Frederic Lecaille wrote:
Hello,
Here is a simple patch to add a Makefile target to run all "*.vtc"
regression testing files found in 'reg-tests' directory.
(...)
Thank you very much for this, Fred! I hope this will ignite a long
series of such tests. It may be useful to add a README in the reg-tests
directory indicating how to install varnishtest (especially the version
compatible with haproxy), and probably suggest contributing new tests
in the CONTRIBUTING file to encourage the practice.
Willy
Here is a few more reg testing files with a special one for Olivier (see
reg-tests/seamless-reload/h0.vtc).
Fred.
>From a95e9c2caf10e2d6393b6ba38269e0afdfc71d64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?=
Date: Wed, 20 Jun 2018 07:26:44 +0200
Subject: [PATCH] MINOR: reg-tests: Add a few regression testing files.
---
reg-tests/log/h0.vtc | 62 ++
reg-tests/seamless-reload/h0.vtc | 43
reg-tests/spoe/h0.vtc| 18 ++
reg-tests/ssl/README | 2 ++
reg-tests/ssl/common.pem | 65
reg-tests/ssl/h0.vtc | 48 ++
6 files changed, 238 insertions(+)
create mode 100644 reg-tests/log/h0.vtc
create mode 100644 reg-tests/seamless-reload/h0.vtc
create mode 100644 reg-tests/spoe/h0.vtc
create mode 100644 reg-tests/ssl/README
create mode 100644 reg-tests/ssl/common.pem
create mode 100644 reg-tests/ssl/h0.vtc
diff --git a/reg-tests/log/h0.vtc b/reg-tests/log/h0.vtc
new file mode 100644
index 000..f0ab7ea
--- /dev/null
+++ b/reg-tests/log/h0.vtc
@@ -0,0 +1,62 @@
+# commit d02286d
+# BUG/MINOR: log: pin the front connection when front ip/ports are logged
+#
+# Mathias Weiersmueller reported an interesting issue with logs which Lukas
+# diagnosed as dating back from commit 9b061e332 (1.5-dev9). When front
+# connection information (ip, port) are logged in TCP mode and the log is
+# emitted at the end of the connection (eg: because %B or any log tag
+# requiring LW_BYTES is set), the log is emitted after the connection is
+# closed, so the address and ports cannot be retrieved anymore.
+#
+# It could be argued that we'd make a special case of these to immediatly
+# retrieve the source and destination addresses from the connection, but it
+# seems cleaner to simply pin the front connection, marking it "tracked" by
+# adding the LW_XPRT flag to mention that we'll need some of these elements
+# at the last moment. Only LW_FRTIP and LW_CLIP are affected. Note that after
+# this change, LW_FRTIP could simply be removed as it's not used anywhere.
+#
+# Note that the problem doesn't happen when using %[src] or %[dst] since
+# all sample expressions set LW_XPRT.
+
+varnishtest "Wrong ip/port logging"
+feature ignore_unknown_macro
+
+server s1 {
+rxreq
+txresp
+} -start
+
+syslog Slg_1 -level notice {
+recv
+recv
+recv info
+expect ~ \"dip\":\"${h1_fe_1_addr}\",\"dport\":\"${h1_fe_1_port}.*\"ts\":\"cD\",\"
+} -start
+
+haproxy h1 -conf {
+global
+log ${Slg_1_addr}:${Slg_1_port} local0
+
+defaults
+log global
+timeout connect 3000
+timeout client 5
+timeout server 1
+
+frontend fe1
+bind "fd@${fe_1}"
+mode tcp
+log-format {\"dip\":\"%fi\",\"dport\":\"%fp\",\"c_ip\":\"%ci\",\"c_port\":\"%cp\",\"fe_name\":\"%ft\",\"be_name\":\"%b\",\"s_name\":\"%s\",\"ts\":\"%ts\",\"bytes_read\":\"%B\"}
+default_backendbe_app
+
+backend be_app
+server app1 ${s1_addr}:${s1_port} check
+} -start
+
+client c1 -connect ${h1_fe_1_sock} {
+txreq -url "/"
+delay 0.02
+} -run
+
+syslog Slg_1 -wait
+
diff --git a/reg-tests/seamless-reload/h0.vtc b/reg-tests/seamless-reload/h0.vtc
new file mode 100644
index 000..498e0c6
--- /dev/null
+++ b/reg-tests/seamless-reload/h0.vtc
@@ -0,0 +1,43 @@
+# commit b4dd15b
+# BUG/MINOR: unix: Make sure we can transfer abns sockets on seamless reload.
+#
+# When checking if a socket we got from the parent is suitable for a listener,
+# we just checked that the path matched sockname.tmp, however this is
+# unsuitable for abns sockets, where we don't have to create a temporary
+# file and rename it later.
+# To detect that, check that the first character of the sun_path is 0 for
+# both, and if so, that &sun_path[1] is the same too.
+
+varnishtest "Seamless reload issue with abns sockets"
+feature ignore_unknown_macro
+
+hap