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