File: //proc/self/root/proc/thread-self/root/usr/share/doc/varnish-6.0.3/html/reference/vtc.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>VTC — Varnish version 6.0.3 documentation</title>
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="What’s new / Upgrading" href="../whats-new/index.html" />
<link rel="prev" title="vsl-query" href="vsl-query.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../whats-new/index.html" title="What’s new / Upgrading"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="vsl-query.html" title="vsl-query"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Varnish version 6.0.3 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">The Varnish Reference Manual</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="vtc">
<span id="vtc-7"></span><h1>VTC<a class="headerlink" href="#vtc" title="Permalink to this headline">¶</a></h1>
<div class="section" id="varnish-test-case-syntax">
<h2>Varnish Test Case Syntax<a class="headerlink" href="#varnish-test-case-syntax" title="Permalink to this headline">¶</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Manual section:</th><td class="field-body">7</td>
</tr>
</tbody>
</table>
<div class="section" id="overview">
<h3>OVERVIEW<a class="headerlink" href="#overview" title="Permalink to this headline">¶</a></h3>
<p>This document describes the syntax used by Varnish Test Cases files (.vtc).
A vtc file describe a scenario with different scripted HTTP-talking entities,
and generally one or more Varnish instances to test.</p>
</div>
<div class="section" id="parsing">
<h3>PARSING<a class="headerlink" href="#parsing" title="Permalink to this headline">¶</a></h3>
<p>A vtc file will be read word after word, with very little tokenization, meaning
a syntax error won’t be detected until the test actually reach the relevant
action in the test.</p>
<p>A parsing error will most of the time result in an assert being triggered. If
this happens, please refer yourself to the related source file and line
number. However, this guide should help you avoid the most common mistakes.</p>
<div class="section" id="words-and-strings">
<h4>Words and strings<a class="headerlink" href="#words-and-strings" title="Permalink to this headline">¶</a></h4>
<p>The parser splits words by detecting whitespace characters and a string is a
word, or a series of words on the same line enclosed by double-quotes (“…”),
or, for multi-line strings, enclosed in curly brackets ({…}).</p>
</div>
<div class="section" id="comments">
<h4>Comments<a class="headerlink" href="#comments" title="Permalink to this headline">¶</a></h4>
<p>The leading whitespaces of lines are ignored. Empty lines (or ones consisting
only of whitespaces) are ignored too, as are the lines starting with “#” that
are comments.</p>
</div>
<div class="section" id="lines-and-commands">
<h4>Lines and commands<a class="headerlink" href="#lines-and-commands" title="Permalink to this headline">¶</a></h4>
<p>Test files take at most one command per line, with the first word of the line
being the command and the following ones being its arguments. To continue over
to a new line without breaking the argument string, you can escape the newline
character (\n) with a backslash (\).</p>
</div>
</div>
<div class="section" id="syntax">
<h3>SYNTAX<a class="headerlink" href="#syntax" title="Permalink to this headline">¶</a></h3>
<div class="section" id="barrier">
<h4>barrier<a class="headerlink" href="#barrier" title="Permalink to this headline">¶</a></h4>
<p>NOTE: This command is available everywhere commands are given.</p>
<p>Barriers allows you to synchronize different threads to make sure events
occur in the right order. It’s even possible to use them in VCL.</p>
<p>First, it’s necessary to declare the barrier:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">barrier</span> <span class="n">bNAME</span> <span class="n">TYPE</span> <span class="n">NUMBER</span> <span class="p">[</span><span class="o">-</span><span class="n">cyclic</span><span class="p">]</span>
</pre></div>
</div>
<p>With the arguments being:</p>
<dl class="docutils">
<dt>bNAME</dt>
<dd>this is the name of the barrier, used to identify it when you’ll
create sync points. It must start with ‘b’.</dd>
<dt>TYPE</dt>
<dd>it can be “cond” (mutex) or “sock” (socket) and sets internal
behavior. If you don’t need VCL synchronization, use cond.</dd>
<dt>NUMBER</dt>
<dd>number of sync point needed to go through the barrier.</dd>
<dt>-cyclic</dt>
<dd>if present, the barrier will reset itself and be ready for another
round once gotten through.</dd>
</dl>
<p>Then, to add a sync point:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">barrier</span> <span class="n">bNAME</span> <span class="n">sync</span>
</pre></div>
</div>
<p>This will block the parent thread until the number of sync points for bNAME
reaches the NUMBER given in the barrier declaration.</p>
<p>If you wish to synchronize the VCL, you need to declare a “sock” barrier.
This will emit a macro definition named “bNAME_sock” that you can use in
VCL (after importing the debug vmod):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">debug</span><span class="o">.</span><span class="n">barrier_sync</span><span class="p">(</span><span class="s2">"$</span><span class="si">{bNAME_sock}</span><span class="s2">"</span><span class="p">);</span>
</pre></div>
</div>
<p>This function returns 0 if everything went well and is the equivalent of
<code class="docutils literal notranslate"><span class="pre">barrier</span> <span class="pre">bNAME</span> <span class="pre">sync</span></code> at the VTC top-level.</p>
</div>
<div class="section" id="client-server">
<h4>client/server<a class="headerlink" href="#client-server" title="Permalink to this headline">¶</a></h4>
<p>Client and server threads are fake HTTP entities used to test your Varnish
and VCL. They take any number of arguments, and the one that are not
recognized, assuming they don’t start with ‘-‘, are treated as
specifications, laying out the actions to undertake:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">client</span> <span class="n">cNAME</span> <span class="p">[</span><span class="o">...</span><span class="p">]</span>
<span class="n">server</span> <span class="n">sNAME</span> <span class="p">[</span><span class="o">...</span><span class="p">]</span>
</pre></div>
</div>
<p>Clients and server are identified by a string that’s the first argument,
clients’ names start with ‘c’ and servers’ names start with ‘s’.</p>
<p>As the client and server commands share a good deal of arguments and
specification actions, they are grouped in this single section, specific
items will be explicitly marked as such.</p>
<div class="section" id="arguments">
<h5>Arguments<a class="headerlink" href="#arguments" title="Permalink to this headline">¶</a></h5>
<dl class="docutils">
<dt>-start</dt>
<dd>Start the thread in background, processing the last given
specification.</dd>
<dt>-wait</dt>
<dd>Block until the thread finishes.</dd>
<dt>-run (client only)</dt>
<dd>Equivalent to “-start -wait”.</dd>
<dt>-repeat NUMBER</dt>
<dd>Instead of processing the specification only once, do it NUMBER times.</dd>
<dt>-keepalive</dt>
<dd>For repeat, do not open new connections but rather run all
iterations in the same connection</dd>
<dt>-break (server only)</dt>
<dd>Stop the server.</dd>
<dt>-listen STRING (server only)</dt>
<dd>Dictate the listening socket for the server. STRING is of the form
“IP PORT”, or “/PATH/TO/SOCKET” for a Unix domain socket. In the
latter case, the path must begin with ‘/’, and the server must be
able to create it.</dd>
<dt>-connect STRING (client only)</dt>
<dd>Indicate the server to connect to. STRING is also of the form
“IP PORT”, or “/PATH/TO/SOCKET”. As with “server -listen”, a
Unix domain socket is recognized when STRING begins with a ‘/’.</dd>
<dt>-dispatch (server only, s0 only)</dt>
<dd><p class="first">Normally, to keep things simple, server threads only handle one
connection at a time, but the -dispatch switch allows to accept
any number of connection and handle them following the given spec.</p>
<p class="last">However, -dispatch is only allowed for the server name “s0”.</p>
</dd>
<dt>-proxy1 STRING (client only)</dt>
<dd>Use the PROXY protocol version 1 for this connection. STRING
is of the form “CLIENTIP:PORT SERVERIP:PORT”.</dd>
<dt>-proxy2 STRING (client only)</dt>
<dd>Use the PROXY protocol version 2 for this connection. STRING
is of the form “CLIENTIP:PORT SERVERIP:PORT”.</dd>
</dl>
</div>
<div class="section" id="macros-and-automatic-behaviour">
<h5>Macros and automatic behaviour<a class="headerlink" href="#macros-and-automatic-behaviour" title="Permalink to this headline">¶</a></h5>
<p>To make things easier in the general case, clients will connect by default
to the first Varnish server declared and the -vcl+backend switch of the
<code class="docutils literal notranslate"><span class="pre">varnish</span></code> command will add all the declared servers as backends.</p>
<p>Be careful though, servers will by default listen to the 127.0.0.1 IP and
will pick a random port, and publish 3 macros: sNAME_addr, sNAME_port and
sNAME_sock, but only once they are started.
For ‘varnish -vcl+backend’ to create the vcl with the correct values, the
server must be started first.</p>
</div>
<div class="section" id="specification">
<h5>Specification<a class="headerlink" href="#specification" title="Permalink to this headline">¶</a></h5>
<p>It’s a string, either double-quoted “like this”, but most of the time
enclosed in curly brackets, allowing multilining. Write a command per line in
it, empty line are ignored, and long line can be wrapped by using a
backslash. For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">client</span> <span class="n">c1</span> <span class="p">{</span>
<span class="n">txreq</span> <span class="o">-</span><span class="n">url</span> <span class="o">/</span><span class="n">foo</span> \
<span class="o">-</span><span class="n">hdr</span> <span class="s2">"bar: baz"</span>
<span class="n">rxresp</span>
<span class="p">}</span> <span class="o">-</span><span class="n">run</span>
</pre></div>
</div>
<dl class="docutils">
<dt>accept (server only)</dt>
<dd>Close the current connection, if any, and accept a new one. Note
that this new connection is HTTP/1.x.</dd>
<dt>chunked STRING</dt>
<dd>Send STRING as chunked encoding.</dd>
<dt>chunkedlen NUMBER</dt>
<dd>Do as <code class="docutils literal notranslate"><span class="pre">chunked</span></code> except that the string will be generated
for you, with a length of NUMBER characters.</dd>
<dt>close (server only)</dt>
<dd>Close the connection. Note that if operating in HTTP/2 mode no
extra (GOAWAY) frame is sent, it’s simply a TCP close.</dd>
<dt>expect STRING1 OP STRING2</dt>
<dd><p class="first">Test if “STRING1 OP STRING2” is true, and if not, fails the test.
OP can be ==, <, <=, >, >= when STRING1 and STRING2 represent numbers
in which case it’s an order operator. If STRING1 and STRING2 are
meant as strings OP is a matching operator, either == (exact match)
or ~ (regex match).</p>
<p>varnishtet will first try to resolve STRING1 and STRING2 by looking
if they have special meanings, in which case, the resolved value is
use for the test. Note that this value can be a string representing a
number, allowing for tests such as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">expect</span> <span class="n">req</span><span class="o">.</span><span class="n">http</span><span class="o">.</span><span class="n">x</span><span class="o">-</span><span class="n">num</span> <span class="o">></span> <span class="mi">2</span>
</pre></div>
</div>
<p>Here’s the list of recognized strings, most should be obvious as they
either match VCL logic, or the txreq/txresp options:</p>
<ul class="last simple">
<li>remote.ip</li>
<li>remote.port</li>
<li>remote.path</li>
<li>req.method</li>
<li>req.url</li>
<li>req.proto</li>
<li>resp.proto</li>
<li>resp.status</li>
<li>resp.reason</li>
<li>resp.chunklen</li>
<li>req.bodylen</li>
<li>req.body</li>
<li>resp.bodylen</li>
<li>resp.body</li>
<li>req.http.NAME</li>
<li>resp.http.NAME</li>
</ul>
</dd>
<dt>expect_close</dt>
<dd>Reads from the connection, expecting nothing to read but an EOF.</dd>
<dt>fatal|non_fatal</dt>
<dd>Control whether a failure of this entity should stop the test.</dd>
<dt>loop NUMBER STRING</dt>
<dd>Process STRING as a specification, NUMBER times.</dd>
<dt>recv NUMBER</dt>
<dd>Read NUMBER bytes from the connection.</dd>
<dt>rxchunk</dt>
<dd>Receive an HTTP chunk.</dd>
<dt>rxpri (server only)</dt>
<dd>Receive a preface. If valid set the server to HTTP/2, abort
otherwise.</dd>
<dt>rxreq (server only)</dt>
<dd>Receive and parse a request’s headers and body.</dd>
<dt>rxreqbody (server only)</dt>
<dd>Receive a request’s body.</dd>
<dt>rxreqhdrs</dt>
<dd>Receive and parse a request’s headers (but not the body).</dd>
<dt>rxresp [-no_obj] (client only)</dt>
<dd>Receive and parse a response’s headers and body. If -no_obj is present, only get
the headers.</dd>
<dt>rxrespbody (client only)</dt>
<dd>Receive a response’s body.</dd>
<dt>rxresphdrs (client only)</dt>
<dd>Receive and parse a response’s headers.</dd>
<dt>send STRING</dt>
<dd>Push STRING on the connection.</dd>
<dt>send_n NUMBER STRING</dt>
<dd>Write STRING on the socket NUMBER times.</dd>
<dt>send_urgent STRING</dt>
<dd>Send string as TCP OOB urgent data. You will never need this.</dd>
<dt>sendhex STRING</dt>
<dd>Send bytes as described by STRING. STRING should consist of hex pairs
possibly separated by whitespace or newlines. For example:
“0F EE a5 3df2”.</dd>
<dt>settings -dectbl INT</dt>
<dd>Force internal HTTP/2 settings to certain values. Currently only
support setting the decoding table size.</dd>
<dt>shell</dt>
<dd>Same as for the top-level shell.</dd>
<dt>stream</dt>
<dd>HTTP/2 introduces the concept of streams, and these come with
their own specification, and as it’s quite big, have been moved
to their own chapter.</dd>
<dt>timeout NUMBER</dt>
<dd>Set the TCP timeout for this entity.</dd>
<dt>txpri (client only)</dt>
<dd>Send an HTTP/2 preface (“PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n”)
and set client to HTTP/2.</dd>
<dt>txreq|txresp […]</dt>
<dd><p class="first">Send a minimal request or response, but overload it if necessary.</p>
<p>txreq is client-specific and txresp is server-specific.</p>
<p>The only thing different between a request and a response, apart
from who can send them is that the first line (request line vs
status line), so all the options are prety much the same.</p>
<dl class="docutils">
<dt>-req STRING (txreq only)</dt>
<dd>What method to use (default: “GET”).</dd>
<dt>-url STRING (txreq only)</dt>
<dd>What location to use (default “/”).</dd>
<dt>-proto STRING</dt>
<dd>What protocol use in the status line.
(default: “HTTP/1.1”).</dd>
<dt>-status NUMBER (txresp only)</dt>
<dd>What status code to return (default 200).</dd>
<dt>-reason STRING (txresp only)</dt>
<dd>What message to put in the status line (default: “OK”).</dd>
</dl>
<p>These three switches can appear in any order but must come before the
following ones.</p>
<dl class="docutils">
<dt>-nohost</dt>
<dd>Don’t include a Host header in the request.</dd>
<dt>-nolen</dt>
<dd>Don’t include a Content-Length header.</dd>
<dt>-hdr STRING</dt>
<dd>Add STRING as a header, it must follow this format:
“name: value”. It can be called multiple times.</dd>
<dt>-hdrlen STRING NUMBER</dt>
<dd>Add STRING as a header with NUMBER bytes of content.</dd>
</dl>
<p>You can then use the arguments related to the body:</p>
<dl class="last docutils">
<dt>-body STRING</dt>
<dd>Input STRING as body.</dd>
<dt>-bodylen NUMBER</dt>
<dd>Generate and input a body that is NUMBER bytes-long.</dd>
<dt>-gziplevel NUMBER</dt>
<dd>Set the gzip level (call it before any of the other gzip
switches).</dd>
<dt>-gzipresidual NUMBER</dt>
<dd>Add extra gzip bits. You should never need it.</dd>
<dt>-gzipbody STRING</dt>
<dd>Zip STRING and send it as body.</dd>
<dt>-gziplen NUMBER</dt>
<dd>Combine -body and -gzipbody: create a body of length NUMBER,
zip it and send as body.</dd>
</dl>
</dd>
<dt>write_body STRING</dt>
<dd>Write the body of a request or a response to a file. By using the
shell command, higher-level checks on the body can be performed
(eg. XML, JSON, …) provided that such checks can be delegated
to an external program.</dd>
</dl>
</div>
</div>
<div class="section" id="delay">
<h4>delay<a class="headerlink" href="#delay" title="Permalink to this headline">¶</a></h4>
<p>NOTE: This command is available everywhere commands are given.</p>
<p>Sleep for the number of seconds specified in the argument. The number
can include a fractional part, e.g. 1.5.</p>
</div>
<div class="section" id="err-shell">
<h4>err_shell<a class="headerlink" href="#err-shell" title="Permalink to this headline">¶</a></h4>
<p>NOTICE: err_shell is deprecated, use <cite>shell -err -expect</cite> instead.</p>
<p>This is very similar to the the <code class="docutils literal notranslate"><span class="pre">shell</span></code> command, except it takes a first
string as argument before the command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">err_shell</span> <span class="s2">"foo"</span> <span class="s2">"echo foo"</span>
</pre></div>
</div>
<p>err_shell expect the shell command to fail AND stdout to match the string,
failing the test case otherwise.</p>
</div>
<div class="section" id="feature">
<h4>feature<a class="headerlink" href="#feature" title="Permalink to this headline">¶</a></h4>
<p>Test that the required feature(s) for a test are available, and skip
the test otherwise; or change the interpretation of the test, as
documented below. feature takes any number of arguments from this list:</p>
<dl class="docutils">
<dt>SO_RCVTIMEO_WORKS</dt>
<dd>The SO_RCVTIMEO socket option is working</dd>
<dt>64bit</dt>
<dd>The environment is 64 bits</dd>
<dt>!OSX</dt>
<dd>The environment is not OSX</dd>
<dt>dns</dt>
<dd>DNS lookups are working</dd>
<dt>topbuild</dt>
<dd>The test has been started with ‘-i’</dd>
<dt>root</dt>
<dd>The test has been invoked by the root user</dd>
<dt>user_varnish</dt>
<dd>The varnish user is present</dd>
<dt>user_vcache</dt>
<dd>The vcache user is present</dd>
<dt>group_varnish</dt>
<dd>The varnish group is present</dd>
<dt>cmd <command-line></dt>
<dd>A command line that should execute with a zero exit status</dd>
<dt>ignore_unknown_macro</dt>
<dd>Do not fail the test if a string of the form ${…} is not
recognized as a macro.</dd>
<dt>persistent_storage</dt>
<dd>Varnish was built with the deprecated persistent storage.</dd>
</dl>
<p>Be careful with ignore_unknown_macro, because it may cause a test with a
misspelled macro to fail silently. You should only need it if you must
run a test with strings of the form “${…}”.</p>
</div>
<div class="section" id="haproxy">
<h4>haproxy<a class="headerlink" href="#haproxy" title="Permalink to this headline">¶</a></h4>
<p>Define and interact with haproxy instances.</p>
<p>To define a haproxy server, you’ll use this syntax:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">haproxy</span> <span class="n">hNAME</span> <span class="o">-</span><span class="n">conf</span><span class="o">-</span><span class="n">OK</span> <span class="n">CONFIG</span>
<span class="n">haproxy</span> <span class="n">hNAME</span> <span class="o">-</span><span class="n">conf</span><span class="o">-</span><span class="n">BAD</span> <span class="n">ERROR</span> <span class="n">CONFIG</span>
<span class="n">haproxy</span> <span class="n">hNAME</span> <span class="p">[</span><span class="o">-</span><span class="n">D</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">W</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">arg</span> <span class="n">STRING</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">conf</span><span class="p">[</span><span class="o">+</span><span class="n">vcl</span><span class="p">]</span> <span class="n">STRING</span><span class="p">]</span>
</pre></div>
</div>
<p>The first <code class="docutils literal notranslate"><span class="pre">haproxy</span> <span class="pre">hNAME</span></code> invocation will start the haproxy master
process in the background, waiting for the <code class="docutils literal notranslate"><span class="pre">-start</span></code> switch to actually
start the child.</p>
<p>Arguments:</p>
<dl class="docutils">
<dt>hNAME</dt>
<dd>Identify the HAProxy server with a string, it must starts with ‘h’.</dd>
<dt>-conf-OK CONFIG</dt>
<dd><dl class="first last docutils">
<dt>Run haproxy in ‘-c’ mode to check config is OK</dt>
<dd>stdout/stderr should contain ‘Configuration file is valid’
The exit code should be 0.</dd>
</dl>
</dd>
<dt>-conf-BAD ERROR CONFIG</dt>
<dd><dl class="first last docutils">
<dt>Run haproxy in ‘-c’ mode to check config is BAD.</dt>
<dd>“ERROR” should be part of the diagnostics on stdout/stderr.
The exit code should be 1.</dd>
</dl>
</dd>
<dt>-D</dt>
<dd>Run HAproxy in daemon mode. If not given ‘-d’ mode used.</dd>
<dt>-W</dt>
<dd>Enable HAproxy in Worker mode.</dd>
<dt>-arg STRING</dt>
<dd>Pass an argument to haproxy, for example “-h simple_list”.</dd>
<dt>-cli STRING</dt>
<dd>Specify the spec to be run by the command line interface (CLI).</dd>
<dt>-conf STRING</dt>
<dd>Specify the configuration to be loaded by this HAProxy instance.</dd>
<dt>-conf+backend STRING</dt>
<dd><dl class="first last docutils">
<dt>Specify the configuration to be loaded by this HAProxy instance,</dt>
<dd>all server instances will be automatically appended</dd>
</dl>
</dd>
<dt>-start</dt>
<dd>Start this HAProxy instance.</dd>
<dt>-wait</dt>
<dd>Stop this HAProxy instance.</dd>
<dt>-expectexit NUMBER</dt>
<dd>Expect haproxy to exit(3) with this value</dd>
</dl>
<div class="section" id="haproxy-cli-specification">
<h5>haproxy CLI Specification<a class="headerlink" href="#haproxy-cli-specification" title="Permalink to this headline">¶</a></h5>
<dl class="docutils">
<dt>expect OP STRING</dt>
<dd>Regex match the CLI reception buffer with STRING
if OP is ~ or, on the contraty, if OP is !~ check that there is
no regex match.</dd>
<dt>send STRING</dt>
<dd>Push STRING on the CLI connection. STRING will be terminated by an
end of line character (n).</dd>
</dl>
</div>
</div>
<div class="section" id="logexpect">
<h4>logexpect<a class="headerlink" href="#logexpect" title="Permalink to this headline">¶</a></h4>
<p>Reads the VSL and looks for records matching a given specification. It will
process records trying to match the first pattern, and when done, will
continue processing, trying to match the following pattern. If a pattern
isn’t matched, the test will fail.</p>
<p>logexpect threads are declared this way:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">logexpect</span> <span class="n">lNAME</span> <span class="o">-</span><span class="n">v</span> <span class="o"><</span><span class="nb">id</span><span class="o">></span> <span class="p">[</span><span class="o">-</span><span class="n">g</span> <span class="o"><</span><span class="n">grouping</span><span class="o">></span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">d</span> <span class="mi">0</span><span class="o">|</span><span class="mi">1</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">q</span> <span class="n">query</span><span class="p">]</span> \
<span class="p">[</span><span class="n">vsl</span> <span class="n">arguments</span><span class="p">]</span> <span class="p">{</span>
<span class="n">expect</span> <span class="o"><</span><span class="n">skip</span><span class="o">></span> <span class="o"><</span><span class="n">vxid</span><span class="o">></span> <span class="o"><</span><span class="n">tag</span><span class="o">></span> <span class="o"><</span><span class="n">regex</span><span class="o">></span>
<span class="n">expect</span> <span class="o"><</span><span class="n">skip</span><span class="o">></span> <span class="o"><</span><span class="n">vxid</span><span class="o">></span> <span class="o"><</span><span class="n">tag</span><span class="o">></span> <span class="o"><</span><span class="n">regex</span><span class="o">></span>
<span class="o">...</span>
<span class="p">}</span> <span class="p">[</span><span class="o">-</span><span class="n">start</span><span class="o">|-</span><span class="n">wait</span><span class="p">]</span>
</pre></div>
</div>
<p>And once declared, you can start them, or wait on them:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">logexpect</span> <span class="n">lNAME</span> <span class="o"><-</span><span class="n">start</span><span class="o">|-</span><span class="n">wait</span><span class="o">></span>
</pre></div>
</div>
<p>With:</p>
<dl class="docutils">
<dt>lNAME</dt>
<dd>Name the logexpect thread, it must start with ‘l’.</dd>
<dt>-v id</dt>
<dd>Specify the varnish instance to use (most of the time, id=v1).</dd>
<dt>-g <session|request|vxid|raw</dt>
<dd>Decide how records are grouped, see -g in <code class="docutils literal notranslate"><span class="pre">man</span> <span class="pre">varnishlog</span></code> for more
information.</dd>
<dt>-d <0|1></dt>
<dd>Start processing log records at the head of the log instead of the
tail.</dd>
<dt>-q query</dt>
<dd>Filter records using a query expression, see <code class="docutils literal notranslate"><span class="pre">man</span> <span class="pre">vsl-query</span></code> for
more information.</dd>
<dt>-start</dt>
<dd>Start the logexpect thread in the background.</dd>
<dt>-wait</dt>
<dd>Wait for the logexpect thread to finish</dd>
</dl>
<p>VSL arguments (similar to the varnishlog options):</p>
<dl class="docutils">
<dt>-b|-c</dt>
<dd>Process only backend/client records.</dd>
<dt>-C</dt>
<dd>Use caseless regex</dd>
<dt>-i <taglist></dt>
<dd>Include tags</dd>
<dt>-I <[taglist:]regex></dt>
<dd>Include by regex</dd>
<dt>-T <seconds></dt>
<dd>Transaction end timeout</dd>
</dl>
<p>And the arguments of the specifications lines are:</p>
<dl class="docutils">
<dt>skip: [uint|*]</dt>
<dd>Max number of record to skip</dd>
<dt>vxid: [uint|*|=]</dt>
<dd>vxid to match</dd>
<dt>tag: [tagname|*|=]</dt>
<dd>Tag to match against</dd>
<dt>regex:</dt>
<dd>regular expression to match against (optional)</dd>
</dl>
<p>For skip, vxid and tag, ‘*’ matches anything, ‘=’ expects the value of the
previous matched record.</p>
</div>
<div class="section" id="process">
<h4>process<a class="headerlink" href="#process" title="Permalink to this headline">¶</a></h4>
<p>Run a process with stdin+stdout on a pseudo-terminal and stderr on a pipe.</p>
<p>Output from the pseudo-terminal is copied verbatim to ${pNAME_out},
and the -log/-dump/-hexdump flags will also put it in the vtc-log.</p>
<p>The pseudo-terminal is not in ECHO mode, but if the programs run set
it to ECHO mode (“stty sane”) any input sent to the process will also
appear in this stream because of the ECHO.</p>
<p>Output from the stderr-pipe is copied verbatim to ${pNAME_err}, and
is always included in the vtc_log.</p>
<blockquote>
<div><dl class="docutils">
<dt>process pNAME SPEC [-log] [-dump] [-hexdump] [-expect-exit N]</dt>
<dd>[-start] [-run]
[-write STRING] [-writeln STRING]
[-kill STRING] [-stop] [-wait] [-close]</dd>
</dl>
</div></blockquote>
<dl class="docutils">
<dt>pNAME</dt>
<dd>Name of the process. It must start with ‘p’.</dd>
<dt>SPEC</dt>
<dd>The command(s) to run in this process.</dd>
<dt>-hexdump</dt>
<dd>Log output with vtc_hexdump(). Must be before -start/-run.</dd>
<dt>-dump</dt>
<dd>Log output with vtc_dump(). Must be before -start/-run.</dd>
<dt>-log</dt>
<dd>Log output with VLU/vtc_log(). Must be before -start/-run.</dd>
<dt>-start</dt>
<dd>Start the process.</dd>
<dt>-expect-exit N</dt>
<dd>Expect exit status N</dd>
<dt>-wait</dt>
<dd>Wait for the process to finish.</dd>
<dt>-run</dt>
<dd><p class="first">Shorthand for -start -wait.</p>
<p>In most cases, if you just want to start a process and wait for it
to finish, you can use the <code class="docutils literal notranslate"><span class="pre">shell</span></code> command instead.
The following commands are equivalent:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">shell</span> <span class="s2">"do --something"</span>
<span class="n">process</span> <span class="n">p1</span> <span class="s2">"do --something"</span> <span class="o">-</span><span class="n">run</span>
</pre></div>
</div>
<p class="last">However, you may use the the <code class="docutils literal notranslate"><span class="pre">process</span></code> variant to conveniently
collect the standard input and output without dealing with shell
redirections yourself. The <code class="docutils literal notranslate"><span class="pre">shell</span></code> command can also expect an
expression from either output, consider using it if you only need
to match one.</p>
</dd>
<dt>-kill STRING</dt>
<dd><p class="first">Send a signal to the process. The argument can be either
the string “TERM”, “INT”, or “KILL” for SIGTERM, SIGINT or SIGKILL
signals, respectively, or a hyphen (-) followed by the signal
number.</p>
<p>If you need to use other signal names, you can use the <code class="docutils literal notranslate"><span class="pre">kill</span></code>(1)
command directly:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">shell</span> <span class="s2">"kill -USR1 $</span><span class="si">{pNAME_pid}</span><span class="s2">"</span>
</pre></div>
</div>
<p class="last">Note that SIGHUP usage is discouraged in test cases.</p>
</dd>
<dt>-stop</dt>
<dd>Shorthand for -kill TERM.</dd>
<dt>-write STRING</dt>
<dd>Write a string to the process’ stdin.</dd>
<dt>-writeln STRING</dt>
<dd>Same as -write followed by a newline (\n).</dd>
<dt>-writehex HEXSTRING</dt>
<dd>Same as -write but interpreted as hexadecimal bytes.</dd>
<dt>-need-bytes [+]NUMBER</dt>
<dd>Wait until at least NUMBER bytes have been received in total.
If ‘+’ is prefixed, NUMBER new bytes must be received.</dd>
<dt>-expect-text LIN COL PAT</dt>
<dd>Wait for PAT to appear at LIN,COL on the virtual screen.
Lines and columns are numbered 1…N
LIN==0 means “on any line”
COL==0 means “anywhere on the line”</dd>
<dt>-close</dt>
<dd>Alias for “-kill HUP”</dd>
<dt>-screen_dump</dt>
<dd>Dump the virtual screen into vtc_log</dd>
</dl>
</div>
<div class="section" id="setenv">
<h4>setenv<a class="headerlink" href="#setenv" title="Permalink to this headline">¶</a></h4>
<p>Set or change an environment variable:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">setenv</span> <span class="n">FOO</span> <span class="s2">"bar baz"</span>
</pre></div>
</div>
<p>The above will set the environment variable $FOO to the value
provided. There is also an <code class="docutils literal notranslate"><span class="pre">-ifunset</span></code> argument which will only
set the value if the the environment variable does not already
exist:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">setenv</span> <span class="o">-</span><span class="n">ifunset</span> <span class="n">FOO</span> <span class="n">quux</span>
</pre></div>
</div>
</div>
<div class="section" id="shell">
<h4>shell<a class="headerlink" href="#shell" title="Permalink to this headline">¶</a></h4>
<p>NOTE: This command is available everywhere commands are given.</p>
<p>Pass the string given as argument to a shell. If you have multiple
commands to run, you can use curly brackets to describe a multi-lines
script, eg:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">shell</span> <span class="p">{</span>
<span class="n">echo</span> <span class="n">begin</span>
<span class="n">cat</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">fstab</span>
<span class="n">echo</span> <span class="n">end</span>
<span class="p">}</span>
</pre></div>
</div>
<p>By default a zero exit code is expected, otherwise the vtc will fail.</p>
<p>Notice that the commandstring is prefixed with “exec 2>&1;” to combine
stderr and stdout back to the test process.</p>
<p>Optional arguments:</p>
<dl class="docutils">
<dt>-err</dt>
<dd>Expect non-zero exit code.</dd>
<dt>-exit N</dt>
<dd>Expect exit code N instead of zero.</dd>
<dt>-expect STRING</dt>
<dd>Expect string to be found in stdout+err.</dd>
<dt>-match REGEXP</dt>
<dd>Expect regexp to match the stdout+err output.</dd>
</dl>
</div>
<div class="section" id="stream">
<h4>stream<a class="headerlink" href="#stream" title="Permalink to this headline">¶</a></h4>
<p>(note: this section is at the top-level for easier navigation, but
it’s part of the client/server specification)</p>
<p>Streams map roughly to a request in HTTP/2, a request is sent on
stream N, the response too, then the stream is discarded. The main
exception is the first stream, 0, that serves as coordinator.</p>
<p>Stream syntax follow the client/server one:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">stream</span> <span class="n">ID</span> <span class="p">[</span><span class="n">SPEC</span><span class="p">]</span> <span class="p">[</span><span class="n">ACTION</span><span class="p">]</span>
</pre></div>
</div>
<p>ID is the HTTP/2 stream number, while SPEC describes what will be
done in that stream.</p>
<p>Note that, when parsing a stream action, if the entity isn’t operating
in HTTP/2 mode, these spec is ran before:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">txpri</span><span class="o">/</span><span class="n">rxpri</span> <span class="c1"># client/server</span>
<span class="n">stream</span> <span class="mi">0</span> <span class="p">{</span>
<span class="n">txsettings</span>
<span class="n">rxsettings</span>
<span class="n">txsettings</span> <span class="o">-</span><span class="n">ack</span>
<span class="n">rxsettings</span>
<span class="n">expect</span> <span class="n">settings</span><span class="o">.</span><span class="n">ack</span> <span class="o">==</span> <span class="n">true</span>
<span class="p">}</span> <span class="o">-</span><span class="n">run</span>
</pre></div>
</div>
<p>And HTTP/2 mode is then activated before parsing the specification.</p>
<div class="section" id="actions">
<h5>Actions<a class="headerlink" href="#actions" title="Permalink to this headline">¶</a></h5>
<dl class="docutils">
<dt>-start</dt>
<dd>Run the specification in a thread, giving back control immediately.</dd>
<dt>-wait</dt>
<dd>Wait for the started thread to finish running the spec.</dd>
<dt>-run</dt>
<dd>equivalent to calling <code class="docutils literal notranslate"><span class="pre">-start</span></code> then <code class="docutils literal notranslate"><span class="pre">-wait</span></code>.</dd>
</dl>
</div>
<div class="section" id="id1">
<h5>Specification<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h5>
<p>The specification of a stream follows the exact same rules as one for a
client or a server.</p>
<div class="section" id="txreq-txresp-txcont-txpush">
<h6>txreq, txresp, txcont, txpush<a class="headerlink" href="#txreq-txresp-txcont-txpush" title="Permalink to this headline">¶</a></h6>
<p>These four commands are about sending headers. txreq and txresp
will send HEADER frames; txcont will send CONTINUATION frames; txpush
PUSH frames.
The only difference between txreq and txresp are the default headers
set by each of them.</p>
<dl class="docutils">
<dt>-noadd</dt>
<dd>Do not add default headers. Useful to avoid duplicates when sending
default headers using <code class="docutils literal notranslate"><span class="pre">-hdr</span></code>, <code class="docutils literal notranslate"><span class="pre">-idxHdr</span></code> and <code class="docutils literal notranslate"><span class="pre">-litIdxHdr</span></code>.</dd>
<dt>-status INT (txresp)</dt>
<dd>Set the :status pseudo-header.</dd>
<dt>-url STRING (txreq, txpush)</dt>
<dd>Set the :path pseudo-header.</dd>
<dt>-req STRING (txreq, txpush)</dt>
<dd>Set the :method pseudo-header.</dd>
<dt>-scheme STRING (txreq, txpush)</dt>
<dd>Set the :scheme pseudo-header.</dd>
<dt>-hdr STRING1 STRING2</dt>
<dd>Insert a header, STRING1 being the name, and STRING2 the value.</dd>
<dt>-idxHdr INT</dt>
<dd>Insert an indexed header, using INT as index.</dd>
<dt>-litIdxHdr inc|not|never INT huf|plain STRING</dt>
<dd><p class="first">Insert an literal, indexed header. The first argument specify if the
header should be added to the table, shouldn’t, or mustn’t be
compressed if/when retransmitted.</p>
<p>INT is the idex of the header name to use.</p>
<p>The third argument informs about the Huffman encoding: yes (huf) or
no (plain).</p>
<p class="last">The last term is the literal value of the header.</p>
</dd>
<dt>-litHdr inc|not|never huf|plain STRING1 huf|plain STRING2</dt>
<dd><p class="first">Insert a literal header, with the same first argument as
<code class="docutils literal notranslate"><span class="pre">-litIdxHdr</span></code>.</p>
<p class="last">The second and third terms tell what the name of the header is and if
it should be Huffman-encoded, while the last two do the same
regarding the value.</p>
</dd>
<dt>-body STRING (txreq, txresp)</dt>
<dd>Specify a body, effectively putting STRING into a DATA frame after
the HEADER frame is sent.</dd>
<dt>-bodylen INT (txreq, txresp)</dt>
<dd>Do the same thing as <code class="docutils literal notranslate"><span class="pre">-body</span></code> but generate an string of INT length
for you.</dd>
<dt>-nostrend (txreq, txresp)</dt>
<dd>Don’t set the END_STREAM flag automatically, making the peer expect
a body after the headers.</dd>
<dt>-nohdrend</dt>
<dd>Don’t set the END_HEADERS flag automatically, making the peer expect
more HEADER frames.</dd>
<dt>-dep INT (txreq, txresp)</dt>
<dd>Tell the peer that this content depends on the stream with the INT
id.</dd>
<dt>-ex (txreq, txresp)</dt>
<dd>Make the dependency exclusive (<code class="docutils literal notranslate"><span class="pre">-dep</span></code> is still needed).</dd>
<dt>-weight (txreq, txresp)</dt>
<dd>Set the weight for the dependency.</dd>
<dt>-promised INT (txpush)</dt>
<dd>The id of the promised stream.</dd>
<dt>-pad STRING / -padlen INT (txreq, txresp, txpush)</dt>
<dd>Add string as padding to the frame, either the one you provided with
-pad, or one that is generated for you, of length INT is -padlen
case.</dd>
</dl>
</div>
<div class="section" id="txdata">
<h6>txdata<a class="headerlink" href="#txdata" title="Permalink to this headline">¶</a></h6>
<p>By default, data frames are empty. The receiving end will know the whole body
has been delivered thanks to the END_STREAM flag set in the last DATA frame,
and txdata automatically set it.</p>
<dl class="docutils">
<dt>-data STRING</dt>
<dd>Data to be embedded into the frame.</dd>
<dt>-datalen INT</dt>
<dd>Generate and INT-bytes long string to be sent in the frame.</dd>
<dt>-pad STRING / -padlen INT</dt>
<dd>Add string as padding to the frame, either the one you provided with
-pad, or one that is generated for you, of length INT is -padlen
case.</dd>
<dt>-nostrend</dt>
<dd>Don’t set the END_STREAM flag, allowing to send more data on this
stream.</dd>
</dl>
</div>
<div class="section" id="rxreq-rxresp">
<h6>rxreq, rxresp<a class="headerlink" href="#rxreq-rxresp" title="Permalink to this headline">¶</a></h6>
<p>These are two convenience functions to receive headers and body of an
incoming request or response. The only difference is that rxreq can only be
by a server, and rxresp by a client.</p>
</div>
<div class="section" id="rxhdrs">
<h6>rxhdrs<a class="headerlink" href="#rxhdrs" title="Permalink to this headline">¶</a></h6>
<p><code class="docutils literal notranslate"><span class="pre">rxhdrs</span></code> will expect one HEADER frame, then, depending on the arguments,
zero or more CONTINUATION frame.</p>
<dl class="docutils">
<dt>-all</dt>
<dd>Keep waiting for CONTINUATION frames until END_HEADERS flag is seen.</dd>
<dt>-some INT</dt>
<dd>Retrieve INT - 1 CONTINUATION frames after the HEADER frame.</dd>
</dl>
</div>
<div class="section" id="rxpush">
<h6>rxpush<a class="headerlink" href="#rxpush" title="Permalink to this headline">¶</a></h6>
<p>This works like <code class="docutils literal notranslate"><span class="pre">rxhdrs</span></code>, expecting a PUSH frame and then zero or more
CONTINUATION frames.</p>
<dl class="docutils">
<dt>-all</dt>
<dd>Keep waiting for CONTINUATION frames until END_HEADERS flag is seen.</dd>
<dt>-some INT</dt>
<dd>Retrieve INT - 1 CONTINUATION frames after the PUSH frame.</dd>
</dl>
</div>
<div class="section" id="rxdata">
<h6>rxdata<a class="headerlink" href="#rxdata" title="Permalink to this headline">¶</a></h6>
<p>Receiving data is done using the <code class="docutils literal notranslate"><span class="pre">rxdata</span></code> keywords and will retrieve one
DATA frame, if you wish to receive more, you can use these two convenience
arguments:</p>
<dl class="docutils">
<dt>-all</dt>
<dd>keep waiting for DATA frame until one sets the END_STREAM flag</dd>
<dt>-some INT</dt>
<dd>retrieve INT DATA frames.</dd>
</dl>
<p>Receive a frame, any frame.</p>
</div>
<div class="section" id="sendhex">
<h6>sendhex<a class="headerlink" href="#sendhex" title="Permalink to this headline">¶</a></h6>
<p>Push bytes directly on the wire. sendhex takes exactly one argument: a string
describing the bytes, in hex notation, with possible whitespaces between
them. Here’s an example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sendhex</span> <span class="s2">"00 00 08 00 0900 8d"</span>
</pre></div>
</div>
</div>
<div class="section" id="rxgoaway">
<h6>rxgoaway<a class="headerlink" href="#rxgoaway" title="Permalink to this headline">¶</a></h6>
<p>Receive a GOAWAY frame.</p>
</div>
<div class="section" id="txgoaway">
<h6>txgoaway<a class="headerlink" href="#txgoaway" title="Permalink to this headline">¶</a></h6>
<p>Possible options include:</p>
<dl class="docutils">
<dt>-err STRING|INT</dt>
<dd>set the error code to explain the termination. The second argument
can be a integer or the string version of the error code as found
in rfc7540#7.</dd>
<dt>-laststream INT</dt>
<dd>the id of the “highest-numbered stream identifier for which the
sender of the GOAWAY frame might have taken some action on or might
yet take action on”.</dd>
<dt>-debug</dt>
<dd>specify the debug data, if any to append to the frame.</dd>
</dl>
</div>
<div class="section" id="rxping">
<h6>rxping<a class="headerlink" href="#rxping" title="Permalink to this headline">¶</a></h6>
<p>Receive a PING frame.</p>
</div>
<div class="section" id="txping">
<h6>txping<a class="headerlink" href="#txping" title="Permalink to this headline">¶</a></h6>
<p>Send PING frame.</p>
<dl class="docutils">
<dt>-data STRING</dt>
<dd>specify the payload of the frame, with STRING being an 8-char string.</dd>
<dt>-ack</dt>
<dd>set the ACK flag.</dd>
</dl>
</div>
<div class="section" id="rxprio">
<h6>rxprio<a class="headerlink" href="#rxprio" title="Permalink to this headline">¶</a></h6>
<p>Receive a PRIORITY frame.</p>
</div>
<div class="section" id="txprio">
<h6>txprio<a class="headerlink" href="#txprio" title="Permalink to this headline">¶</a></h6>
<p>Send a PRIORITY frame</p>
<dl class="docutils">
<dt>-stream INT</dt>
<dd>indicate the id of the stream the sender stream depends on.</dd>
<dt>-ex</dt>
<dd>the dependency should be made exclusive (only this streams depends on
the parent stream).</dd>
<dt>-weight INT</dt>
<dd>an 8-bits integer is used to balance priority between streams
depending on the same streams.</dd>
</dl>
</div>
<div class="section" id="rxrst">
<h6>rxrst<a class="headerlink" href="#rxrst" title="Permalink to this headline">¶</a></h6>
<p>Receive a RST_STREAM frame.</p>
</div>
<div class="section" id="txrst">
<h6>txrst<a class="headerlink" href="#txrst" title="Permalink to this headline">¶</a></h6>
<p>Send a RST_STREAM frame. By default, txrst will send a 0 error code
(NO_ERROR).</p>
<dl class="docutils">
<dt>-err STRING|INT</dt>
<dd>Sets the error code to be sent. The argument can be an integer or a
string describing the error, such as NO_ERROR, or CANCEL (see
rfc7540#11.4 for more strings).</dd>
</dl>
</div>
<div class="section" id="rxsettings">
<h6>rxsettings<a class="headerlink" href="#rxsettings" title="Permalink to this headline">¶</a></h6>
<p>Receive a SETTINGS frame.</p>
</div>
<div class="section" id="txsettings">
<h6>txsettings<a class="headerlink" href="#txsettings" title="Permalink to this headline">¶</a></h6>
<p>SETTINGS frames must be acknowledge, arguments are as follow (most of them
are from rfc7540#6.5.2):</p>
<dl class="docutils">
<dt>-hdrtbl INT</dt>
<dd>headers table size</dd>
<dt>-push BOOL</dt>
<dd>whether push frames are accepted or not</dd>
<dt>-maxstreams INT</dt>
<dd>maximum concurrent streams allowed</dd>
<dt>-winsize INT</dt>
<dd>sender’s initial window size</dd>
<dt>-framesize INT</dt>
<dd>largest frame size authorized</dd>
<dt>-hdrsize INT</dt>
<dd>maximum size of the header list authorized</dd>
<dt>-ack</dt>
<dd>set the ack bit</dd>
</dl>
</div>
<div class="section" id="rxwinup">
<h6>rxwinup<a class="headerlink" href="#rxwinup" title="Permalink to this headline">¶</a></h6>
<p>Receive a WINDOW_UPDATE frame.</p>
</div>
<div class="section" id="txwinup">
<h6>txwinup<a class="headerlink" href="#txwinup" title="Permalink to this headline">¶</a></h6>
<p>Transmit a WINDOW_UPDATE frame, increasing the amount of credit of the
connection (from stream 0) or of the stream (any other stream).</p>
<dl class="docutils">
<dt>-size INT</dt>
<dd>give INT credits to the peer.</dd>
<dt>write_body STRING</dt>
<dd>Same as the <code class="docutils literal notranslate"><span class="pre">write_body</span></code> command for HTTP/1.</dd>
</dl>
</div>
<div class="section" id="expect">
<h6>expect<a class="headerlink" href="#expect" title="Permalink to this headline">¶</a></h6>
<p>expect in stream works as it does in client or server, except that the
elements compared will be different.</p>
<p>Most of these elements will be frame specific, meaning that the last frame
received on that stream must of the correct type.</p>
<p>Here the list of keywords you can look at.</p>
</div>
</div>
</div>
<div class="section" id="syslog">
<h4>syslog<a class="headerlink" href="#syslog" title="Permalink to this headline">¶</a></h4>
<p>Define and interact with syslog instances (for use with haproxy)</p>
<p>To define a syslog server, you’ll use this syntax:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">syslog</span> <span class="n">SNAME</span>
</pre></div>
</div>
<p>Arguments:</p>
<dl class="docutils">
<dt>SNAME</dt>
<dd>Identify the syslog server with a string which must start with ‘S’.</dd>
<dt>-level STRING</dt>
<dd>Set the default syslog priority level used by any subsequent “recv”
command.
Any syslog dgram with a different level will be skipped by
“recv” command. This default level value may be superseded
by “recv” command if supplied as first argument: “recv <level>”.</dd>
<dt>-start</dt>
<dd>Start the syslog server thread in the background.</dd>
<dt>-repeat</dt>
<dd><dl class="first last docutils">
<dt>Instead of processing the specification only once, do it</dt>
<dd>NUMBER times.</dd>
</dl>
</dd>
<dt>-bind</dt>
<dd>Bind the syslog socket to a local address.</dd>
<dt>-wait</dt>
<dd>Wait for that thread to terminate.</dd>
<dt>-stop</dt>
<dd>Stop the syslog server thread.</dd>
</dl>
</div>
<div class="section" id="varnish">
<h4>varnish<a class="headerlink" href="#varnish" title="Permalink to this headline">¶</a></h4>
<p>Define and interact with varnish instances.</p>
<p>To define a Varnish server, you’ll use this syntax:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">varnish</span> <span class="n">vNAME</span> <span class="p">[</span><span class="o">-</span><span class="n">arg</span> <span class="n">STRING</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">vcl</span> <span class="n">STRING</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">vcl</span><span class="o">+</span><span class="n">backend</span> <span class="n">STRING</span><span class="p">]</span>
<span class="p">[</span><span class="o">-</span><span class="n">errvcl</span> <span class="n">STRING</span> <span class="n">STRING</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">jail</span> <span class="n">STRING</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">proto</span> <span class="n">PROXY</span><span class="p">]</span>
</pre></div>
</div>
<p>The first <code class="docutils literal notranslate"><span class="pre">varnish</span> <span class="pre">vNAME</span></code> invocation will start the varnishd master
process in the background, waiting for the <code class="docutils literal notranslate"><span class="pre">-start</span></code> switch to actually
start the child.</p>
<p>Types used in the description below:</p>
<dl class="docutils">
<dt>PATTERN</dt>
<dd>is a ‘glob’ style pattern (ie: fnmatch(3)) as used in shell filename
expansion.</dd>
</dl>
<p>Arguments:</p>
<dl class="docutils">
<dt>vNAME</dt>
<dd>Identify the Varnish server with a string, it must starts with ‘v’.</dd>
<dt>-arg STRING</dt>
<dd>Pass an argument to varnishd, for example “-h simple_list”.</dd>
<dt>-vcl STRING</dt>
<dd>Specify the VCL to load on this Varnish instance. You’ll probably
want to use multi-lines strings for this ({…}).</dd>
<dt>-vcl+backend STRING</dt>
<dd>Do the exact same thing as -vcl, but adds the definition block of
known backends (ie. already defined).</dd>
<dt>-errvcl STRING1 STRING2</dt>
<dd>Load STRING2 as VCL, expecting it to fail, and Varnish to send an
error string matching STRING2</dd>
<dt>-jail STRING</dt>
<dd>Look at <code class="docutils literal notranslate"><span class="pre">man</span> <span class="pre">varnishd</span></code> (-j) for more information.</dd>
<dt>-proto PROXY</dt>
<dd>Have Varnish use the proxy protocol. Note that PROXY here is the
actual string.</dd>
</dl>
<p>You can decide to start the Varnish instance and/or wait for several events:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">varnish</span> <span class="n">vNAME</span> <span class="p">[</span><span class="o">-</span><span class="n">start</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">wait</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">wait</span><span class="o">-</span><span class="n">running</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">wait</span><span class="o">-</span><span class="n">stopped</span><span class="p">]</span>
</pre></div>
</div>
<dl class="docutils">
<dt>-start</dt>
<dd>Start the child process.</dd>
<dt>-stop</dt>
<dd>Stop the child process.</dd>
<dt>-syntax</dt>
<dd>Set the VCL syntax level for this command (default: 4.1)</dd>
<dt>-wait</dt>
<dd>Wait for that instance to terminate.</dd>
<dt>-wait-running</dt>
<dd>Wait for the Varnish child process to be started.</dd>
<dt>-wait-stopped</dt>
<dd>Wait for the Varnish child process to stop.</dd>
<dt>-cleanup</dt>
<dd>Once Varnish is stopped, clean everything after it. This is only used
in very few tests and you should never need it.</dd>
</dl>
<p>Once Varnish is started, you can talk to it (as you would through
<code class="docutils literal notranslate"><span class="pre">varnishadm</span></code>) with these additional switches:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">varnish</span> <span class="n">vNAME</span> <span class="p">[</span><span class="o">-</span><span class="n">cli</span> <span class="n">STRING</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">cliok</span> <span class="n">STRING</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">clierr</span> <span class="n">STRING</span><span class="p">]</span>
<span class="p">[</span><span class="o">-</span><span class="n">clijson</span> <span class="n">STRING</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">expect</span> <span class="n">STRING</span> <span class="n">OP</span> <span class="n">NUMBER</span><span class="p">]</span>
</pre></div>
</div>
<dl class="docutils">
<dt>-cli STRING|-cliok STRING|-clierr STATUS STRING|-cliexpect REGEXP STRING</dt>
<dd>All four of these will send STRING to the CLI, the only difference
is what they expect the result to be. -cli doesn’t expect
anything, -cliok expects 200, -clierr expects STATUS, and
-cliexpect expects the REGEXP to match the returned response.</dd>
<dt>-clijson STRING</dt>
<dd>Send STRING to the CLI, expect success (CLIS_OK/200) and check
that the response is parsable JSON.</dd>
<dt>-expect PATTERN OP NUMBER</dt>
<dd><p class="first">Look into the VSM and make sure the first VSC counter identified by
PATTERN has a correct value. OP can be ==, >, >=, <, <=. For
example:</p>
<div class="last highlight-default notranslate"><div class="highlight"><pre><span></span>varnish v1 -expect SM?.s1.g_space > 1000000
</pre></div>
</div>
</dd>
<dt>-expectexit NUMBER</dt>
<dd>Expect varnishd to exit(3) with this value</dd>
<dt>-vsc PATTERN</dt>
<dd>Dump VSC counters matching PATTERN.</dd>
<dt>-vsl_catchup</dt>
<dd>Wait until the logging thread has idled to make sure that all
the generated log is flushed</dd>
</dl>
</div>
<div class="section" id="varnishtest">
<h4>varnishtest<a class="headerlink" href="#varnishtest" title="Permalink to this headline">¶</a></h4>
<p>Alternate name for ‘vtest’, see above.</p>
</div>
<div class="section" id="vtest">
<h4>vtest<a class="headerlink" href="#vtest" title="Permalink to this headline">¶</a></h4>
<p>This should be the first command in your vtc as it will identify the test
case with a short yet descriptive sentence. It takes exactly one argument, a
string, eg:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">vtest</span> <span class="s2">"Check that vtest is actually a valid command"</span>
</pre></div>
</div>
<p>It will also print that string in the log.</p>
</div>
</div>
<div class="section" id="history">
<h3>HISTORY<a class="headerlink" href="#history" title="Permalink to this headline">¶</a></h3>
<p>This document has been written by Guillaume Quintard.</p>
</div>
<div class="section" id="see-also">
<h3>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><a class="reference internal" href="varnishtest.html#varnishtest-1"><span class="std std-ref">varnishtest</span></a></li>
<li><a class="reference internal" href="vmod_generated.html#vmod-vtc-3"><span class="std std-ref">vmod_vtc</span></a></li>
</ul>
</div>
<div class="section" id="copyright">
<h3>COPYRIGHT<a class="headerlink" href="#copyright" title="Permalink to this headline">¶</a></h3>
<p>This document is licensed under the same licence as Varnish
itself. See LICENCE for details.</p>
<ul class="simple">
<li>Copyright (c) 2006-2016 Varnish Software AS</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">VTC</a><ul>
<li><a class="reference internal" href="#varnish-test-case-syntax">Varnish Test Case Syntax</a><ul>
<li><a class="reference internal" href="#overview">OVERVIEW</a></li>
<li><a class="reference internal" href="#parsing">PARSING</a><ul>
<li><a class="reference internal" href="#words-and-strings">Words and strings</a></li>
<li><a class="reference internal" href="#comments">Comments</a></li>
<li><a class="reference internal" href="#lines-and-commands">Lines and commands</a></li>
</ul>
</li>
<li><a class="reference internal" href="#syntax">SYNTAX</a><ul>
<li><a class="reference internal" href="#barrier">barrier</a></li>
<li><a class="reference internal" href="#client-server">client/server</a><ul>
<li><a class="reference internal" href="#arguments">Arguments</a></li>
<li><a class="reference internal" href="#macros-and-automatic-behaviour">Macros and automatic behaviour</a></li>
<li><a class="reference internal" href="#specification">Specification</a></li>
</ul>
</li>
<li><a class="reference internal" href="#delay">delay</a></li>
<li><a class="reference internal" href="#err-shell">err_shell</a></li>
<li><a class="reference internal" href="#feature">feature</a></li>
<li><a class="reference internal" href="#haproxy">haproxy</a><ul>
<li><a class="reference internal" href="#haproxy-cli-specification">haproxy CLI Specification</a></li>
</ul>
</li>
<li><a class="reference internal" href="#logexpect">logexpect</a></li>
<li><a class="reference internal" href="#process">process</a></li>
<li><a class="reference internal" href="#setenv">setenv</a></li>
<li><a class="reference internal" href="#shell">shell</a></li>
<li><a class="reference internal" href="#stream">stream</a><ul>
<li><a class="reference internal" href="#actions">Actions</a></li>
<li><a class="reference internal" href="#id1">Specification</a><ul>
<li><a class="reference internal" href="#txreq-txresp-txcont-txpush">txreq, txresp, txcont, txpush</a></li>
<li><a class="reference internal" href="#txdata">txdata</a></li>
<li><a class="reference internal" href="#rxreq-rxresp">rxreq, rxresp</a></li>
<li><a class="reference internal" href="#rxhdrs">rxhdrs</a></li>
<li><a class="reference internal" href="#rxpush">rxpush</a></li>
<li><a class="reference internal" href="#rxdata">rxdata</a></li>
<li><a class="reference internal" href="#sendhex">sendhex</a></li>
<li><a class="reference internal" href="#rxgoaway">rxgoaway</a></li>
<li><a class="reference internal" href="#txgoaway">txgoaway</a></li>
<li><a class="reference internal" href="#rxping">rxping</a></li>
<li><a class="reference internal" href="#txping">txping</a></li>
<li><a class="reference internal" href="#rxprio">rxprio</a></li>
<li><a class="reference internal" href="#txprio">txprio</a></li>
<li><a class="reference internal" href="#rxrst">rxrst</a></li>
<li><a class="reference internal" href="#txrst">txrst</a></li>
<li><a class="reference internal" href="#rxsettings">rxsettings</a></li>
<li><a class="reference internal" href="#txsettings">txsettings</a></li>
<li><a class="reference internal" href="#rxwinup">rxwinup</a></li>
<li><a class="reference internal" href="#txwinup">txwinup</a></li>
<li><a class="reference internal" href="#expect">expect</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#syslog">syslog</a></li>
<li><a class="reference internal" href="#varnish">varnish</a></li>
<li><a class="reference internal" href="#varnishtest">varnishtest</a></li>
<li><a class="reference internal" href="#vtest">vtest</a></li>
</ul>
</li>
<li><a class="reference internal" href="#history">HISTORY</a></li>
<li><a class="reference internal" href="#see-also">SEE ALSO</a></li>
<li><a class="reference internal" href="#copyright">COPYRIGHT</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="vsl-query.html"
title="previous chapter">vsl-query</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="../whats-new/index.html"
title="next chapter">What’s new / Upgrading</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/reference/vtc.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../whats-new/index.html" title="What’s new / Upgrading"
>next</a> |</li>
<li class="right" >
<a href="vsl-query.html" title="vsl-query"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Varnish version 6.0.3 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="index.html" >The Varnish Reference Manual</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2010-2014, Varnish Software AS.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.6.
</div>
</body>
</html>