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