Changeset 86eba8


Ignore:
Timestamp:
2009-11-25 14:18:46 (4 years ago)
Author:
Poul-Henning Kamp <phk@…>
Branches:
master, 3.0, 4.0, experimental-ims
Children:
750d26
Parents:
e4d6bb
git-author:
Poul-Henning Kamp <phk@…> (2009-11-25 14:18:46)
git-committer:
Poul-Henning Kamp <phk@…> (2009-11-25 14:18:46)
Message:

Have clients pick up the varnish accept address using macros.

Make the varnish accept address just use a random free TCP port.

Fix a couple of tests where we need to know the port number.

git-svn-id:  http://www.varnish-cache.org/svn/trunk/varnish-cache@4372 d4fa192b-c00b-0410-8231-f00ffab90ce4

Location:
bin/varnishtest
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • bin/varnishtest/tests/b00014.vtc

    r2b3ff9 r86eba8  
    33test "Check -f command line arg" 
    44 
    5 shell "echo 'backend foo { .host = \"127.0.0.1\"; .port = \"9080\"; }' > /tmp/_b00014.vcl"  
    6 varnish v1 -arg "-f /tmp/_b00014.vcl" -start 
    75 
    86server s1 { 
     
    1412        txresp -body "bar" 
    1513} -start 
     14 
     15shell "echo 'backend foo { .host = \"${s1_addr}\"; .port = \"${s1_port}\"; }' > /tmp/_b00014.vcl"  
     16varnish v1 -arg "-f /tmp/_b00014.vcl" -start 
    1617 
    1718client c1 { 
  • bin/varnishtest/tests/c00003.vtc

    r2f2803 r86eba8  
    1414varnish v1 -cliok "param.set listen_address 198.18.1.1:9082" 
    1515varnish v1 -vcl+backend {} -clierr 300 start 
    16 varnish v1 -cliok "param.set listen_address :9081,127.0.0.2:9082" 
     16varnish v1 -cliok "param.set listen_address 127.0.0.1:9081,127.0.0.2:9082" 
    1717varnish v1 -start 
    1818 
  • bin/varnishtest/tests/v00010.vtc

    r46026d r86eba8  
    99        txresp -hdr "Panic: please" -body "012345\n" 
    1010        sema r1 sync 2 
     11        accept 
     12        rxreq 
     13        txresp -hdr "Foo: foo" -body "abcdef\n" 
    1114} -start 
    1215 
     
    2023} -start 
    2124 
    22 varnish v1 -cliok "param.set diag_bitmap 0x00001000"  
     25varnish v1 -cliok "param.set diag_bitmap 0x00001000" 
     26 
     27# We have to force a known listen address otherwise the client cannot find 
     28# the varnish after the restart. 
     29 
     30varnish v1 -cliok "param.set listen_address 127.0.0.1:9080" -stop -start 
    2331 
    2432# varnishtest defaults to auto_restart off, to avoid masking bugs. 
     
    3240        # Don't expect answer, the server crashed. 
    3341        sema r1 sync 2 
    34         delay 2.5 
    3542} -run 
    3643 
    37 server s1 { 
    38         rxreq 
    39         txresp -hdr "Foo: foo" -body "abcdef\n" 
    40 } -start 
     44delay 2.5 
    4145 
    4246client c1 { 
  • bin/varnishtest/vtc.c

    r37fc91 r86eba8  
    137137} 
    138138 
    139 static struct vsb * 
     139struct vsb * 
    140140macro_expand(char *name) 
    141141{ 
  • bin/varnishtest/vtc.h

    r10b402 r86eba8  
    7575 
    7676void macro_def(struct vtclog *vl, const char *instance, const char *name, const char *fmt, ...); 
    77  
     77struct vsb *macro_expand(char *name); 
  • bin/varnishtest/vtc_client.c

    r10b402 r86eba8  
    4343#include "vtc.h" 
    4444 
     45#include "vsb.h" 
    4546#include "vqueue.h" 
    4647#include "miniobj.h" 
     
    7980        int i; 
    8081        unsigned u; 
     82        struct vsb *vsb; 
     83        char *p; 
    8184 
    8285        CAST_OBJ_NOTNULL(c, priv, CLIENT_MAGIC); 
    8386        AN(c->connect); 
     87 
     88        p = strdup(c->connect); 
     89        vsb = macro_expand(p); 
     90        AN(vsb); 
    8491 
    8592        vl = vtc_logopen(c->name); 
     
    8996        vtc_log(vl, 2, "Started (%u iterations)", c->repeat); 
    9097        for (u = 0; u < c->repeat; u++) { 
    91                 vtc_log(vl, 3, "Connect to %s", c->connect); 
    92                 fd = VSS_open(c->connect); 
     98                vtc_log(vl, 3, "Connect to %s", vsb_data(vsb)); 
     99                fd = VSS_open(vsb_data(vsb)); 
    93100                for (i = 0; fd < 0 && i < 3; i++) { 
    94101                        (void)sleep(1); 
    95                         fd = VSS_open(c->connect); 
    96                 } 
     102                        fd = VSS_open(vsb_data(vsb)); 
     103                } 
     104                if (fd < 0) 
     105                        vtc_log(c->vl, 0, "Failed to open %s", vsb_data(vsb)); 
    97106                assert(fd >= 0); 
    98                 vtc_log(vl, 3, "Connected to %s fd is %d", c->connect, fd); 
     107                vtc_log(vl, 3, "Connected to %s fd is %d", vsb_data(vsb), fd); 
    99108                http_process(vl, c->spec, fd, -1); 
    100109                vtc_log(vl, 3, "Closing fd %d", fd); 
     
    102111        } 
    103112        vtc_log(vl, 2, "Ending"); 
     113        vsb_delete(vsb); 
     114        free(p); 
    104115        return (NULL); 
    105116} 
     
    123134                vtc_log(c->vl, 0, "Client name must start with 'c'"); 
    124135 
    125         REPLACE(c->connect, "127.0.0.1:9081"); 
     136        REPLACE(c->connect, "${v1_sock}"); 
    126137        VTAILQ_INSERT_TAIL(&clients, c, list); 
    127138        return (c); 
  • bin/varnishtest/vtc_varnish.c

    re4d6bb r86eba8  
    173173        v->args = vsb_newauto(); 
    174174        v->telnet = "127.0.0.1:9001"; 
    175         v->accept = "127.0.0.1:9081"; 
     175        v->accept = "127.0.0.1:0"; 
    176176        v->cli_fd = -1; 
    177177        VTAILQ_INSERT_TAIL(&varnishes, v, list); 
Note: See TracChangeset for help on using the changeset viewer.