Execute Varnish Test Cases to test Varnish HTTP Cache and HAProxy configuration.

Use varnishtest utility to define servers, varnish and client configuration and simulate specific actions.

Create Varnish Test Cases file

The following script can be used to simple varnish redirection.

$ cat varnishtest_simple_redirect.vtc 
varnishtest "Redirection test"

server s1 {
  rxreq
  txresp
} -start

varnish v1 -vcl {
  backend b1 {
    .host = "${s1_addr}";
    .port = "${s1_port}";
  }

  sub vcl_recv {
    if (req.url  == "/source-address") {
      set req.http.x-Redir-Url = "/destination-address"; 
      return(synth(751,req.http.x-Redir-Url));
    }
  }

  sub vcl_synth {
    if (resp.status == 751) {
      set resp.http.Location = resp.reason;
      set resp.status = 301;
      return (deliver);
    } 
    return (deliver);
  }
} -start


client c1 {
  txreq -url "/source-address"
  rxresp
  expect resp.status == 301
  expect resp.http.location == "/destination-address"
} -run

shell -expect "1" {
  varnishlog -d -n ${v1_name} -g raw -q "RespStatus == 301" | wc -l
}

Equivalent Varnish Test Case for HAProxy.

$ cat  varnishtest_haproxy_simple_redirect.vtc 
varnishtest "Redirection test"

feature ignore_unknown_macro

#feature cmd {haproxy --version 2>&1 | grep -q 'HA-*Proxy version'}

server s1 {
  rxreq
  txresp
} -start

haproxy h1 -conf {
  defaults
    mode   http

  backend be1
    server srv1 ${s1_addr}:${s1_port}

  frontend http1
    bind "fd@${fe1}"
    acl redirection_path path_beg /source-address
    http-request redirect  code 301 location /destination-address if redirection_path
    use_backend be1
} -start

client c1 -connect ${h1_fe1_sock} {
  txreq -url "/source-address"
  rxresp
  expect resp.status == 301
  expect resp.http.location == "/destination-address"
} -run

See Varnish Test Case Syntax for more details.

Execute Varnish Test Case

Inspect varnishtest utility.

$ varnishtest 
usage: varnishtest [options] file ...
    -b size                      # Set internal buffer size (default: 1M)
    -C                           # Use cleaner subprocess
    -D name=val                  # Define macro
    -i                           # Find varnish binaries in build tree
    -j jobs                      # Run this many tests in parallel
    -k                           # Continue on test failure
    -L                           # Always leave temporary vtc.*
    -l                           # Leave temporary vtc.* if test fails
    -n iterations                # Run tests this many times
    -p name=val                  # Pass a varnishd parameter
    -q                           # Quiet mode: report only failures
    -t duration                  # Time tests out after this long
    -v                           # Verbose mode: always report test log

Execute Varnish Test Case.

$ varnishtest varnishtest_simple_redirect.vtc 
#    top  TEST varnishtest_simple_redirect.vtc passed (1.849)

Execute Varnish Test Case using verbose mode.

$ varnishtest -v varnishtest_simple_redirect.vtc 
**** dT    0.000                                                                                      
*    top   TEST varnishtest_simple_redirect.vtc starting                                              
**** top   extmacro def pwd=/opt                                                                     
**** top   extmacro def localhost=127.0.0.1                                                           
**** top   extmacro def bad_backend=127.0.0.1:34723                                  
**** top   extmacro def listen_addr=127.0.0.1:0                                                       
**** top   extmacro def bad_ip=192.0.2.255       
**** top   macro def testdir=/opt                                                                    
**** top   macro def tmpdir=/tmp/vtc.25486.04223c0f                                                   
**   top   === varnishtest "Redirection test"                                                         
*    top   VTEST Redirection test                                                                     
**   top   === server s1 {                                                                            
**   s1    Starting server                                                                            
**** s1    macro def s1_addr=127.0.0.1                                                                
**** s1    macro def s1_port=35033
**** s1    macro def s1_sock=127.0.0.1:35033
*    s1    Listen on 127.0.0.1:35033
**   top   === varnish v1 -vcl {
**   s1    Started on 127.0.0.1:35033 (1 iterations)
**** dT    0.003
**   v1    Launch
***  v1    CMD: cd ${pwd} && exec varnishd  -d -n /tmp/vtc.25486.04223c0f/v1 -l 2m -p auto_restart=off -p syslog_cli_traffic=off -p thread_pool_min=10 -p debug=+vtc_mode -p vsl_mask=+Debug -p h2_initial_w
indow_size=1m -p h2_rx_window_low_water=64k -a '127.0.0.1:0' -M '127.0.0.1 35809' -P /tmp/vtc.25486.04223c0f/v1/varnishd.pid 
***  v1    CMD: cd /opt && exec varnishd  -d -n /tmp/vtc.25486.04223c0f/v1 -l 2m -p auto_restart=off -p syslog_cli_traffic=off -p thread_pool_min=10 -p debug=+vtc_mode -p vsl_mask=+Debug -p h2_initial_wi
ndow_size=1m -p h2_rx_window_low_water=64k -a '127.0.0.1:0' -M '127.0.0.1 35809' -P /tmp/vtc.25486.04223c0f/v1/varnishd.pid 
***  v1    PID: 25492
**** v1    macro def v1_pid=25492
**** v1    macro def v1_name=/tmp/vtc.25486.04223c0f/v1
**** dT    0.010
***  v1    debug|Debug: Version: varnish-6.6.1 revision e6a8c860944c4f6a7e1af9f40674ea78bbdcdc66
***  v1    debug|Debug: Platform: Linux,5.15.0-25-generic,x86_64,-junix,-sdefault,-sdefault,-hcritbit
***  v1    debug|200 318     
***  v1    debug|-----------------------------
***  v1    debug|Varnish Cache CLI 1.0
***  v1    debug|-----------------------------
***  v1    debug|Linux,5.15.0-25-generic,x86_64,-junix,-sdefault,-sdefault,-hcritbit
***  v1    debug|varnish-6.6.1 revision e6a8c860944c4f6a7e1af9f40674ea78bbdcdc66
***  v1    debug|
***  v1    debug|Type 'help' for command list.
***  v1    debug|Type 'quit' to close CLI session.
***  v1    debug|Type 'start' to launch worker process.
***  v1    debug|
**** dT    0.110
**** v1    CLIPOLL 1 0x1 0x0
***  v1    CLI connection fd = 6
***  v1    CLI RX  107
**** v1    CLI RX|iywfbspxsithvphqfcusskcsjopdhexy
**** v1    CLI RX|
**** v1    CLI RX|Authentication required.
**** dT    0.111
**** v1    CLI TX|auth 914dae36a57bd0ec94f8829e83cba55f09eac97c65da53c497f146164c95769e
**** dT    0.112
***  v1    CLI RX  200
**** v1    CLI RX|-----------------------------
**** v1    CLI RX|Varnish Cache CLI 1.0
**** v1    CLI RX|-----------------------------
**** v1    CLI RX|Linux,5.15.0-25-generic,x86_64,-junix,-sdefault,-sdefault,-hcritbit
**** v1    CLI RX|varnish-6.6.1 revision e6a8c860944c4f6a7e1af9f40674ea78bbdcdc66
**** v1    CLI RX|
**** v1    CLI RX|Type 'help' for command list.
**** v1    CLI RX|Type 'quit' to close CLI session. 
**** v1    CLI RX|Type 'start' to launch worker process.
**** dT    0.113
**** v1    CLI TX|vcl.inline vcl1 << %XJEIFLH|)Xspa8P
**** v1    CLI TX|vcl 4.1;
**** v1    CLI TX|
**** v1    CLI TX|  backend b1 {
**** v1    CLI TX|    .host = "127.0.0.1";
**** v1    CLI TX|    .port = "35033";
**** v1    CLI TX|  }
**** v1    CLI TX|
**** v1    CLI TX|  sub vcl_recv {
**** v1    CLI TX|    if (req.url  == "/source-address") {
**** v1    CLI TX|      set req.http.x-Redir-Url = "/destination-address"; 
**** v1    CLI TX|      return(synth(751,req.http.x-Redir-Url));
**** v1    CLI TX|    }
**** v1    CLI TX|  }
**** v1    CLI TX|
**** v1    CLI TX|  sub vcl_synth {
**** v1    CLI TX|    if (resp.status == 751) {
**** v1    CLI TX|      set resp.http.Location = resp.reason;
**** v1    CLI TX|      set resp.status = 301;
**** v1    CLI TX|      return (deliver);
**** v1    CLI TX|    } 
**** v1    CLI TX|    return (deliver);
**** v1    CLI TX|  }
**** v1    CLI TX|
**** v1    CLI TX|%XJEIFLH|)Xspa8P
**** dT    0.213
***  v1    vsl|No VSL chunk found (child not started ?)
**** dT    0.313
***  v1    vsl|No VSL chunk found (child not started ?)
**** dT    0.423
***  v1    vsl|No VSL chunk found (child not started ?)
**** dT    0.527
***  v1    vsl|No VSL chunk found (child not started ?)
**** dT    0.562
***  v1    CLI RX  200
**** v1    CLI RX|VCL compiled.
**** v1    CLI TX|vcl.use vcl1
***  v1    CLI RX  200
**   v1    Start
**** v1    CLI TX|start
**** dT    0.564
***  v1    debug|Debug: Child (25515) Started
**** dT    0.591
***  v1    CLI RX  200
***  v1    wait-running
**** v1    CLI TX|status
***  v1    debug|Info: Child (25515) said Child starts
***  v1    CLI RX  200
**** v1    CLI RX|Child in state running
**** v1    CLI TX|debug.listen_address
***  v1    CLI RX  200
**** v1    CLI RX|a0 127.0.0.1 36903
**** v1    CLI TX|debug.xid 999
**** dT    0.592
***  v1    CLI RX  200
**** v1    CLI RX|XID is 999
**** v1    CLI TX|debug.listen_address
***  v1    CLI RX  200
**** v1    CLI RX|a0 127.0.0.1 36903
**   v1    Listen on 127.0.0.1 36903
**** v1    macro def v1_addr=127.0.0.1
**** v1    macro def v1_port=36903
**** v1    macro def v1_sock=127.0.0.1:36903
**** v1    macro def v1_a0_addr=127.0.0.1
**** v1    macro def v1_a0_port=36903
**** v1    macro def v1_a0_sock=127.0.0.1:36903
**** dT    0.628
**** v1    vsl|          0 CLI             - Rd vcl.load "vcl1" vcl_vcl1.1663112815.989340/vgc.so 1auto
**** v1    vsl|          0 CLI             - Wr 200 52 Loaded "vcl_vcl1.1663112815.989340/vgc.so" as "vcl1"
**** v1    vsl|          0 CLI             - Rd vcl.use "vcl1"
**** v1    vsl|          0 CLI             - Wr 200 0 
**** v1    vsl|          0 CLI             - Rd start
**** v1    vsl|          0 CLI             - Wr 200 0 
**** v1    vsl|          0 CLI             - Rd debug.listen_address 
**** v1    vsl|          0 CLI             - Wr 200 19 a0 127.0.0.1 36903

**** v1    vsl|          0 CLI             - Rd debug.xid 999 
**** v1    vsl|          0 CLI             - Wr 200 10 XID is 999
**** v1    vsl|          0 CLI             - Rd debug.listen_address 
**** v1    vsl|          0 CLI             - Wr 200 19 a0 127.0.0.1 36903

**** dT    0.699
**   top   === client c1 {
**   c1    Starting client
**** dT    0.700
**   c1    Waiting for client
**   c1    Started on 127.0.0.1:36903 (1 iterations)
***  c1    Connect to 127.0.0.1:36903
***  c1    connected fd 16 from 127.0.0.1 53078 to 127.0.0.1:36903
**   c1    === txreq -url "/source-address"
**** c1    txreq|GET /source-address HTTP/1.1\r
**** c1    txreq|Host: 127.0.0.1\r
**** c1    txreq|\r
**   c1    === rxresp
**** dT    0.702
**** c1    rxhdr|HTTP/1.1 301 Moved Permanently\r
**** c1    rxhdr|Date: Tue, 13 Sep 2022 23:46:56 GMT\r
**** c1    rxhdr|Server: Varnish\r
**** c1    rxhdr|X-Varnish: 1001\r
**** c1    rxhdr|Location: /destination-address\r
**** c1    rxhdr|Content-Length: 0\r
**** c1    rxhdr|Connection: keep-alive\r
**** c1    rxhdr|\r
**** c1    rxhdrlen = 180
**** c1    http[ 0] |HTTP/1.1
**** c1    http[ 1] |301
**** c1    http[ 2] |Moved Permanently
**** c1    http[ 3] |Date: Tue, 13 Sep 2022 23:46:56 GMT
**** c1    http[ 4] |Server: Varnish
**** c1    http[ 5] |X-Varnish: 1001
**** c1    http[ 6] |Location: /destination-address 
**** c1    http[ 7] |Content-Length: 0
**** c1    http[ 8] |Connection: keep-alive
**** c1    bodylen = 0
**   c1    === expect resp.status == 301
**** c1    EXPECT resp.status (301) == "301" match
**   c1    === expect resp.http.location == "/destination-address"
**** c1    EXPECT resp.http.location (/destination-address) == "/destination-address" match
***  c1    closing fd 16
**   c1    Ending
**** dT    0.703
**   top   === shell -expect "1" {
**** top   shell_cmd|exec 2>&1 ; 
**** top   shell_cmd|  varnishlog -d -n /tmp/vtc.25486.04223c0f/v1 -g raw -q "RespStatus == 301" | wc -l
**** dT    0.728
**** v1    vsl|       1000 Begin           c sess 0 HTTP/1
**** v1    vsl|       1000 SessOpen        c 127.0.0.1 53078 a0 127.0.0.1 36903 1663112816.576625 18
**** v1    vsl|       1000 Link            c req 1001 rxreq
**** v1    vsl|       1001 Begin           c req 1000 rxreq
**** v1    vsl|       1001 Timestamp       c Start: 1663112816.576821 0.000000 0.000000
**** v1    vsl|       1001 Timestamp       c Req: 1663112816.576821 0.000000 0.000000
**** v1    vsl|       1001 VCL_use         c vcl1
**** v1    vsl|       1001 ReqStart        c 127.0.0.1 53078 a0
**** v1    vsl|       1001 ReqMethod       c GET
**** v1    vsl|       1001 ReqURL          c /source-address
**** v1    vsl|       1001 ReqProtocol     c HTTP/1.1
**** v1    vsl|       1001 ReqHeader       c Host: 127.0.0.1
**** v1    vsl|       1001 ReqHeader       c X-Forwarded-For: 127.0.0.1
**** v1    vsl|       1001 VCL_call        c RECV
**** v1    vsl|       1001 ReqHeader       c x-Redir-Url: /destination-address
**** v1    vsl|       1001 VCL_return      c synth
**** v1    vsl|       1001 VCL_call        c HASH
**** v1    vsl|       1001 VCL_return      c lookup 
**** v1    vsl|       1001 RespProtocol    c HTTP/1.1
**** v1    vsl|       1001 RespStatus      c 751
**** v1    vsl|       1001 RespReason      c /destination-address
**** v1    vsl|       1001 RespHeader      c Date: Tue, 13 Sep 2022 23:46:56 GMT
**** v1    vsl|       1001 RespHeader      c Server: Varnish
**** v1    vsl|       1001 RespHeader      c X-Varnish: 1001
**** v1    vsl|       1001 VCL_call        c SYNTH
**** v1    vsl|       1001 RespHeader      c Location: /destination-address
**** v1    vsl|       1001 RespStatus      c 301
**** v1    vsl|       1001 RespReason      c Moved Permanently
**** v1    vsl|       1001 VCL_return      c deliver
**** v1    vsl|       1001 Timestamp       c Process: 1663112816.577041 0.000220 0.000220
**** v1    vsl|       1001 RespHeader      c Content-Length: 0
**** v1    vsl|       1001 Storage         c malloc Transient
**** v1    vsl|       1001 Filters         c 
**** v1    vsl|       1001 RespHeader      c Connection: keep-alive
**** v1    vsl|       1001 Timestamp       c Resp: 1663112816.577181 0.000360 0.000139
**** v1    vsl|       1001 ReqAcct         c 49 0 49 180 0 180
**** v1    vsl|       1001 End             c 
**** v1    vsl|       1000 SessClose       c REM_CLOSE 0.002
**** v1    vsl|       1000 End             c 
**** dT    0.817
**** top   shell_out|1
**** top   shell_status = 0x0000
**** top   shell_expect found
*    top   RESETTING after varnishtest_simple_redirect.vtc
**** dT    0.818
**   s1    Waiting for server (3/-1)
**   v1    Wait
**** v1    CLI TX|backend.list
**** dT    0.819
***  v1    CLI RX  200
**** v1    CLI RX|Backend name   Admin      Probe    Health     Last change
**** v1    CLI RX|vcl1.b1        healthy    0/0      healthy    Tue, 13 Sep 2022 23:46:56 GMT
**   v1    Stop
**** v1    CLI TX|stop
**** dT    0.828
**** v1    vsl|          0 CLI             - Rd backend.list 
**** v1    vsl|          0 CLI             - Wr 200 134 Backend name   Admin      Probe    Health     Last change
vcl1.b1        healthy    0/0      healthy    Tue, 13 Sep 2022 23:46:56 GMT

**** dT    0.896
***  v1    debug|Debug: Stopping Child
**** dT    0.929
**** v1    vsl|          0 CLI             - EOF on CLI connection, worker stops
**** dT    1.924
***  v1    debug|Info: Child (25515) ended
***  v1    debug|Info: Child (25515) said Child dies
***  v1    debug|Debug: Child cleanup complete
***  v1    CLI RX  200
***  v1    wait-stopped
**** v1    CLI TX|status
***  v1    CLI RX  200
**** v1    CLI RX|Child in state stopped
**** v1    CLI TX|panic.clear
**** dT    1.925
***  v1    CLI RX  300
**** v1    CLI RX|No panic to clear
**** dT    1.926
***  v1    debug|Info: manager stopping child
***  v1    debug|Info: manager dies
**** dT    1.927
**** v1    STDOUT EOF
**** dT    1.928
**   v1    WAIT4 pid=25492 status=0x0000 (user 0.380780 sys 0.095614)
*    top   TEST varnishtest_simple_redirect.vtc completed

Execute Varnish Test Case for HAProxy.

$ varnishtest varnishtest_haproxy_simple_redirect.vtc 
#    top  TEST varnishtest_haproxy_simple_redirect.vtc passed (2.475)

Execute Varnish Test Case for HAProxy using verbose mode.

$ varnishtest -v varnishtest_haproxy_simple_redirect.vt
**** dT    0.000                                                                                      
*    top   TEST varnishtest_haproxy_simple_redirect.vtc starting
**** top   extmacro def pwd=/opt     
**** top   extmacro def localhost=127.0.0.1
**** top   extmacro def bad_backend=127.0.0.1:45881                                                   
**** top   extmacro def listen_addr=127.0.0.1:0                                                       
**** top   extmacro def bad_ip=192.0.2.255        
**** top   macro def testdir=/opt
**** top   macro def tmpdir=/tmp/vtc.27424.64c52b79                                                   
**   top   === varnishtest "Redirection test"                                                         
*    top   VTEST Redirection test    
**   top   === feature ignore_unknown_macro                                                           
**   top   === server s1 {                 
**   s1    Starting server                                                                            
**** dT    0.001                          
**** s1    macro def s1_addr=127.0.0.1
**** s1    macro def s1_port=35059
**** s1    macro def s1_sock=127.0.0.1:35059
*    s1    Listen on 127.0.0.1:35059                                                                  
**   top   === haproxy h1 -conf {                                                                     
**** h1    macro def h1_closed_sock=127.0.0.1:42609                                           
**** h1    macro def h1_closed_addr=127.0.0.1                                                         
**** h1    macro def h1_closed_port=42609                                                             
**   s1    Started on 127.0.0.1:35059 (1 iterations)                                           
**** dT    0.009
**** h1    macro def h1_cli_sock=127.0.0.1:42245                                                      
**** h1    macro def h1_cli_addr=127.0.0.1                                                            
**** h1    macro def h1_cli_port=42245
**** h1    setenv(cli, 5)
**** h1    macro def h1_fe1_sock=127.0.0.1:44043
**** h1    macro def h1_fe1_addr=127.0.0.1
**** h1    macro def h1_fe1_port=44043
**** h1    setenv(fe1, 6)
**   h1    haproxy_start
**** h1    opt_worker 0 opt_daemon 0 opt_check_mode 0 opt_mcli 0
**** h1    argv|exec "haproxy" -d  -f "/tmp/vtc.27424.64c52b79/h1/cfg" 
**** h1    conf|    global
**** h1    conf|\tstats socket "/tmp/vtc.27424.64c52b79/h1/stats.sock" level admin mode 600
**** h1    conf|    stats socket "fd@${cli}" level admin
**** h1    conf|
**** h1    conf|  defaults
**** h1    conf|    mode   http
**** h1    conf|#    timeout connect         5s
**** h1    conf|#    timeout server          30s
**** h1    conf|#    timeout client          30s
**** h1    conf|
**** h1    conf|  backend be1
**** h1    conf|    server srv1 127.0.0.1:35059
**** h1    conf|
**** h1    conf|  frontend http1
**** h1    conf|    bind "fd@${fe1}"
**** h1    conf|    acl redirection_path path_beg /source-address
**** h1    conf|    http-request redirect  code 301 location /destination-address if redirection_path
**** h1    conf|    use_backend be1
**** h1    XXX 8 @750
***  h1    PID: 27430
**** h1    macro def h1_pid=27430
**** h1    macro def h1_name=/tmp/vtc.27424.64c52b79/h1
**   top   === client c1 -connect ${h1_fe1_sock} {
**   c1    Starting client
**   c1    Waiting for client
**   c1    Started on 127.0.0.1:44043 (1 iterations)
***  c1    Connect to 127.0.0.1:44043
***  c1    connected fd 7 from 127.0.0.1 44460 to 127.0.0.1:44043
**   c1    === txreq -url "/source-address"
**** c1    txreq|GET /source-address HTTP/1.1\r
**** c1    txreq|Host: 127.0.0.1\r
**** c1    txreq|\r
**   c1    === rxresp
**** dT    0.022
***  h1    debug|[WARNING]  (27430) : config : missing timeouts for backend 'be1'.
***  h1    debug|   | While not properly invalid, you will certainly encounter various problems
***  h1    debug|   | with such a configuration. To fix this, please ensure that all following
***  h1    debug|   | timeouts are set to a non-zero value: 'client', 'connect', 'server'.
***  h1    debug|[WARNING]  (27430) : config : missing timeouts for frontend 'http1'.
***  h1    debug|   | While not properly invalid, you will certainly encounter various problems
***  h1    debug|   | with such a configuration. To fix this, please ensure that all following
***  h1    debug|   | timeouts are set to a non-zero value: 'client', 'connect', 'server'.
***  h1    debug|Note: setting global.maxconn to 524273.
***  h1    debug|Available polling systems :
***  h1    debug|      epoll : pref=300,  test result OK
***  h1    debug|       poll : pref=200,  test result OK
***  h1    debug|     select : pref=150,  test result FAILED
***  h1    debug|Total: 3 (2 usable), will use epoll.
***  h1    debug|
***  h1    debug|Available filters :
***  h1    debug|\t[SPOE] spoe
***  h1    debug|\t[CACHE] cache
***  h1    debug|\t[FCGI] fcgi-app
***  h1    debug|\t[COMP] compression
***  h1    debug|\t[TRACE] trace
**** dT    0.690
***  h1    debug|Using epoll() as the polling mechanism.
**** dT    0.714
***  h1    debug|00000000:http1.accept(0006)=000d from [127.0.0.1:44460] ALPN=<none>
***  h1    debug|00000000:http1.clireq[000d:ffffffff]: GET /source-address HTTP/1.1
***  h1    debug|00000000:http1.clihdr[000d:ffffffff]: host: 127.0.0.1
***  h1    debug|00000000:http1.clicls[000d:ffffffff]
***  h1    debug|00000000:http1.closed[000d:ffffffff]
**** c1    rxhdr|HTTP/1.1 301 Moved Permanently\r
**** c1    rxhdr|content-length: 0\r
**** c1    rxhdr|location: /destination-address\r
**** c1    rxhdr|\r
**** c1    rxhdrlen = 85
**** c1    http[ 0] |HTTP/1.1
**** c1    http[ 1] |301
**** c1    http[ 2] |Moved Permanently
**** c1    http[ 3] |content-length: 0
**** c1    http[ 4] |location: /destination-address 
**** c1    bodylen = 0
**   c1    === expect resp.status == 301
**** c1    EXPECT resp.status (301) == "301" match
**   c1    === expect resp.http.location == "/destination-address"
**** c1    EXPECT resp.http.location (/destination-address) == "/destination-address" match
***  c1    closing fd 7
**   c1    Ending
*    top   RESETTING after varnishtest_haproxy_simple_redirect.vtc
**   h1    Reset and free h1 haproxy 27430
**   h1    Wait
**   h1    Stop HAproxy pid=27430
**** h1    Kill(2)=0: Success
**** dT    0.718
**** h1    STDOUT EOF
**** dT    0.834
**   h1    WAIT4 pid=27430 status=0x0002 (user 0.021229 sys 0.063689)
**** dT    0.884
**   s1    Waiting for server (3/-1)
*    top   TEST varnishtest_haproxy_simple_redirect.vtc completed
#    top  TEST varnishtest_haproxy_simple_redirect.vtc passed (0.887)

Varnish Test Case scripts are amazing and it is easy to use this mechanism during deployment process.

Additional notes

Inspect bin/varnishtest/tests source code directory to see how these scripts are written.

There are over 800 VTC scripts at this moment describing every available functionality.

$ cat bin/varnishtest/tests/README
Test-scripts for varnishtest
============================

Naming scheme
-------------

	The intent is to be able to run all scripts in lexicographic
	order and get a sensible failure mode.

	This requires more basic tests to be earlier and more complex
	tests to be later in the test sequence, we do this with the
	prefix/id letter:

		[id]%05d.vtc

	id ~ ^a		--> varnishtest(1) tests
	id ~ ^a02	--> HTTP2
	id ~ ^b		--> Basic functionality tests
	id ~ ^c		--> Complex functionality tests
	id ~ ^d		--> Director facility tests
	id ~ ^e		--> ESI tests
	id ~ ^f		--> Security related tests
	id ~ ^g		--> GZIP tests
	id ~ ^h		--> HAproxy tests
	id ~ ^i		--> Interoperability and standards compliance
	id ~ ^j		--> JAIL tests
	id ~ ^l		--> VSL tests
	id ~ ^m		--> VMOD facility, vmod_debug and vmod_vtc
	id ~ ^o		--> prOxy protocol
	id ~ ^p		--> Persistent tests
	id ~ ^r		--> Regression tests, same number as ticket
	id ~ ^s		--> Slow tests, expiry, grace etc.
	id ~ ^t		--> Transport protocol tests
	id ~ ^t02	--> HTTP2
	id ~ ^u		--> Utilities and background processes
	id ~ ^v		--> VCL tests: execute VRT functions
	id ~ ^x		--> VEXT tests

	Coverage for individual VMODs is in "${top_srcdir}vmod/tests".
$ ls bin/varnishtest/tests/
a00000.vtc  b00000.vtc  b00048.vtc  c00017.vtc  c00070.vtc  d00014.vtc  f00007.vtc  o00001.vtc  r00558.vtc  r00980.vtc  r01356.vtc  r01648.vtc  r01924.vtc  r02488.vtc  r03169.vtc  t02003.vtc  v00010.vtc
a00001.vtc  b00001.vtc  b00049.vtc  c00018.vtc  c00071.vtc  d00032.vtc  f00008.vtc  o00002.vtc  r00561.vtc  r00984.vtc  r01367.vtc  r01650.vtc  r01927.vtc  r02494.vtc  r03189.vtc  t02004.vtc  v00011.vtc
a00002.vtc  b00002.vtc  b00050.vtc  c00019.vtc  c00072.vtc  d00033.vtc  g00000.vtc  o00003.vtc  r00590.vtc  r01002.vtc  r01391.vtc  r01660.vtc  r01941.vtc  r02527.vtc  r03221.vtc  t02005.vtc  v00012.vtc
a00003.vtc  b00003.vtc  b00051.vtc  c00020.vtc  c00073.vtc  d00034.vtc  g00001.vtc  o00004.vtc  r00612.vtc  r01014.vtc  r01395.vtc  r01662.vtc  r01953.vtc  r02530.vtc  r03241.vtc  t02006.vtc  v00013.vtc
a00004.vtc  b00004.vtc  b00052.vtc  c00021.vtc  c00074.vtc  d00035.vtc  g00002.vtc  o00005.vtc  r00641.vtc  r01029.vtc  r01398.vtc  r01665.vtc  r01955.vtc  r02539.vtc  r03253.vtc  t02007.vtc  v00014.vtc
a00005.vtc  b00005.vtc  b00053.vtc  c00022.vtc  c00075.vtc  d00036.vtc  g00003.vtc  o00006.vtc  r00655.vtc  r01030.vtc  r01399.vtc  r01672.vtc  r01956.vtc  r02554.vtc  r03266.vtc  t02008.vtc  v00015.vtc
a00006.vtc  b00006.vtc  b00054.vtc  c00023.vtc  c00076.vtc  d00037.vtc  g00004.vtc  p00000.vtc  r00667.vtc  r01036.vtc  r01401.vtc  r01684.vtc  r01990.vtc  r02555.vtc  r03301.vtc  t02009.vtc  v00016.vtc
a00007.vtc  b00007.vtc  b00055.vtc  c00024.vtc  c00077.vtc  d00038.vtc  g00005.vtc  p00002.vtc  r00679.vtc  r01037.vtc  r01404.vtc  r01688.vtc  r02035.vtc  r02589.vtc  r03308.vtc  t02010.vtc  v00017.vtc
a00008.vtc  b00008.vtc  b00056.vtc  c00025.vtc  c00078.vtc  d00040.vtc  g00006.vtc  p00003.vtc  r00686.vtc  r01038.vtc  r01406.vtc  r01691.vtc  r02036.vtc  r02617.vtc  r03319.vtc  t02011.vtc  v00018.vtc
a00009.vtc  b00009.vtc  b00057.vtc  c00026.vtc  c00079.vtc  e00000.vtc  g00007.vtc  p00004.vtc  r00694.vtc  r01068.vtc  r01417.vtc  r01693.vtc  r02042.vtc  r02618.vtc  r03329.vtc  t02012.vtc  v00019.vtc
a00010.vtc  b00010.vtc  b00058.vtc  c00027.vtc  c00080.vtc  e00001.vtc  g00008.vtc  p00005.vtc  r00700.vtc  r01073.vtc  r01419.vtc  r01729.vtc  r02069.vtc  r02633.vtc  r03353.vtc  t02013.vtc  v00020.vtc
a00011.vtc  b00011.vtc  b00059.vtc  c00028.vtc  c00081.vtc  e00002.vtc  h00001.vtc  p00006.vtc  r00702.vtc  r01086.vtc  r01441.vtc  r01730.vtc  r02084.vtc  r02645.vtc  r03354.vtc  t02014.vtc  v00021.vtc
a00012.vtc  b00012.vtc  b00060.vtc  c00031.vtc  c00082.vtc  e00003.vtc  h00002.vtc  p00007.vtc  r00704.vtc  r01092.vtc  r01442.vtc  r01737.vtc  r02105.vtc  r02646.vtc  r03360.vtc  t02015.vtc  v00022.vtc
a00013.vtc  b00013.vtc  b00061.vtc  c00034.vtc  c00083.vtc  e00004.vtc  h00003.vtc  p00008.vtc  r00722.vtc  r01109.vtc  r01468.vtc  r01739.vtc  r02135.vtc  r02647.vtc  r03385.vtc  t02016.vtc  v00024.vtc
a00014.vtc  b00014.vtc  b00062.vtc  c00035.vtc  c00084.vtc  e00005.vtc  h00004.vtc  p00009.vtc  r00733.vtc  r01113.vtc  r01478.vtc  r01746.vtc  r02142.vtc  r02649.vtc  r03394.vtc  t02017.vtc  v00025.vtc
a00015.vtc  b00015.vtc  b00063.vtc  c00036.vtc  c00085.vtc  e00006.vtc  h00005.vtc  p00010.vtc  r00742.vtc  r01120.vtc  r01485.vtc  r01755.vtc  r02148.vtc  r02679.vtc  r03402.vtc  t02018.vtc  v00027.vtc
a00018.vtc  b00016.vtc  b00064.vtc  c00037.vtc  c00086.vtc  e00007.vtc  h00006.vtc  r00102.vtc  r00763.vtc  r01123.vtc  r01490.vtc  r01761.vtc  r02157.vtc  r02686.vtc  r03410.vtc  t02019.vtc  v00031.vtc
a00019.vtc  b00017.vtc  b00065.vtc  c00038.vtc  c00087.vtc  e00008.vtc  h00007.vtc  r00251.vtc  r00769.vtc  r01134.vtc  r01493.vtc  r01762.vtc  r02175.vtc  r02690.vtc  r03416.vtc  t02020.vtc  v00032.vtc
a00020.vtc  b00018.vtc  b00066.vtc  c00039.vtc  c00088.vtc  e00009.vtc  i00000.vtc  r00255.vtc  r00776.vtc  r01140.vtc  r01494.vtc  r01764.vtc  r02177.vtc  r02700.vtc  r03417.vtc  t02021.vtc  v00033.vtc
a00021.vtc  b00019.vtc  b00067.vtc  c00040.vtc  c00089.vtc  e00010.vtc  i00001.vtc  r00262.vtc  r00781.vtc  r01144.vtc  r01498.vtc  r01765.vtc  r02219.vtc  r02702.vtc  r03433.vtc  t02022.vtc  v00034.vtc
a00022.vtc  b00020.vtc  b00068.vtc  c00041.vtc  c00090.vtc  e00011.vtc  j00000.vtc  r00292.vtc  r00789.vtc  r01145.vtc  r01499.vtc  r01768.vtc  r02233.vtc  r02705.vtc  r03463.vtc  u00000.vtc  v00037.vtc
a02000.vtc  b00021.vtc  b00069.vtc  c00043.vtc  c00091.vtc  e00012.vtc  j00001.vtc  r00306.vtc  r00795.vtc  r01156.vtc  r01501.vtc  r01772.vtc  r02258.vtc  r02722.vtc  r03502.vtc  u00001.vtc  v00038.vtc
a02001.vtc  b00022.vtc  b00070.vtc  c00044.vtc  c00092.vtc  e00013.vtc  j00003.vtc  r00310.vtc  r00801.vtc  r01157.vtc  r01504.vtc  r01775.vtc  r02262.vtc  r02763.vtc  r03525.vtc  u00003.vtc  v00039.vtc
a02002.vtc  b00023.vtc  b00071.vtc  c00045.vtc  c00093.vtc  e00014.vtc  j00004.vtc  r00318.vtc  r00803.vtc  r01164.vtc  r01510.vtc  r01777.vtc  r02266.vtc  r02775.vtc  r03546.vtc  u00004.vtc  v00040.vtc
a02003.vtc  b00024.vtc  b00072.vtc  c00046.vtc  c00094.vtc  e00015.vtc  l00000.vtc  r00325.vtc  r00806.vtc  r01168.vtc  r01512.vtc  r01781.vtc  r02270.vtc  r02831.vtc  r03556.vtc  u00005.vtc  v00041.vtc
a02004.vtc  b00025.vtc  b00073.vtc  c00047.vtc  c00095.vtc  e00016.vtc  l00001.vtc  r00326.vtc  r00832.vtc  r01169.vtc  r01518.vtc  r01783.vtc  r02275.vtc  r02839.vtc  r03560.vtc  u00006.vtc  v00042.vtc
a02005.vtc  b00026.vtc  b00074.vtc  c00048.vtc  c00096.vtc  e00017.vtc  l00002.vtc  r00345.vtc  r00861.vtc  r01175.vtc  r01524.vtc  r01801.vtc  r02291.vtc  r02849.vtc  r03564.vtc  u00007.vtc  v00043.vtc
a02006.vtc  b00027.vtc  b00075.vtc  c00049.vtc  c00097.vtc  e00018.vtc  l00003.vtc  r00386.vtc  r00873.vtc  r01176.vtc  r01532.vtc  r01804.vtc  r02300.vtc  r02872.vtc  r03706.vtc  u00008.vtc  v00045.vtc
a02007.vtc  b00028.vtc  b00076.vtc  c00050.vtc  c00098.vtc  e00019.vtc  l00004.vtc  r00387.vtc  r00878.vtc  r01184.vtc  r01557.vtc  r01806.vtc  r02305.vtc  r02880.vtc  r03734.vtc  u00009.vtc  v00046.vtc
a02008.vtc  b00029.vtc  b00077.vtc  c00051.vtc  c00099.vtc  e00020.vtc  l00005.vtc  r00400.vtc  r00894.vtc  r01211.vtc  r01562.vtc  r01807.vtc  r02310.vtc  r02887.vtc  r03794.vtc  u00010.vtc  v00047.vtc
a02009.vtc  b00030.vtc  b00078.vtc  c00052.vtc  c00100.vtc  e00021.vtc  l00006.vtc  r00409.vtc  r00896.vtc  r01212.vtc  r01566.vtc  r01810.vtc  r02319.vtc  r02923.vtc  r03830.vtc  u00011.vtc  v00049.vtc
a02010.vtc  b00031.vtc  c00000.vtc  c00053.vtc  c00101.vtc  e00022.vtc  l00007.vtc  r00411.vtc  r00902.vtc  r01218.vtc  r01569.vtc  r01818.vtc  r02321.vtc  r02934.vtc  README      u00012.vtc  v00050.vtc
a02011.vtc  b00032.vtc  c00001.vtc  c00054.vtc  c00102.vtc  e00023.vtc  m00000.vtc  r00412.vtc  r00911.vtc  r01225.vtc  r01575.vtc  r01821.vtc  r02325.vtc  r02937.vtc  s00000.vtc  u00013.vtc  v00051.vtc
a02012.vtc  b00033.vtc  c00002.vtc  c00055.vtc  c00103.vtc  e00024.vtc  m00003.vtc  r00416.vtc  r00913.vtc  r01255.vtc  r01576.vtc  r01826.vtc  r02339.vtc  r02946.vtc  s00001.vtc  u00014.vtc  v00052.vtc
a02013.vtc  b00034.vtc  c00003.vtc  c00056.vtc  c00104.vtc  e00025.vtc  m00008.vtc  r00425.vtc  r00915.vtc  r01266.vtc  r01577.vtc  r01834.vtc  r02342.vtc  r02964.vtc  s00002.vtc  u00015.vtc  v00054.vtc
a02014.vtc  b00035.vtc  c00004.vtc  c00057.vtc  c00105.vtc  e00026.vtc  m00019.vtc  r00427.vtc  r00916.vtc  r01274.vtc  r01578.vtc  r01837.vtc  r02351.vtc  r02976.vtc  s00003.vtc  u00016.vtc  v00055.vtc
a02015.vtc  b00036.vtc  c00005.vtc  c00058.vtc  c00106.vtc  e00027.vtc  m00021.vtc  r00433.vtc  r00917.vtc  r01275.vtc  r01581.vtc  r01838.vtc  r02367.vtc  r02990.vtc  s00004.vtc  u00017.vtc  v00056.vtc
a02016.vtc  b00037.vtc  c00006.vtc  c00059.vtc  c00107.vtc  e00028.vtc  m00022.vtc  r00445.vtc  r00921.vtc  r01284.vtc  r01598.vtc  r01843.vtc  r02372.vtc  r03003.vtc  s00005.vtc  u00018.vtc  v00057.vtc
a02017.vtc  b00038.vtc  c00007.vtc  c00060.vtc  c00108.vtc  e00030.vtc  m00023.vtc  r00466.vtc  r00940.vtc  r01287.vtc  r01602.vtc  r01847.vtc  r02387.vtc  r03006.vtc  s00006.vtc  u00019.vtc  v00058.vtc
a02018.vtc  b00039.vtc  c00008.vtc  c00061.vtc  c00109.vtc  e00031.vtc  m00024.vtc  r00476.vtc  r00941.vtc  r01296.vtc  r01608.vtc  r01856.vtc  r02395.vtc  r03019.vtc  s00007.vtc  v00000.vtc  v00059.vtc
a02019.vtc  b00040.vtc  c00009.vtc  c00062.vtc  c00120.vtc  e00032.vtc  m00025.vtc  r00494.vtc  r00942.vtc  r01312.vtc  r01612.vtc  r01857.vtc  r02406.vtc  r03038.vtc  s00008.vtc  v00001.vtc  v00060.vtc
a02020.vtc  b00041.vtc  c00010.vtc  c00063.vtc  d00007.vtc  e00033.vtc  m00027.vtc  r00495.vtc  r00956.vtc  r01320.vtc  r01613.vtc  r01858.vtc  r02413.vtc  r03079.vtc  s00009.vtc  v00002.vtc  v00062.vtc
a02021.vtc  b00042.vtc  c00011.vtc  c00064.vtc  d00008.vtc  e00034.vtc  m00048.vtc  r00498.vtc  r00961.vtc  r01332.vtc  r01624.vtc  r01878.vtc  r02422.vtc  r03089.vtc  s00010.vtc  v00003.vtc  v00063.vtc
a02022.vtc  b00043.vtc  c00012.vtc  c00065.vtc  d00009.vtc  e00035.vtc  m00051.vtc  r00502.vtc  r00962.vtc  r01333.vtc  r01627.vtc  r01879.vtc  r02429.vtc  r03093.vtc  s00011.vtc  v00004.vtc  v00064.vtc
a02023.vtc  b00044.vtc  c00013.vtc  c00066.vtc  d00010.vtc  e00036.vtc  m00052.vtc  r00506.vtc  r00963.vtc  r01337.vtc  r01637.vtc  r01881.vtc  r02432.vtc  r03098.vtc  s00012.vtc  v00005.vtc  v00065.vtc
a02024.vtc  b00045.vtc  c00014.vtc  c00067.vtc  d00011.vtc  f00001.vtc  m00053.vtc  r00524.vtc  r00965.vtc  r01349.vtc  r01638.vtc  r01890.vtc  r02433.vtc  r03109.vtc  t02000.vtc  v00006.vtc  v00066.vtc
a02025.vtc  b00046.vtc  c00015.vtc  c00068.vtc  d00012.vtc  f00004.vtc  m00054.vtc  r00545.vtc  r00972.vtc  r01350.vtc  r01641.vtc  r01914.vtc  r02451.vtc  r03131.vtc  t02001.vtc  v00008.vtc  v00067.vtc
a02026.vtc  b00047.vtc  c00016.vtc  c00069.vtc  d00013.vtc  f00005.vtc  o00000.vtc  r00549.vtc  r00979.vtc  r01355.vtc  r01644.vtc  r01918.vtc  r02471.vtc  r03159.vtc  t02002.vtc  v00009.vtc  x00000.vtc

I will not copy and paste these, play for yourself and test your configuration.