[master] 78e7155 Test the proxy related VSL tags

Federico G. Schwindt fgsch at lodoss.net
Wed Jan 24 21:56:07 UTC 2018


commit 78e715538f44927427e31cc1f1dcd1bdf8f3ea4d
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Wed Jan 24 21:54:15 2018 +0000

    Test the proxy related VSL tags

diff --git a/bin/varnishtest/tests/o00000.vtc b/bin/varnishtest/tests/o00000.vtc
index 5bd0a12..931238e 100644
--- a/bin/varnishtest/tests/o00000.vtc
+++ b/bin/varnishtest/tests/o00000.vtc
@@ -30,10 +30,26 @@ varnish v1 -proto "PROXY" -vcl+backend {
 	}
 } -start
 
+logexpect l1 -v v1 {
+	expect * 1002	ProxyGarbage	"PROXY1: Too few fields"
+	expect * 1003	ProxyGarbage	"PROXY1: Too many fields"
+	expect * 1004	ProxyGarbage	"PROXY1: Wrong TCP\\[46\\] field"
+	expect * 1005	ProxyGarbage	"PROXY1: Cannot resolve source address \\(nodename nor servname provided, or not known\\)"
+	expect * 1007	ProxyGarbage	"PROXY1: Cannot resolve destination address \\(nodename nor servname provided, or not known\\)"
+	expect * 1013	ProxyGarbage	"PROXY1: TCP4 got wrong protocol \\(30\\)"
+	expect * 1014	ProxyGarbage	"PROXY1: TCP6 got wrong protocol \\(2\\)"
+	expect * 1015	Proxy		"1 1.2.3.4 1234 5.6.7.8 5678"
+	expect * 1018	Proxy		"1 1:f::2 1234 5:a::8 5678"
+	expect * 1021	Proxy		"1 1:f::3 1234 5:a::8 5678"
+	expect * 1025	ProxyGarbage	"PROXY1: Too many fields"
+	expect * 1026	ProxyGarbage	"PROXY1: Too many fields"
+} -start
+
 client c1 {
 	send "XYZ\r\n"
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -41,6 +57,7 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -48,6 +65,7 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -55,6 +73,7 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -62,6 +81,7 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -69,6 +89,7 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -76,6 +97,7 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -83,6 +105,7 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -90,6 +113,7 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -97,6 +121,7 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -104,6 +129,7 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -111,6 +137,7 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -118,6 +145,7 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -125,6 +153,7 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -132,12 +161,8 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
-delay .1
 
-logexpect l1 -v v1 {
-	expect * *	ReqStart	"1.2.3.4 1234"
-	expect * *	ReqStart	"1:f::2 1234"
-} -start
+delay .1
 
 # Finally try something which works...
 client c1 -proxy1 "1.2.3.4:1234 5.6.7.8:5678" {
@@ -153,6 +178,7 @@ client c1 -proxy1 "1.2.3.4:1234 5.6.7.8:5678" {
 	expect resp.http.ri != "1.2.3.4"
 	expect resp.http.rp != "1234"
 } -run
+
 delay .1
 
 client c1 -proxy1 "[1:f::2]:1234 [5:a::8]:5678" {
@@ -168,9 +194,8 @@ client c1 -proxy1 "[1:f::2]:1234 [5:a::8]:5678" {
 	expect resp.http.ri != "1:f::2"
 	expect resp.http.rp != "1234"
 } -run
-delay .1
 
-logexpect l1 -wait
+delay .1
 
 # Try with appended request (See also: #1728)
 client c2 {
@@ -184,6 +209,7 @@ client c2 {
 	send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678\n"
 	expect_close
 } -run
+
 delay .1
 
 # Malformed, too long (106)
@@ -192,6 +218,7 @@ client c2 {
 	send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678                                                                     \r\n"
 	expect_close
 } -run
+
 delay .1
 
 # Malformed, too long (107)
@@ -200,6 +227,7 @@ client c2 {
 	send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678                                                                      \r\n"
 	expect_close
 } -run
+
 delay .1
 
 # Malformed, too long (108)
@@ -208,4 +236,7 @@ client c2 {
 	send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678                                                                       \r\n"
 	expect_close
 } -run
+
 delay .1
+
+logexpect l1 -wait
diff --git a/bin/varnishtest/tests/o00001.vtc b/bin/varnishtest/tests/o00001.vtc
index 02ff279..ae6e388 100644
--- a/bin/varnishtest/tests/o00001.vtc
+++ b/bin/varnishtest/tests/o00001.vtc
@@ -40,6 +40,17 @@ varnish v1 -proto "PROXY" -vcl+backend {
 	}
 } -start
 
+logexpect l1 -v v1 -g raw {
+	expect * 1000	Proxy		"2 local local local local"
+	expect * 1003	ProxyGarbage	"PROXY2: bad command \\(2\\)"
+	expect * 1004	ProxyGarbage	"PROXY2: Ignoring UNSPEC\\|UNSPEC addresses"
+	expect * 1006	ProxyGarbage	"PROXY2: Ignoring unsupported protocol \\(0x99\\)"
+	expect * 1008	ProxyGarbage	"PROXY2: Ignoring short IPv4 addresses \\(11\\)"
+	expect * 1010	ProxyGarbage	"PROXY2: Ignoring short IPv6 addresses \\(35\\)"
+	expect * 1012	Proxy		"2 1.2.3.4 2314 5.6.7.8 2828"
+	expect * 1015	Proxy		"2 102:304:506::d0e:f10 2314 8182:8384:8586::8d8e:8f80 2828"
+} -start
+
 client c1 {
 	# LOCAL command
 	sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a"
@@ -51,6 +62,7 @@ client c1 {
 	expect resp.http.sp == "${v1_port}"
 	expect resp.http.ci == "${localhost}"
 } -run
+
 delay .1
 
 client c1 {
@@ -60,6 +72,7 @@ client c1 {
 	timeout 8
 	expect_close
 } -run
+
 delay .1
 
 client c1 {
@@ -73,6 +86,7 @@ client c1 {
 	expect resp.http.sp == "${v1_port}"
 	expect resp.http.ci == "${localhost}"
 } -run
+
 delay .1
 
 client c1 {
@@ -86,6 +100,7 @@ client c1 {
 	expect resp.http.sp == "${v1_port}"
 	expect resp.http.ci == "${localhost}"
 } -run
+
 delay .1
 
 client c1 {
@@ -100,6 +115,7 @@ client c1 {
 	expect resp.http.sp == "${v1_port}"
 	expect resp.http.ci == "${localhost}"
 } -run
+
 delay .1
 
 client c1 {
@@ -136,6 +152,7 @@ client c1 -proxy2 "1.2.3.4:2314 5.6.7.8:2828" {
 	expect resp.http.lp == "${v1_port}"
 	expect resp.http.ri != "1.2.3.4"
 } -run
+
 delay .1
 
 # good IPv6
@@ -155,4 +172,7 @@ client c1 \
 	expect resp.http.lp == "${v1_port}"
 	expect resp.http.ri != "102:304:506::d0e:f10"
 } -run
+
 delay .1
+
+logexpect l1 -wait


More information about the varnish-commit mailing list