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
ff74d1ec
Commit
ff74d1ec
authored
Jan 02, 2017
by
Dridi Boukelmoune
Committed by
guillaume quintard
Jan 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow shell commands in client/server specs
With this we can move body checks closer to HTTP checks.
parent
d424a373
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
5 deletions
+24
-5
a00015.vtc
bin/varnishtest/tests/a00015.vtc
+10
-3
vtc.c
bin/varnishtest/vtc.c
+10
-2
vtc.h
bin/varnishtest/vtc.h
+2
-0
vtc_http.c
bin/varnishtest/vtc_http.c
+2
-0
No files found.
bin/varnishtest/tests/a00015.vtc
View file @
ff74d1ec
varnishtest "Write a body to a file"
server s1 {
# First, HTTP checks
rxreq
expect req.http.Content-Type == "text/plain"
# Then, payload checks
write_body req.txt
shell {grep -q request req.txt}
txresp -hdr "Content-Type: text/plain" -body response
} -start
...
...
@@ -11,10 +16,12 @@ varnish v1 -vcl+backend {} -start
client c1 {
txreq -req POST -hdr "Content-Type: text/plain" -body request
# First, HTTP checks
rxresp
expect resp.http.Content-Type == "text/plain"
# Then, payload checks
write_body resp.txt
shell {grep -q response resp.txt}
} -run
shell {grep -q request req.txt}
shell {grep -q response resp.txt}
bin/varnishtest/vtc.c
View file @
ff74d1ec
...
...
@@ -441,8 +441,12 @@ cmd_varnishtest(CMD_ARGS)
*
* The vtc will fail if the return code of the shell is not 0.
*/
/* SECTION: client-server.spec.shell shell
*
* Same as for the top-level shell.
*/
static
void
void
cmd_shell
(
CMD_ARGS
)
{
(
void
)
priv
;
...
...
@@ -471,8 +475,12 @@ cmd_shell(CMD_ARGS)
* err_shell expect the shell command to fail AND stdout to match the string,
* failing the test case otherwise.
*/
/* SECTION: client-server.spec.shell err_shell
*
* Same as for the top-level err_shell.
*/
static
void
void
cmd_err_shell
(
CMD_ARGS
)
{
(
void
)
priv
;
...
...
bin/varnishtest/vtc.h
View file @
ff74d1ec
...
...
@@ -66,6 +66,8 @@ CMD(varnish);
CMD
(
barrier
);
CMD
(
logexpect
);
CMD
(
process
);
CMD
(
err_shell
);
CMD
(
shell
);
#undef CMD
extern
volatile
sig_atomic_t
vtc_error
;
/* Error, bail out */
...
...
bin/varnishtest/vtc_http.c
View file @
ff74d1ec
...
...
@@ -1860,6 +1860,8 @@ static const struct cmds http_cmds[] = {
/* general purpose */
CMD
(
barrier
),
CMD
(
delay
),
CMD
(
err_shell
),
CMD
(
shell
),
#undef CMD_HTTP
#undef CMD
{
NULL
,
NULL
}
...
...
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