blob: b57b965f4de93ffcff92e0bc1d0b0cda602f5a0a [file] [log] [blame]
Frederic Lecaille3ec7bfb2018-12-13 22:15:09 +01001varnishtest "Check: smptchk option"
2feature ignore_unknown_macro
3
4barrier b cond 3
5
6syslog S1 -level notice {
7 recv
8 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy be1 started"
9 recv
10 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv1 succeeded, reason: Layer7 check passed, code: 248, check duration: [[:digit:]]+ms, status: 1/1 UP."
11 barrier b sync
12 recv
13 expect ~ "Health check for server be1/srv1 failed, reason: Layer7 timeout, check duration: [[:digit:]]+ms, status: 0/1 DOWN"
14} -start
15
16syslog S2 -level notice {
17 recv
18 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy be2 started"
19 recv
20 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv2 succeeded, reason: Layer7 check passed, code: 200, info: \"OK\", check duration: [[:digit:]]+ms, status: 1/1 UP."
21 barrier b sync
22 recv
23 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv2 failed, reason: Layer7 timeout, check duration: [[:digit:]]+ms, status: 0/1 DOWN"
24} -start
25
26syslog S3 -level notice {
27 recv
28 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy be3 started"
29 recv
30 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be3/srv3 failed, reason: Layer4 connection problem, info: \"General socket error \\(Network is unreachable\\)\", check duration: [[:digit:]]+ms, status: 0/1 DOWN."
31} -start
32
33syslog S4 -level notice {
34 recv
35 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy be4 started"
36 recv
37 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be4/srv4 failed, reason: Layer4 connection problem, info: \"Connection refused\", check duration: [[:digit:]]+ms, status: 0/1 DOWN."
38} -start
39
40server s1 {
41 recv 16
42 send "2"
43 send "4"
44 send "8"
45 send "\r\n\r\n"
46} -start
47
48server s2 {
49 rxreq
50 txresp
51} -start
52
53haproxy h1 -conf {
54 defaults
55 timeout client 1s
56 timeout server 1s
57 timeout connect 1s
58 option log-health-checks
59 default-server downinter 1s rise 1 fall 1
60
61 backend be1
62 option smtpchk
63 log ${S1_addr}:${S1_port} daemon
64 server srv1 ${s1_addr}:${s1_port} check
65
66 backend be2
67 mode tcp
68 log ${S2_addr}:${S2_port} daemon
69 option httpchk OPTIONS * HTTP/1.1\r\nHost:\ www
70 server srv2 ${s2_addr}:${s2_port} check
71
72 backend be3
73 log ${S3_addr}:${S3_port} daemon
74 server srv3 255.255.255.255:11111 check
75
76 backend be4
77 log ${S4_addr}:${S4_port} daemon
78 server srv4 localhost:11111 check
79} -start
80
81haproxy h1 -cli {
82 barrier b sync
83 send "show servers state"
84 expect ~ .*
85}
86
87server s1 -wait
88server s2 -wait
89
90syslog S1 -wait
91syslog S2 -wait
92syslog S3 -wait
93syslog S4 -wait
94
95