blob: 4847b80b13bf4b7b4d7dafd8f3585d44aff2d8a5 [file] [log] [blame]
Amaury Denoyelle78ea5c92020-12-10 13:44:01 +01001varnishtest "http-request set-timeout test"
2
3feature ignore_unknown_macro
4
5server srv_h1 -repeat 3 {
6 rxreq
7 txresp
8} -start
9
10syslog Slog1 -level info {
11 recv
12 expect ~ "^.*timeout: 1000 1000.*$"
13} -start
14
15syslog Slog2 -level info {
16 recv
17 expect ~ "^.*timeout: 1000 5000.*$"
18} -start
19
20syslog Slog3 -level info {
21 recv
22 expect ~ "^.*timeout: 1000 3000.*$"
23} -start
24
25haproxy 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
60client c1 -connect ${hap_li1_sock} {
61 txreq
62 rxresp
63 expect resp.status == 200
64} -run
65
66client c2 -connect ${hap_li2_sock} {
67 txreq
68 rxresp
69 expect resp.status == 200
70} -run
71
72client c3 -connect ${hap_fe1_sock} {
73 txreq
74 rxresp
75 expect resp.status == 200
76} -run
77
78syslog Slog1 -wait
79syslog Slog2 -wait
80syslog Slog3 -wait