Commit 9eb54098 authored by Federico G. Schwindt's avatar Federico G. Schwindt

Various improvements from my personal git stash

More to come soonish.
parent c6d80ca7
...@@ -52,7 +52,7 @@ Syntax ...@@ -52,7 +52,7 @@ Syntax
------ ------
Commands are usually terminated with a newline. Long command can be Commands are usually terminated with a newline. Long command can be
entered using shell style *here document* (here-document or heredoc). entered using shell-style *here document* (here-document or heredoc).
The format of here document is:: The format of here document is::
<< word << word
...@@ -85,9 +85,8 @@ Backend Pattern ...@@ -85,9 +85,8 @@ Backend Pattern
A backend pattern can be a backend name or a combination of a VCL name A backend pattern can be a backend name or a combination of a VCL name
and backend name in "VCL.backend" format. If the VCL name is omitted, and backend name in "VCL.backend" format. If the VCL name is omitted,
the active VCL is assumed. Partial matching on the backend name, VCL the active VCL is assumed. Partial matching on the backend and VCL
name or both is possible using shell-style wilcards, i.e. asterisk (*), names is supported using shell-style wilcards, e.g. asterisk (*).
question mark (?) and brackets ([]).
Examples:: Examples::
...@@ -122,20 +121,22 @@ fields. ...@@ -122,20 +121,22 @@ fields.
VCL Temperature VCL Temperature
--------------- ---------------
A VCL program goes through several states related to the different commands: it A VCL program goes through several states related to the different
can be loaded, used, and later discarded. You can load several VCL programs and commands: it can be loaded, used, and later discarded. You can load
switch at any time from one to another. There is only one active VCL, but the several VCL programs and switch at any time from one to another. There
previous active VCL will be maintained active until all its transactions are is only one active VCL, but the previous active VCL will be maintained
over. active until all its transactions are over.
Over time, if you often refresh your VCL and keep the previous versions around, Over time, if you often refresh your VCL and keep the previous
resource consumption will increase, you can't escape that. However, most of the versions around, resource consumption will increase, you can't escape
time you want only one to pay the price only for the active VCL and keep older that. However, most of the time you want only one to pay the price only
VCLs in case you'd need to rollback to a previous version. for the active VCL and keep older VCLs in case you'd need to rollback
to a previous version.
The VCL temperature allows you to minimize the footprint of inactive VCLs. Once
a VCL becomes cold, Varnish will release all the resources that can be be later The VCL temperature allows you to minimize the footprint of inactive
reacquired. You can manually set the temperature of a VCL or let varnish VCLs. Once a VCL becomes cold, Varnish will release all the resources
that can be be later reacquired. You can manually set the temperature
of a VCL or let varnish
automatically handle it. automatically handle it.
...@@ -236,7 +237,7 @@ secret file, and the challenge string. ...@@ -236,7 +237,7 @@ secret file, and the challenge string.
EXAMPLES EXAMPLES
======== ========
Load a multi-line VCL using shell style *here document*:: Load a multi-line VCL using shell-style *here document*::
vcl.inline example << EOF vcl.inline example << EOF
vcl 4.0; vcl 4.0;
...@@ -260,9 +261,9 @@ backend contains "USERID=1663":: ...@@ -260,9 +261,9 @@ backend contains "USERID=1663"::
AUTHORS AUTHORS
======= =======
This manual page was originally written by Per Buer and later modified by This manual page was originally written by Per Buer and later modified
Federico G. Schwindt, Dridi Boukelmoune, Lasse Karstensen and Poul-Henning by Federico G. Schwindt, Dridi Boukelmoune, Lasse Karstensen and
Kamp. Poul-Henning Kamp.
SEE ALSO SEE ALSO
======== ========
......
...@@ -109,21 +109,22 @@ An example:: ...@@ -109,21 +109,22 @@ An example::
expect resp.bodylen == 21 expect resp.bodylen == 21
} -run } -run
When run, the above script will simulate a server (s1) that expects two When run, the above script will simulate a server (s1) that expects
different requests. It will start a Varnish server (v1) and add the backend two different requests. It will start a Varnish server (v1) and add the
definition to the VCL specified (-vcl+backend). Finally it starts the backend definition to the VCL specified (-vcl+backend). Finally it starts
c1-client, which is a single client sending two requests. the c1-client, which is a single client sending two requests.
TESTING A BUILD TREE TESTING A BUILD TREE
==================== ====================
Whether you are building a VMOD or trying to use one that you freshly built, Whether you are building a VMOD or trying to use one that you freshly
you can tell ``varnishtest`` to pass a *vmod_path* to ``varnishd`` instances built, you can tell ``varnishtest`` to pass a *vmod_path* to ``varnishd``
started using the ``varnish -start`` command in your test case:: instances started using the ``varnish -start`` command in your test case::
varnishtest -p vmod_path=... /path/to/*.vtc varnishtest -p vmod_path=... /path/to/*.vtc
This way you can use the same test cases on both installed and built VMODs:: This way you can use the same test cases on both installed and built
VMODs::
server s1 {...} -start server s1 {...} -start
...@@ -135,30 +136,31 @@ This way you can use the same test cases on both installed and built VMODs:: ...@@ -135,30 +136,31 @@ This way you can use the same test cases on both installed and built VMODs::
... ...
You are not limited to the *vmod_path* and can pass any parameter, allowing You are not limited to the *vmod_path* and can pass any parameter,
you to run a build matrix without changing the test suite. You can achieve the allowing you to run a build matrix without changing the test suite. You
same with macros, but then they need to be defined on each run. can achieve the same with macros, but then they need to be defined on
each run.
You can see the actual ``varnishd`` command lines in test outputs, they look You can see the actual ``varnishd`` command lines in test outputs,
roughly like this:: they look roughly like this::
exec varnishd [varnishtest -p params] [testing params] [vtc -arg params] exec varnishd [varnishtest -p params] [testing params] [vtc -arg params]
Parameters you define with ``varnishtest -p`` may be overriden by parameters Parameters you define with ``varnishtest -p`` may be overriden by
needed by ``varnishtest`` to run properly, and they may in turn be overriden parameters needed by ``varnishtest`` to run properly, and they may in
by parameters set in test scripts. turn be overriden by parameters set in test scripts.
There's also a special mode in which ``varnishtest`` builds itself a PATH and There's also a special mode in which ``varnishtest`` builds itself a
a *vmod_path* in order to find Varnish binaries (programs and VMODs) in the PATH and a *vmod_path* in order to find Varnish binaries (programs and
build tree surrounding the ``varnishtest`` binary. This is meant for testing VMODs) in the build tree surrounding the ``varnishtest`` binary. This
of Varnish under development and will disregard your *vmod_path* if you set is meant for testing of Varnish under development and will disregard
one. your *vmod_path* if you set one.
If you need to test your VMOD against a Varnish build tree, you must install If you need to test your VMOD against a Varnish build tree, you must
it first, in a temp directory for instance. With information provided by the install it first, in a temp directory for instance. With information
installation's *pkg-config(1)* you can build a proper PATH in order to access provided by the installation's *pkg-config(1)* you can build a proper
Varnish programs, and a *vmod_path* to access both your VMOD and the built-in PATH in order to access Varnish programs, and a *vmod_path* to access
VMODs:: both your VMOD and the built-in VMODs::
export PKG_CONFIG_PATH=/path/to/install/lib/pkgconfig export PKG_CONFIG_PATH=/path/to/install/lib/pkgconfig
...@@ -187,8 +189,9 @@ responses. Accepted parameters: ...@@ -187,8 +189,9 @@ responses. Accepted parameters:
client client
****** ******
Creates a client instance that sends requests to Varnish and receives responses. Creates a client instance that sends requests to Varnish and receives
By default, a client will try and connect to the first varnish server available. responses. By default, a client will try and connect to the first
varnish server available.
Accepted parameters: Accepted parameters:
...@@ -223,11 +226,11 @@ Starts Varnish instance. Accepted arguments: ...@@ -223,11 +226,11 @@ Starts Varnish instance. Accepted arguments:
executes a command and expect it to error with given status executes a command and expect it to error with given status
(e.g. "-clierr 300 panic.clear") (e.g. "-clierr 300 panic.clear")
\-vcl STRING \-vcl STRING
specify VCL for the instance. You can create multiline strings by encasing them specify VCL for the instance. You can create multiline strings by
in curly braces. encasing them in curly braces.
\-vcl+backend STRING \-vcl+backend STRING
specifes VCL for the instance, and automatically inject backends definition specifes VCL for the instance, and automatically inject backends
of currently defined servers. definition of currently defined servers.
\-errvcl \-errvcl
tests that invalid VCL results in an error. tests that invalid VCL results in an error.
\-stop \-stop
...@@ -242,67 +245,79 @@ Starts Varnish instance. Accepted arguments: ...@@ -242,67 +245,79 @@ Starts Varnish instance. Accepted arguments:
sets up a test for asserting variables against expected results. sets up a test for asserting variables against expected results.
Syntax: "-expect <var> <comparison> <const>" Syntax: "-expect <var> <comparison> <const>"
See tests supplied with Varnish distribution for usage examples for all these See tests supplied with Varnish distribution for usage examples for all
directives. these directives.
delay delay
***** *****
Sleeps for specified number of seconds. Can accept floating point numbers.
Sleeps for specified number of seconds.
Usage: ``delay FLOAT`` Usage: ``delay FLOAT``
varnishtest varnishtest
*********** ***********
Accepts a string as an only argument. This being a test name that is being output Accepts a string as an only argument. This being a test name that is being
into the log. By default, test name is not shown, unless it fails. output into the log. By default, test name is not shown, unless it fails.
shell shell
***** *****
Executes a shell command. Accepts one argument as a string, and runs the command Executes a shell command. Accepts one argument as a string, and runs
as is. the command as is.
Usage: ``shell "CMD"`` Usage: ``shell "CMD"``
sema err_shell
**** *********
Semaphores mostly used to synchronize clients and servers "around" Usage: ``err_shell "STRING" "CMD"``
varnish, so that the server will not send something particular
until the client tells it to, but it can also be used synchronize
multiple clients or servers running in parallel.
Usage: ``sema NAME sync INT`` barrier
*******
NAME is of the form 'rX', X being a positive integer. This command blocks until, Usage: ``barrier NAME [arguments]``
in total, INT semaphores named NAME block.
random random
****** ******
Initializes random generator (need to call std.random() in vcl). See m00002.vtc Initializes random generator (need to call std.random() in vcl). See
for more info m00002.vtc for more info.
feature feature
******* *******
Checks for features to be present in the test environment. If feature is not present, test is skipped. Checks for features to be present in the test environment. If feature
is not present, test is skipped.
Usage: ``feature STRING [STRING...]`` Usage: ``feature STRING [STRING...]``
Possible checks: Possible checks:
SO_RCVTIMEO_WORKS SO_RCVTIMEO_WORKS
runs the test only if SO_RCVTIMEO option works in the environment The SO_RCVTIMEO socket option is working
64bit 64bit
runs the test only if environment is 64 bit The environment is 64 bits
!OSX !OSX
skips the test if ran on OSX The environment is not OSX
dns
DNS lookups are working
topbuild topbuild
varnishtest has been started with '-i' and set the ${topbuild} macro. varnishtest has been started with '-i'
root
varnishtest has been invoked by the root user
user_varnish
The varnish user is present
user_vcache
The vcache user is present
group_varnish
The varnish group is present
logexpect logexpect
This allows checking order and contents of VSL records in varnishtest. *********
This allows checking order and contents of VSL records in varnishtest.
SEE ALSO SEE ALSO
======== ========
...@@ -319,10 +334,9 @@ HISTORY ...@@ -319,10 +334,9 @@ HISTORY
======= =======
The varnishtest program was developed by Poul-Henning Kamp The varnishtest program was developed by Poul-Henning Kamp
<phk@phk.freebsd.dk> in cooperation with Varnish Software AS. <phk@phk.freebsd.dk> in cooperation with Varnish Software AS. This manual
This manual page was originally written by Stig Sandbeck Mathisen page was originally written by Stig Sandbeck Mathisen <ssm@linpro.no>
<ssm@linpro.no> and updated by Kristian Lyngstøl and updated by Kristian Lyngstøl <kristian@varnish-cache.org>.
<kristian@varnish-cache.org>.
COPYRIGHT COPYRIGHT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment