Amaury Denoyelle | 78ea5c9 | 2020-12-10 13:44:01 +0100 | [diff] [blame] | 1 | varnishtest "http-request set-timeout test" |
| 2 | |
| 3 | feature ignore_unknown_macro |
| 4 | |
Christopher Faulet | 85a8136 | 2020-12-15 17:13:39 +0100 | [diff] [blame] | 5 | #REQUIRE_VERSION=2.4 |
| 6 | |
Amaury Denoyelle | 78ea5c9 | 2020-12-10 13:44:01 +0100 | [diff] [blame] | 7 | server srv_h1 -repeat 3 { |
| 8 | rxreq |
| 9 | txresp |
| 10 | } -start |
| 11 | |
| 12 | syslog Slog1 -level info { |
| 13 | recv |
| 14 | expect ~ "^.*timeout: 1000 1000.*$" |
| 15 | } -start |
| 16 | |
| 17 | syslog Slog2 -level info { |
| 18 | recv |
| 19 | expect ~ "^.*timeout: 1000 5000.*$" |
| 20 | } -start |
| 21 | |
| 22 | syslog Slog3 -level info { |
| 23 | recv |
| 24 | expect ~ "^.*timeout: 1000 3000.*$" |
| 25 | } -start |
| 26 | |
| 27 | haproxy hap -conf { |
| 28 | defaults |
| 29 | timeout connect 1s |
| 30 | timeout client 1s |
| 31 | timeout server 1s |
| 32 | log global |
| 33 | |
| 34 | listen li1 |
| 35 | mode http |
| 36 | bind "fd@${li1}" |
| 37 | log-format "timeout: %[be_server_timeout] %[cur_server_timeout]" |
| 38 | log ${Slog1_addr}:${Slog1_port} len 2048 local0 debug err |
| 39 | server srv_h1 ${srv_h1_addr}:${srv_h1_port} |
| 40 | |
| 41 | listen li2 |
| 42 | mode http |
| 43 | bind "fd@${li2}" |
| 44 | log-format "timeout: %[be_server_timeout] %[cur_server_timeout]" |
| 45 | log ${Slog2_addr}:${Slog2_port} len 2048 local0 debug err |
| 46 | http-request set-timeout server 5s |
| 47 | server srv_h1 ${srv_h1_addr}:${srv_h1_port} |
| 48 | |
| 49 | frontend fe1 |
| 50 | mode http |
| 51 | bind "fd@${fe1}" |
| 52 | log-format "timeout: %[be_server_timeout] %[cur_server_timeout]" |
| 53 | log ${Slog3_addr}:${Slog3_port} len 2048 local0 debug err |
| 54 | default_backend be1 |
| 55 | |
| 56 | backend be1 |
| 57 | mode http |
| 58 | http-request set-timeout server int(3),mul(1000) |
| 59 | server srv_h1 ${srv_h1_addr}:${srv_h1_port} |
| 60 | } -start |
| 61 | |
| 62 | client c1 -connect ${hap_li1_sock} { |
| 63 | txreq |
| 64 | rxresp |
| 65 | expect resp.status == 200 |
| 66 | } -run |
| 67 | |
| 68 | client c2 -connect ${hap_li2_sock} { |
| 69 | txreq |
| 70 | rxresp |
| 71 | expect resp.status == 200 |
| 72 | } -run |
| 73 | |
| 74 | client c3 -connect ${hap_fe1_sock} { |
| 75 | txreq |
| 76 | rxresp |
| 77 | expect resp.status == 200 |
| 78 | } -run |
| 79 | |
| 80 | syslog Slog1 -wait |
| 81 | syslog Slog2 -wait |
| 82 | syslog Slog3 -wait |