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