1VARNISHTEST(1) VARNISHTEST(1)
2
3
4
6 varnishtest - Test program for Varnish
7
9 varnishtest [-n iter] [-q] [-v] file [file ...]
10
12 The varnishtest program is a script driven program used to test the
13 varnish HTTP accelerator.
14
15 The varnishtest program, when started and given one or more script
16 files, can create a number of threads representing backends, some
17 threads representing clients, and a varnishd process.
18
19 The following options are available:
20
21 -n iter
22 Run iter number of iterations.
23
24 -q Be quiet.
25
26 -v Be verbose.
27
28 -t Dunno.
29
30 file File to use as a script
31
33 Example script
34 # Start a varnish instance called "v1"
35 varnish v1 -arg "-b localhost:9080" -start
36
37 # Create a server thread called "s1"
38 server s1 {
39 # Receive a request
40 rxreq
41 # Send a standard response
42 txresp -hdr "Connection: close" -body "012345\n"
43 }
44
45 # Start the server thread
46 server s1 -start
47
48 # Create a client thread called "c1"
49 client c1 {
50 # Send a request
51 txreq -url "/"
52 # Wait for a response
53 rxresp
54 # Insist that it be a success
55 expect resp.status == 200
56 }
57
58 # Run the client
59 client c1 -run
60
61 # Wait for the server to die
62 server s1 -wait
63
64 # (Forcefully) Stop the varnish instance.
65 varnish v1 -stop
66
67 Example script output
68 The output, running this script looks as follows. The "bargraph" at the
69 beginning of the line is an indication of the level of detail in the
70 line. The second field where the message comes from. The rest of the
71 line is anyones guess :-)
72
73 # TEST tests/b00000.vtc starting
74 ### v1 CMD: cd ../varnishd && ./varnishd -d -d -n v1 -a :9081 -T :9001 -b localhost:9080
75 ### v1 opening CLI connection
76 #### v1 debug| NB: Storage size limited to 2GB on 32 bit architecture,\n
77 #### v1 debug| NB: otherwise we could run out of address space.\n
78 #### v1 debug| storage_file: filename: ./varnish.Shkoq5 (unlinked) size 2047 MB.\n
79 ### v1 CLI connection fd = 3
80 #### v1 CLI TX| start
81 #### v1 debug| Using old SHMFILE\n
82 #### v1 debug| Notice: locking SHMFILE in core failed: Operation not permitted\n
83 #### v1 debug| bind(): Address already in use\n
84 #### v1 debug| rolling(1)...
85 #### v1 debug| \n
86 #### v1 debug| rolling(2)...\n
87 #### v1 debug| Debugging mode, enter "start" to start child\n
88 ### v1 CLI 200 <start>
89 ## s1 Starting server
90 ### s1 listen on :9080 (fd 6)
91 ## c1 Starting client
92 ## c1 Waiting for client
93 ## s1 started on :9080
94 ## c1 started
95 ### c1 connect to :9081
96 ### c1 connected to :9081 fd is 8
97 #### c1 | GET / HTTP/1.1\r\n
98 #### c1 | \r\n
99 ### c1 rxresp
100 #### s1 Accepted socket 7
101 ### s1 rxreq
102 #### s1 | GET / HTTP/1.1\r\n
103 #### s1 | X-Varnish: 422080121\r\n
104 #### s1 | X-Forwarded-For: 127.0.0.1\r\n
105 #### s1 | Host: localhost\r\n
106 #### s1 | \r\n
107 #### s1 http[ 0] | GET
108 #### s1 http[ 1] | /
109 #### s1 http[ 2] | HTTP/1.1
110 #### s1 http[ 3] | X-Varnish: 422080121
111 #### s1 http[ 4] | X-Forwarded-For: 127.0.0.1
112 #### s1 http[ 5] | Host: localhost
113 #### s1 | HTTP/1.1 200 Ok\r\n
114 #### s1 | Connection: close\r\n
115 #### s1 | \r\n
116 #### s1 | 012345\n
117 #### s1 | \r\n
118 ## s1 ending
119 #### c1 | HTTP/1.1 200 Ok\r\n
120 #### c1 | Content-Length: 9\r\n
121 #### c1 | Date: Mon, 16 Jun 2008 22:16:55 GMT\r\n
122 #### c1 | X-Varnish: 422080121\r\n
123 #### c1 | Age: 0\r\n
124 #### c1 | Via: 1.1 varnish\r\n
125 #### c1 | Connection: keep-alive\r\n
126 #### c1 | \r\n
127 #### c1 http[ 0] | HTTP/1.1
128 #### c1 http[ 1] | 200
129 #### c1 http[ 2] | Ok
130 #### c1 http[ 3] | Content-Length: 9
131 #### c1 http[ 4] | Date: Mon, 16 Jun 2008 22:16:55 GMT
132 #### c1 http[ 5] | X-Varnish: 422080121
133 #### c1 http[ 6] | Age: 0
134 #### c1 http[ 7] | Via: 1.1 varnish
135 #### c1 http[ 8] | Connection: keep-alive
136 #### c1 EXPECT resp.status (200) == 200 (200) match
137 ## c1 ending
138 ## s1 Waiting for server
139 #### v1 CLI TX| stop
140 ### v1 CLI 200 <stop>
141 # TEST tests/b00000.vtc completed
142
143 If instead of 200 we had expected 201 with the line::
144
145 expect resp.status == 201
146
147 The output would have ended with::
148
149 #### c1 http[ 0] | HTTP/1.1
150 #### c1 http[ 1] | 200
151 #### c1 http[ 2] | Ok
152 #### c1 http[ 3] | Content-Length: 9
153 #### c1 http[ 4] | Date: Mon, 16 Jun 2008 22:26:35 GMT
154 #### c1 http[ 5] | X-Varnish: 648043653 648043652
155 #### c1 http[ 6] | Age: 6
156 #### c1 http[ 7] | Via: 1.1 varnish
157 #### c1 http[ 8] | Connection: keep-alive
158 ---- c1 EXPECT resp.status (200) == 201 (201) failed
159
161 · varnishhist(1)
162
163 · varnishlog(1)
164
165 · varnishncsa(1)
166
167 · varnishstat(1)
168
169 · varnishtop(1)
170
171 · vcl(7)
172
174 The varnishtest program was developed by Poul-Henning Kamp
175 ⟨phk@phk.freebsd.dk⟩ in cooperation with Linpro AS. This manual page
176 was written by Stig Sandbeck Mathisen ⟨ssm@linpro.no⟩ using examples by
177 Poul-Henning Kamp ⟨phk@phk.freebsd.dk⟩.
178
180 This document is licensed under the same licence as Varnish itself. See
181 LICENCE for details.
182
183 · Copyright (c) 2007-2008 Linpro AS
184
185 · Copyright (c) 2010 Varnish Software AS
186
188 Stig Sandbeck Mathisen
189
190
191
192
1931.0 2010-05-31 VARNISHTEST(1)