Tim Duesterhus | 5fcec84 | 2020-02-28 15:13:32 +0100 | [diff] [blame] | 1 | varnishtest "unique-id test" |
| 2 | |
| 3 | feature ignore_unknown_macro |
| 4 | |
| 5 | server s1 { |
| 6 | rxreq |
| 7 | txresp |
| 8 | } -repeat 2 -start |
| 9 | |
| 10 | haproxy h1 -conf { |
| 11 | defaults |
| 12 | mode http |
| 13 | timeout connect 1s |
| 14 | timeout client 1s |
| 15 | timeout server 1s |
| 16 | |
| 17 | frontend stable |
| 18 | bind "fd@${fe1}" |
| 19 | unique-id-format TEST-%[uuid] |
| 20 | http-response set-header A %[unique-id] |
| 21 | http-response set-header B %[unique-id] |
| 22 | default_backend be |
| 23 | |
| 24 | frontend request_data |
| 25 | bind "fd@${fe2}" |
| 26 | unique-id-format TEST-%[req.hdr(in)] |
| 27 | http-response set-header out %[unique-id] |
| 28 | default_backend be |
| 29 | |
| 30 | backend be |
| 31 | server srv1 ${s1_addr}:${s1_port} |
| 32 | } -start |
| 33 | |
| 34 | client c1 -connect ${h1_fe1_sock} { |
| 35 | txreq -url "/" |
| 36 | rxresp |
| 37 | expect resp.status == 200 |
| 38 | expect resp.http.a == resp.http.b |
| 39 | } -run |
| 40 | |
| 41 | client c2 -connect ${h1_fe2_sock} { |
| 42 | txreq -url "/" \ |
| 43 | -hdr "in: 12345678" |
| 44 | rxresp |
| 45 | expect resp.status == 200 |
| 46 | expect resp.http.out == "TEST-12345678" |
| 47 | } -run |