Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
b42114ed
Commit
b42114ed
authored
Sep 10, 2021
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vtc: Move vmod coverage around
To avoid mixing vmod_std coverage with the VMOD feature.
parent
10e3b177
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
54 deletions
+84
-54
m00000.vtc
bin/varnishtest/tests/m00000.vtc
+29
-37
m00001.vtc
bin/varnishtest/tests/m00001.vtc
+55
-17
No files found.
bin/varnishtest/tests/m00000.vtc
View file @
b42114ed
varnishtest "Test
std, vtc & debug vmod
"
varnishtest "Test
vmod usage and test vmods (debug & vtc)
"
server s1 {
server s1 {
rxreq
rxreq
...
@@ -14,31 +14,11 @@ varnish v1 -vcl+backend {
...
@@ -14,31 +14,11 @@ varnish v1 -vcl+backend {
import debug as dbg;
import debug as dbg;
import debug as dbg; // again
import debug as dbg; // again
sub log {
std.log("VCL" + " initiated " + "log");
std.log("01030507090b0d0f" +
"11131517191b1d1f" +
"21232527292b2d2f" +
"31333537393b3d3f" +
"41434547494b4d4f" +
"51535557595b5d5f" +
"61636567696b6d6f" +
"71737577797b7d7f" +
"81838587898b8d8f" +
"91939597999b9d9f" +
"a1a3a5a7a9abadaf" +
"b1b3b5b7b9bbbdbf" +
"c1c3c5c7c9cbcdcf" +
"d1d3d5d7d9dbdddf" +
"e1e3e5e7e9ebedef" +
"f1f3f5f7f9fbfdff");
}
sub vcl_init {
sub vcl_init {
new objx = dbg.obj();
new objx = dbg.obj();
objx.obj();
objx.obj();
dbg.vsc_new();
dbg.vsc_new();
call log
;
std.log("inside vcl_init")
;
}
}
sub vcl_synth {
sub vcl_synth {
...
@@ -66,8 +46,6 @@ varnish v1 -vcl+backend {
...
@@ -66,8 +46,6 @@ varnish v1 -vcl+backend {
}
}
sub vcl_deliver {
sub vcl_deliver {
set resp.http.foo = std.toupper(resp.http.foo);
set resp.http.bar = std.tolower(resp.http.bar);
set resp.http.who = debug.author(mithrandir);
set resp.http.who = debug.author(mithrandir);
set resp.http.really = debug.author();
set resp.http.really = debug.author();
set resp.http.when = objx.date();
set resp.http.when = objx.date();
...
@@ -77,7 +55,6 @@ varnish v1 -vcl+backend {
...
@@ -77,7 +55,6 @@ varnish v1 -vcl+backend {
debug.test_priv_vcl();
debug.test_priv_vcl();
objx.test_priv_call();
objx.test_priv_call();
objx.test_priv_vcl();
objx.test_priv_vcl();
call log;
std.syslog(8 + 7, "Somebody runs varnishtest");
std.syslog(8 + 7, "Somebody runs varnishtest");
debug.rot52(resp);
debug.rot52(resp);
}
}
...
@@ -90,8 +67,6 @@ client c1 {
...
@@ -90,8 +67,6 @@ client c1 {
rxresp
rxresp
expect resp.status == 200
expect resp.status == 200
expect resp.bodylen == "4"
expect resp.bodylen == "4"
expect resp.http.foo == "BAR"
expect resp.http.bar == "foo"
expect resp.http.who == "Tollef"
expect resp.http.who == "Tollef"
expect resp.http.really == "Poul-Henning"
expect resp.http.really == "Poul-Henning"
expect resp.http.when == "Thu, 01 Jan 1970 00:00:21 GMT"
expect resp.http.when == "Thu, 01 Jan 1970 00:00:21 GMT"
...
@@ -113,23 +88,15 @@ varnish v1 -expect DEBUG.count == 1
...
@@ -113,23 +88,15 @@ varnish v1 -expect DEBUG.count == 1
logexpect l1 -v v1 -g raw -d 1 {
logexpect l1 -v v1 -g raw -d 1 {
expect * 0 CLI {^Rd vcl.load}
expect * 0 CLI {^Rd vcl.load}
expect 0 0 VCL_Log {^VCL initiated log}
expect 0 0 VCL_Log {^inside vcl_init}
# vsl_reclen = 255b minus NUL byte (last "ff" missing)
expect 0 0 VCL_Log {^01030507090b0d0f11131517191b1d1f21232527292b2d2f31333537393b3d3f41434547494b4d4f51535557595b5d5f61636567696b6d6f71737577797b7d7f81838587898b8d8f91939597999b9d9fa1a3a5a7a9abadafb1b3b5b7b9bbbdbfc1c3c5c7c9cbcdcfd1d3d5d7d9dbdddfe1e3e5e7e9ebedeff1f3f5f7f9fbfd$}
expect 0 0 Debug {VCL_EVENT_WARM}
expect 0 0 Debug {VCL_EVENT_WARM}
expect * 1001 VCL_call {^DELIVER}
expect * 1001 VCL_call {^DELIVER}
expect 0 = RespUnset {^foo: bAr}
expect 0 = RespHeader {^foo: BAR}
expect 0 = RespUnset {^bar: fOo}
expect 0 = RespHeader {^bar: foo}
expect 0 = RespHeader {^who: Tollef}
expect 0 = RespHeader {^who: Tollef}
expect 0 = RespHeader {^really: Poul-Henning}
expect 0 = RespHeader {^really: Poul-Henning}
expect 0 = RespHeader {^when: Thu, 01 Jan 1970 00:00:21 GMT}
expect 0 = RespHeader {^when: Thu, 01 Jan 1970 00:00:21 GMT}
expect 0 = RespHeader {^what: [1-9][0-9]}
expect 0 = RespHeader {^what: [1-9][0-9]}
expect 0 = RespHeader {^not: -1}
expect 0 = RespHeader {^not: -1}
expect 0 = VCL_Log {^VCL initiated log}
expect 0 = VCL_Log {^01030507090b0d0f11131517191b1d1f21232527292b2d2f31333537393b3d3f41434547494b4d4f51535557595b5d5f61636567696b6d6f71737577797b7d7f81838587898b8d8f91939597999b9d9fa1a3a5a7a9abadafb1b3b5b7b9bbbdbfc1c3c5c7c9cbcdcfd1d3d5d7d9dbdddfe1e3e5e7e9ebedeff1f3f5f7f9fbfd$}
expect 0 = RespHeader {^Encrypted: ROT52}
expect 0 = RespHeader {^Encrypted: ROT52}
expect 0 = VCL_return {^deliver}
expect 0 = VCL_return {^deliver}
} -start
} -start
...
@@ -190,7 +157,6 @@ varnish v1 -errvcl {Failed initialization} {
...
@@ -190,7 +157,6 @@ varnish v1 -errvcl {Failed initialization} {
varnish v1 -cliok "param.set vcc_allow_inline_c on"
varnish v1 -cliok "param.set vcc_allow_inline_c on"
varnish v1 -vcl {
varnish v1 -vcl {
import std;
import vtc;
import vtc;
backend be none;
backend be none;
...
@@ -303,3 +269,29 @@ client c1 {
...
@@ -303,3 +269,29 @@ client c1 {
expect resp.http.csc-match == true
expect resp.http.csc-match == true
expect resp.http.uzp-match == true
expect resp.http.uzp-match == true
} -run
} -run
varnish v1 -vcl+backend { }
varnish v1 -cliok "debug.vmod"
varnish v1 -cliok "vcl.list"
varnish v1 -expect vmods == 3
varnish v1 -cliok "vcl.discard vcl[1-8]"
varnish v1 -cliok "vcl.list"
varnish v1 -cliok "debug.vmod"
varnish v1 -expect vmods == 0
varnish v1 -errvcl {Symbol 'std' type (vmod) can not be used in expression.} {
import std;
sub vcl_recv {
if (std == 2) {
}
}
}
varnish v1 -cliok "debug.vmod"
varnish v1 -cliok "vcl.list"
varnish v1 -expect vmods == 0
bin/varnishtest/tests/m00001.vtc
View file @
b42114ed
...
@@ -54,27 +54,65 @@ client c1 {
...
@@ -54,27 +54,65 @@ client c1 {
expect resp.http.vcl42 == "false"
expect resp.http.vcl42 == "false"
} -run
} -run
varnish v1 -vcl+backend { }
server s1 {
rxreq
varnish v1 -cliok "debug.vmod"
txresp -hdr "foo: bAr" -hdr "bar: fOo"
varnish v1 -cliok "vcl.list"
} -start
varnish v1 -expect vmods == 1
varnish v1 -cliok "vcl.discard vcl1"
varnish v1 -cliok "vcl.discard vcl2"
varnish v1 -cliok "vcl.list"
varnish v1 -cliok "debug.vmod"
varnish v1 -
errvcl {Symbol 'std' type (vmod) can not be used in expression.}
{
varnish v1 -
vcl+backend
{
import std;
import std;
sub vcl_recv {
sub log {
if (std == 2) {
std.log("VCL" + " initiated " + "log");
std.log("01030507090b0d0f" +
"11131517191b1d1f" +
"21232527292b2d2f" +
"31333537393b3d3f" +
"41434547494b4d4f" +
"51535557595b5d5f" +
"61636567696b6d6f" +
"71737577797b7d7f" +
"81838587898b8d8f" +
"91939597999b9d9f" +
"a1a3a5a7a9abadaf" +
"b1b3b5b7b9bbbdbf" +
"c1c3c5c7c9cbcdcf" +
"d1d3d5d7d9dbdddf" +
"e1e3e5e7e9ebedef" +
"f1f3f5f7f9fbfdff");
}
sub vcl_init {
call log;
}
}
sub vcl_deliver {
set resp.http.foo = std.toupper(resp.http.foo);
set resp.http.bar = std.tolower(resp.http.bar);
std.syslog(8 + 7, "Somebody runs varnishtest");
call log;
}
}
}
}
varnish v1 -cliok "debug.vmod"
client c1 {
varnish v1 -cliok "vcl.list"
txreq
varnish v1 -expect vmods == 0
rxresp
expect resp.http.foo == "BAR"
expect resp.http.bar == "foo"
} -run
logexpect l1 -v v1 -g raw -d 1 {
# vsl_reclen = 255b minus NUL byte (last "ff" missing)
expect * 0 VCL_Log {^VCL initiated log}
expect 0 = VCL_Log {^01030507090b0d0f11131517191b1d1f21232527292b2d2f31333537393b3d3f41434547494b4d4f51535557595b5d5f61636567696b6d6f71737577797b7d7f81838587898b8d8f91939597999b9d9fa1a3a5a7a9abadafb1b3b5b7b9bbbdbfc1c3c5c7c9cbcdcfd1d3d5d7d9dbdddfe1e3e5e7e9ebedeff1f3f5f7f9fbfd$}
expect * 1006 VCL_call {^DELIVER}
expect 0 = RespUnset {^foo: bAr}
expect 0 = RespHeader {^foo: BAR}
expect 0 = RespUnset {^bar: fOo}
expect 0 = RespHeader {^bar: foo}
expect 0 = VCL_Log {^VCL initiated log}
expect 0 = VCL_Log {^01030507090b0d0f11131517191b1d1f21232527292b2d2f31333537393b3d3f41434547494b4d4f51535557595b5d5f61636567696b6d6f71737577797b7d7f81838587898b8d8f91939597999b9d9fa1a3a5a7a9abadafb1b3b5b7b9bbbdbfc1c3c5c7c9cbcdcfd1d3d5d7d9dbdddfe1e3e5e7e9ebedeff1f3f5f7f9fbfd$}
expect 0 = VCL_return {^deliver}
} -run
#logexpect l1 -wait
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment