varnishtester is minimally functional
phk at phk.freebsd.dk
Tue Jul 11 23:48:00 CEST 2006
The varnishtester is minimally functional now, and understands the
serve string [...]
Send these strings when port 8081 is contacted and we
see a blank line. If multiple strings specified, all
but the last one are sent only once, the last (or only)
one is sent as many times as requested. If first char
of string is '!' close connection afterwards.
Open request connection to port 8080
Close request connection to port 8080
Send string as request (open if not explicitly done already)
if first char is '!' close connection afterwards.
Send string via varnishd CLI connection
vcl name vcl_prog
Load VCL program as named.
exit test program.
My minimal test-the-tester script looks like this:
serve "!HTTP/1.0 200 OK\nContent Length: 11\n\n0123456789\n"
req "!GET / HTTP/1.1\nHost: localhost\n\n"
And the output looks like this:
V: <<file /tmp//varnish.8jwTdm (unlinked) size 10485760 bytes (5120 fs-blocks, 2
V: <<Acceptfilter(5, httpready): -1 No such file or directory>>
V: <<Acceptfilter(6, httpready): -1 No such file or directory>>
V: <<start child pid 88131>>
V: <<Child said <Child starts>>>
V: <<Child said <Loaded "/tmp/vcl.0lYCJi6Q" as "boot">>>
V: <<Child said <managed to mmap 10485760 bytes of 10485760>>>
V: <<Child said <Ready>>>
]: <<serve "!HTTP/1.0 200 OK\nContent Length: 11\n\n0123456789\n">>
]: <<req "!GET / HTTP/1.1\nHost: localhost\n\n">>
B: <<GET / HTTP/1.1>>
B: <<Host: localhost>>
R: <<HTTP/1.0 200 OK>>
R: <<Content Length: 11>>
R: <<Content-Length: 11>>
R: <<Age: 0>>
R: <<Via: 1.1 varnish>>
R: <<X-Varnish: xid 1205698085>>
ex_req(0x82a0320, 0x11, 0x0)
]: <<cli ping>>
V: <<PONG 1152653743>>
]: read from script file
X: execution information (pause/resume)
V: received from Varnish stdout/stderr
B: requests received by synth backend
R: response received by syntg client
For automated testing I plan to add a hash facility so that one can
say things like:
hash serve 283838383...
hash req 229292929...
hash cli 229292929...
And it will croak if what has been received until then on the relevant
connection does not generate the expected hash.
Alternatively one can compare to a string:
compare serve "GET / HTTP/1.1\nHost: localhost\n\n"
compare req "HTTP/1.0 200 OK\nContent-Length: 11..."
Hopefully this will be workable to generate test cases for all
relevant flows in the state-machine.
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the varnish-dev