[master] 45f989ee9 Add a test to exercise closing connections on tcp_pool teardown

Poul-Henning Kamp phk at FreeBSD.org
Tue Jan 12 10:21:07 UTC 2021


commit 45f989ee923640fce50799347fc4f0a4de14f2a1
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jan 12 10:20:13 2021 +0000

    Add a test to exercise closing connections on tcp_pool teardown

diff --git a/bin/varnishtest/tests/c00102.vtc b/bin/varnishtest/tests/c00102.vtc
new file mode 100644
index 000000000..ce49e0d57
--- /dev/null
+++ b/bin/varnishtest/tests/c00102.vtc
@@ -0,0 +1,60 @@
+varnishtest "TCP pool teardown with open connection"
+
+# when c1's request has gotten to s1
+barrier b1 cond 3
+
+# when vcls have been swizzled
+barrier b2 cond 3
+
+server s1 {
+	rxreq
+	expect req.url == "/s1"
+	barrier b1 sync
+	barrier b2 sync
+	txresp -hdr "Host: s1"
+	expect_close
+} -start
+
+varnish v1 -cliok "param.set debug +vclrel"
+
+varnish v1 -vcl+backend {} -start
+
+client c1 {
+	txreq -url /s1
+	barrier b1 sync
+	barrier b2 sync
+	rxresp
+	expect resp.http.host == "s1"
+
+	txreq -url /s2
+	rxresp
+	expect resp.http.host == "s2"
+} -start
+
+barrier b1 sync
+
+server s2 {
+	rxreq
+	expect req.url == "/s2"
+	txresp -hdr "Host: s2"
+} -start
+
+varnish v1 -vcl {
+	backend b2 {
+		.host = "${s2_sock}";
+	}
+}
+
+varnish v1 -vsc LCK.tcp_pool.*
+varnish v1 -cliok "vcl.discard vcl1"
+varnish v1 -cliok "vcl.list"
+varnish v1 -vsc LCK.tcp_pool.*
+varnish v1 -expect LCK.tcp_pool.destroy == 0
+
+barrier b2 sync
+
+client c1 -wait
+varnish v1 -cliok "vcl.list"
+server s1 -wait
+varnish v1 -vsc LCK.tcp_pool.*
+varnish v1 -expect LCK.tcp_pool.destroy == 1


More information about the varnish-commit mailing list