blob: 3d3649125fe7b240e7ebe2f60bc9f14587b69888 [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
wrightlaw9a8d8a32022-09-08 16:10:48 +010011 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv1 succeeded.+reason: Layer7 check passed.+code: 221.+check duration: [[:digit:]]+ms.+status: 1/1 UP."
Frederic Lecaille3ec7bfb2018-12-13 22:15:09 +010012 barrier b sync
13 recv
Christopher Faulet617780f2020-04-07 08:00:35 +020014 expect ~ "Health check for server be1/srv1 failed.+reason: Layer7 timeout.+check duration: [[:digit:]]+ms.+status: 0/1 DOWN"
Frederic Lecaille3ec7bfb2018-12-13 22:15:09 +010015} -start
16
17syslog S2 -level notice {
18 recv
Christopher Fauleta67ed432020-04-20 14:59:20 +020019 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv2 succeeded.+reason: Layer7 check passed.+code: 200.+.+check duration: [[:digit:]]+ms.+status: 1/1 UP."
Frederic Lecaille3ec7bfb2018-12-13 22:15:09 +010020 barrier b sync
21 recv
Christopher Faulet617780f2020-04-07 08:00:35 +020022 expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv2 failed.+reason: Layer7 timeout.+check duration: [[:digit:]]+ms.+status: 0/1 DOWN"
Frederic Lecaille3ec7bfb2018-12-13 22:15:09 +010023} -start
24
25syslog S3 -level notice {
26 recv
Christopher Faulet617780f2020-04-07 08:00:35 +020027 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 +010028} -start
29
30syslog S4 -level notice {
31 recv
Christopher Faulet617780f2020-04-07 08:00:35 +020032 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."
Frederic Lecaille3ec7bfb2018-12-13 22:15:09 +010033} -start
34
35server s1 {
Christopher Faulet617780f2020-04-07 08:00:35 +020036 send "2"
37 send "2"
38 send "0"
Christopher Faulet330af2d2022-09-21 15:05:42 +020039 send "\r\n"
Frederic Lecaille3ec7bfb2018-12-13 22:15:09 +010040 recv 16
41 send "2"
42 send "4"
43 send "8"
Christopher Faulet330af2d2022-09-21 15:05:42 +020044 send "\r\n"
wrightlaw9a8d8a32022-09-08 16:10:48 +010045 recv 6
46 send "2"
47 send "2"
48 send "1"
49 send " ok\r\n"
Frederic Lecaille3ec7bfb2018-12-13 22:15:09 +010050} -start
51
52server s2 {
53 rxreq
54 txresp
55} -start
56
57haproxy h1 -conf {
58 defaults
Willy Tarreauf6739232021-11-18 17:46:22 +010059 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
60 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
61 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
Frederic Lecaille3ec7bfb2018-12-13 22:15:09 +010062 option log-health-checks
Christopher Faulet617780f2020-04-07 08:00:35 +020063 default-server inter 200ms downinter 100ms rise 1 fall 1
Frederic Lecaille3ec7bfb2018-12-13 22:15:09 +010064
65 backend be1
66 option smtpchk
67 log ${S1_addr}:${S1_port} daemon
68 server srv1 ${s1_addr}:${s1_port} check
69
70 backend be2
71 mode tcp
72 log ${S2_addr}:${S2_port} daemon
Christopher Faulet4b5f3022022-09-05 09:05:17 +020073 option httpchk OPTIONS * HTTP/1.1
74 http-check send hdr Host www
Frederic Lecaille3ec7bfb2018-12-13 22:15:09 +010075 server srv2 ${s2_addr}:${s2_port} check
76
77 backend be3
78 log ${S3_addr}:${S3_port} daemon
79 server srv3 255.255.255.255:11111 check
80
81 backend be4
82 log ${S4_addr}:${S4_port} daemon
83 server srv4 localhost:11111 check
84} -start
85
86haproxy h1 -cli {
87 barrier b sync
88 send "show servers state"
89 expect ~ .*
90}
91
92server s1 -wait
93server s2 -wait
94
95syslog S1 -wait
96syslog S2 -wait
97syslog S3 -wait
98syslog S4 -wait
99
100